当前位置: 首页>>代码示例>>C++>>正文


C++ Bitmap::Allocate方法代码示例

本文整理汇总了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();
}
开发者ID:ghsoftco,项目名称:basecode14,代码行数:16,代码来源:D3D9RenderTargetTexture.cpp

示例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");
}
开发者ID:kbinani,项目名称:dxrip,代码行数:18,代码来源:D3D9Texture.cpp

示例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
        }
    }
}
开发者ID:ghsoftco,项目名称:basecode14,代码行数:22,代码来源:SoftwareGraphicsDevice.cpp

示例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];
                }
            }
        }
    }
}
开发者ID:ElanHR,项目名称:Provincial,代码行数:23,代码来源:ImageCompressorBlockPalette.cpp


注:本文中的Bitmap::Allocate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。