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.
Bitmaps and pitch
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:
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]
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 =)
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 =)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement