本文整理汇总了C#中System.Drawing.FastBitmap.GetRowPtr方法的典型用法代码示例。如果您正苦于以下问题:C# FastBitmap.GetRowPtr方法的具体用法?C# FastBitmap.GetRowPtr怎么用?C# FastBitmap.GetRowPtr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.FastBitmap
的用法示例。
在下文中一共展示了FastBitmap.GetRowPtr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckShadowTexture
static void CheckShadowTexture( IGraphicsApi graphics )
{
if( shadowTex != -1 ) return;
const int size = 128, half = size / 2;
using( Bitmap bmp = new Bitmap( size, size ) )
using( FastBitmap fastBmp = new FastBitmap( bmp, true, false ) )
{
int inPix = new FastColour( 0, 0, 0, 200 ).ToArgb();
int outPix = new FastColour( 0, 0, 0, 0 ).ToArgb();
for( int y = 0; y < fastBmp.Height; y++ ) {
int* row = fastBmp.GetRowPtr( y );
for( int x = 0; x < fastBmp.Width; x++ ) {
double dist = (half - (x + 0.5)) * (half - (x + 0.5)) +
(half - (y + 0.5)) * (half - (y + 0.5));
row[x] = dist < half * half ? inPix : outPix;
}
}
shadowTex = graphics.CreateTexture( fastBmp );
}
}
示例2: ClearHat
static unsafe void ClearHat( Bitmap bmp, SkinType skinType )
{
using( FastBitmap fastBmp = new FastBitmap( bmp, true, false ) ) {
int sizeX = (bmp.Width / 64) * 32;
int yScale = skinType == SkinType.Type64x32 ? 32 : 64;
int sizeY = (bmp.Height / yScale) * 16;
// determine if we actually need filtering
for( int y = 0; y < sizeY; y++ ) {
int* row = fastBmp.GetRowPtr( y );
row += sizeX;
for( int x = 0; x < sizeX; x++ ) {
byte alpha = (byte)(row[x] >> 24);
if( alpha != 255 ) return;
}
}
// only perform filtering when the entire hat is opaque
int fullWhite = FastColour.White.ToArgb();
int fullBlack = FastColour.Black.ToArgb();
for( int y = 0; y < sizeY; y++ ) {
int* row = fastBmp.GetRowPtr( y );
row += sizeX;
for( int x = 0; x < sizeX; x++ ) {
int pixel = row[x];
if( pixel == fullWhite || pixel == fullBlack ) row[x] = 0;
}
}
}
}