Sign in to follow this  

Bitmaps and pitch

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this