Advertisement Jump to content
Sign in to follow this  

Bitmaps and pitch

This topic is 4931 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;
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

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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!