Results 1 to 4 of 4

Thread: Slice Up A Bitmap

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fox, OK
    Posts
    381

    Slice Up A Bitmap

    I have a picture of a deck of cards laid out in rows and columns. In VB6, there was a way to get a certain "cell" from that bitmap. That way, when I need a certain card, I just get some pixels from my picture that has ALL of the cards. I don't remember the name of the control that did that in VB6 but I assume there's something similar in VB2005.

    What is it and how does it work?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary, Canada
    Posts
    453

    Re: Slice Up A Bitmap

    Image List? You need to split the images up, but you could load all 52 card images into the image list, and then when you want to access any of the you use imageList.Image[22] to get the 23rd card (the array start at 0, so imageList.Image[0] is the first card).
    "I'd rather have a full bottle in front of me than a full frontal lobotomy!"

  3. #3
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Slice Up A Bitmap

    How are you planning on drawing these cards?

    To draw a "cell", you first figure out the height and width of each card in your sprite sheet. For example, if you have a 2x2 grid of cards, and the picture is 32x48, then you know that each card has a height of 24 pixels, and a width of 16 pixels.

    Now, if you wanted to draw the bottom right card, you would tell your drawing function to start drawing from 16,24, with a width and height of 16,24.

    Does that make sense?

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Slice Up A Bitmap

    Good suggestions so far.

    BitBlt would be good for this, you can specify a source x and y position so the calculations would be as ChemicalNova stated above.

    Have a look in my sig for BitBlt help.

    Pino

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