本文整理汇总了C++中Bitmap::Allocate方法的典型用法代码示例。如果您正苦于以下问题:C++ Bitmap::Allocate方法的具体用法?C++ Bitmap::Allocate怎么用?C++ Bitmap::Allocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitmap
的用法示例。
在下文中一共展示了Bitmap::Allocate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memcpy
void D3D9RenderTargetTexture::GetData(Bitmap &B)
{
D3DAlwaysValidate(_Device->GetRenderTargetData(_Surface, _SurfacePlain), "GetRenderTargetData");
D3DLOCKED_RECT LockedRect;
D3DAlwaysValidate(_SurfacePlain->LockRect(&LockedRect, NULL, 0), "LockRect");
B.Allocate(_Width, _Height);
RGBColor *SurfData = (RGBColor*)LockedRect.pBits;
for(UINT y = 0; y < _Height; y++)
{
//memcpy(B[_Height - 1 - y], &SurfData[y * LockedRect.Pitch / 4], _Width * 4);
memcpy(B[y], &SurfData[y * LockedRect.Pitch / 4], _Width * 4);
}
_SurfacePlain->UnlockRect();
}
示例2: PersistentAssert
void D3D9Texture::ReadData(Bitmap &Bmp)
{
PersistentAssert(_Width != 0 && _Height != 0 && _Format == D3DFMT_A8R8G8B8 && _RenderTarget, "ReadData called on invalid surface");
Bmp.Allocate(_Width, _Height);
D3DLOCKED_RECT Rect;
D3DAlwaysValidate(_Device->GetRenderTargetData(_SurfaceTopLevel, _SurfacePlain), "GetRenderTargetData");
D3DAlwaysValidate(_SurfacePlain->LockRect(&Rect, NULL, D3DLOCK_READONLY), "LockRect");
BYTE *Bytes = (BYTE *)Rect.pBits;
for(UINT y = 0; y < _Height; y++)
{
RGBColor *CurRow = (RGBColor *)(Bytes + y * Rect.Pitch);
for(UINT x = 0; x < _Width; x++)
{
Bmp[y][x] = CurRow[x];
}
}
D3DValidate(_SurfacePlain->UnlockRect(), "UnlockRect");
}
示例3: CaptureScreen
void SoftwareGraphicsDevice::CaptureScreen(WindowManager &WM, Bitmap &B)
{
int i, i2, Width, Height;
RECT WindowCoord;
RGBColor Color;
GetClientRect(WM.CastWindows().GetHWND(), &WindowCoord);
MapWindowPoints(WM.CastWindows().GetHWND(), GetDesktopWindow(), (LPPOINT)&WindowCoord, 2);
Width = WindowCoord.right - WindowCoord.left;
Height = WindowCoord.bottom - WindowCoord.top; //get the Width/Height
B.Allocate(Width, Height); //allocate space
for(i=0; i<Height; i++)
{
for(i2=0; i2<Width; i2++)
{
B[Height-i-1][i2] = Bmp[i][i2]; //load the current screen into B
}
}
}
示例4: LoadFromPalette
void ImageCompressorBlockPalette::LoadFromPalette(InputDataStream &stream, Bitmap &bmp)
{
UINT width, height;
stream >> width >> height;
bmp.Allocate(width, height);
for(UINT x = 0; x < width; x += blockDimension)
{
for(UINT y = 0; y < height; y += blockDimension)
{
BYTE paletteIndex;
//UINT16 paletteIndex;
stream >> paletteIndex;
const Block32 &curBlock = _palette.colors[paletteIndex];
for(UINT yOffset = 0; yOffset < blockDimension; yOffset++)
{
for(UINT xOffset = 0; xOffset < blockDimension; xOffset++)
{
bmp[y + yOffset][x + xOffset] = curBlock.c[yOffset][xOffset];
}
}
}
}
}