本文整理汇总了C#中BizHawk.Bizware.BizwareGL.BitmapBuffer.LockBits方法的典型用法代码示例。如果您正苦于以下问题:C# BitmapBuffer.LockBits方法的具体用法?C# BitmapBuffer.LockBits怎么用?C# BitmapBuffer.LockBits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BizHawk.Bizware.BizwareGL.BitmapBuffer
的用法示例。
在下文中一共展示了BitmapBuffer.LockBits方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadTextureData
public unsafe void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
{
sdi.BitmapData bmp_data = bmp.LockBits();
var tw = tex.Opaque as TextureWrapper;
var dr = tw.Texture.LockRectangle(0, LockFlags.None);
//TODO - do we need to handle odd sizes, weird pitches here?
if (bmp.Width * 4 != bmp_data.Stride)
throw new InvalidOperationException();
dr.Data.WriteRange(bmp_data.Scan0, bmp.Width * bmp.Height * 4);
dr.Data.Close();
tw.Texture.UnlockRectangle(0);
bmp.UnlockBits(bmp_data);
}
示例2: LoadTextureData
public void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
{
sdi.BitmapData bmp_data = bmp.LockBits();
try
{
GL.BindTexture(TextureTarget.Texture2D, (int)tex.Opaque);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bmp.Width, bmp.Height, PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);
}
finally
{
bmp.UnlockBits(bmp_data);
}
}
示例3: ResolveTexture2d
public unsafe BitmapBuffer ResolveTexture2d(Texture2d tex)
{
//note - this is dangerous since it changes the bound texture. could we save it?
BindTexture2d(tex);
var bb = new BitmapBuffer(tex.IntWidth, tex.IntHeight);
var bmpdata = bb.LockBits();
GL.GetTexImage(TextureTarget.Texture2D, 0, PixelFormat.Bgra, PixelType.UnsignedByte, bmpdata.Scan0);
var err = GL.GetError();
bb.UnlockBits(bmpdata);
return bb;
}
示例4: LoadTextureData
public void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
{
sdi.BitmapData bmp_data = bmp.LockBits();
d3d9.Texture dtex = tex.Opaque as d3d9.Texture;
var dr = dtex.LockRectangle(0, LockFlags.None);
//TODO - do we need to handle odd sizes, weird pitches here?
dr.Data.WriteRange(bmp_data.Scan0, bmp.Width * bmp.Height);
dtex.UnlockRectangle(0);
bmp.UnlockBits(bmp_data);
}