Jump to content
  • Advertisement
Sign in to follow this  
Programmer16

Bitmaps and pitch

This topic is 4750 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm making a class that is going to manipulate data that I load from a file (probably bitmaps for now.) Here's an example of its usage:
CDataSurface SA, SB;
SA.LoadFromFile("bitmap.bmp");
SB.CreateFromSurface(SA, CFS_SIZEONLY);

RECT SrcRect = { 0, 0, 32, 32 };
POINT DstPoint = { 100, 10 };
SA.CopyToSurface(&SB, &SrcRect, &DstPoint);

IDirect3DTexture9* pTexture = 0;
// Create texture using SA/SB's size
// texture, src rect, dst point, flags)
SB.CopyToTexture(pTexture, 0, 0, CTT_ALPHAMASK);

// render using pTexture now.


Edit: Ok, after thinking about it, I'm not loading the pitch from the file, so I guess I don't have to worry about it (someone please correct me if I'm wrong) unless I'm working with textures and surfaces. Thanks! [Edited by - Programmer16 on July 19, 2005 12:11:37 AM]

Share this post


Link to post
Share on other sites
Advertisement
IIRC,

Pitch is commonly used for such things as alignment in memory and whatever else the driver might be doing.

When reading data from file, I do not belive that bitmap files use internal scanline padding.

Obviously though you should never ignore pitch when dealing with a memory buffer =)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!