Results 1 to 4 of 4

Thread: [RESOLVED] Working with Graphics?

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2008
    Posts
    47

    Resolved [RESOLVED] Working with Graphics?

    VB 6 -Enterprise Edition OS-Windows XP Professional SP2

    I need to write an application that will allow some graphic features such as: scaling (changing it's size), rotate, crop, etc--maybe some more robust features like emboss, change resolution,etc.

    Another thing I want to do is to "join" different graphics to make a bigger one. For example: let's say I had 3 graphics. Graphic-1 had the letter "S",Graphic-2 had the letter "a", and Graphic-3 had the letter "m". A new graphic, Graphic-4 can be created that is a combination of others. Graphic-4 would look like "Sam".

    Before you say, just type the letters "Sam", this was jst an example. The graphics 1,2, and 3 can contain graphic images. Another example: graphic-5 can contain "(", Graphic-6 = ")", and Graphic-7 = "*". A new graphic, Graphic-8 may look like this: "(**Sam**)".

    Can this be done in VB and if so how? If you can help, please do so. If you know of any examples, please send me the link.

    Thanks,
    Sam

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Working with Graphics?

    All of it can be done in VB.

    1. You will need to decide which O/S you want to support. GDI+ can be used on Win98 and above but is only installed on WinXP and above. Can be downloaded for free for the older O/S. The universal DIB section can be used too and is compatible with all O/S from Win95 and up. GDI+ has some nice built in functions, like rotation, bicubic scaling for example. DIB sections have some APIs that may help but may not work, as expected, with 32 bit alphablended images: PlgBlt API can quickly rotate. Using DIBs by themselves, without GDI+, means doing all the math and pixel manipulations manually. Many algorithms exist on the net for all sorts of graphic effects. You also have the option of using 3rd party DLLs to assist: FreeImage comes to mind.

    2. Combining images can be simple or difficult, depending on how you want them joined. The bottom line is that you will be creating a new larger bitmap and rendering the other images to the correct coordinates on that new image. Maybe searching on keyword "Panoramic" could be useful. However, in your description, sounds more like a bitmap font, where each character is a cell in a single bitmap. When a letter is needed, the app simply transfers the cell from the bitmap to the destination. That is far easier than panoramic slicing. VB's PaintPicture can be used for that purpose as well as BitBlt API.

    Regardless, one cannot post examples of all the possible graphics effects as it would be equivalent to posting an entire graphics program.

    If interested in using GDI+, recommend googling for some GDI+ tutorials. If interested in learning more about DIB sections, this site can help: click on the Tutorials section.

    I think the recommendation here is start you research, then start coding one graphic effect at a time. When having problems with that effect, post back with more specific questions.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2008
    Posts
    47

    Re: Working with Graphics?

    Here is an example of what I am trying to do. This example was done by a program written in Delphi but this program is extremely limited on what it can do. In fact, this is all it can do, no scaling, no rotating, no font sizing, it can't even save the final result (part-5.bmp).

    When you look at the attached, make sure you look at them in order.

    This Delphi program brings up a form with a large text box (or picturebox--I can't tell). When you hit the "." key, Part-1.bmp is painted on the screen, then you type the letters-Part-2,3, and 4 are appended. Finally you hit the "/" key and the final result is Part-5.

    Note the contiguous lines above and below the letters. How can that be done?

    Sam
    Attached Images Attached Images      

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Working with Graphics?

    Here's my guess, but that is all it is -- a guess

    The letters are pieces of a 26+ character bitmap. Each letter in the bitmap is a tile or cell. Since each are a cell, each letter has a fixed width and height known in advance. I am guessing this method over others simply because when creating jewelry or something similar to the above, you probably want to guarantee each letter is the same height (though they can be different widths). If simply rendering a letter from any font, no guarantees all captial letters in all fonts are the same size within that font.

    1. The cartuoche (symbol) consists of 3 parts: left edge (arc), middle (lines), right edge (arc). When each letter is added, the middle part of the cartouche is copied "over" the top & bottom edges of the letter, at same width as the character cell/tile.

    2. The lines above/below the letters are actually part of each letter. When each letter is added, the lines are added too, automatically.

    For those comfortable with BitBlt and font bitmaps, what you described above would be really easy to duplicate. But unless you are already knowledgeable, you should research and play with BitBlt until you understand it usage. Literally millions of examples on this forum and the net combined. Idea. Search for "digital clock" sample programs in VB. Many digital clocks use similar methods, where each number is a separate tile in a larger bitmap. Many scrolling marquee programs may use that method also.
    Last edited by LaVolpe; Nov 21st, 2009 at 12:25 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width