本文整理汇总了C#中System.Windows.Media.Imaging.WriteableBitmap.FillPolygon方法的典型用法代码示例。如果您正苦于以下问题:C# WriteableBitmap.FillPolygon方法的具体用法?C# WriteableBitmap.FillPolygon怎么用?C# WriteableBitmap.FillPolygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Imaging.WriteableBitmap
的用法示例。
在下文中一共展示了WriteableBitmap.FillPolygon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
//.........这里部分代码省略.........
mCurrentDrawTarget.Blit(dstRect,
b,
srcRect);
});
};
syscalls.maGetTextSizeW = delegate(int str)
{
String text = core.GetDataMemory().ReadWStringAtAddress(str);
int textWidth = 0;
int textHeight = 0;
MoSync.Util.RunActionOnMainThreadSync(() =>
{
textBlock.Text = text;
textWidth = (int)textBlock.ActualWidth;
textHeight = (int)textBlock.ActualHeight;
});
return MoSync.Util.CreateExtent(textWidth, textHeight);
};
syscalls.maFillTriangleFan = delegate(int points, int count)
{
int[] newPoints = new int[count * 2 + 2];
for (int i = 0; i < count; i++)
{
newPoints[i * 2 + 0] = core.GetDataMemory().ReadInt32(points + i * 8);
newPoints[i * 2 + 1] = core.GetDataMemory().ReadInt32(points + i * 8 + 4);
}
newPoints[count * 2 + 0] = core.GetDataMemory().ReadInt32(points + 0);
newPoints[count * 2 + 1] = core.GetDataMemory().ReadInt32(points + 4);
mCurrentDrawTarget.FillPolygon(newPoints, (int)mCurrentColor);
};
syscalls.maFillTriangleStrip = delegate(int points, int count)
{
int[] xcoords = new int[count];
int[] ycoords = new int[count];
for (int i = 0; i < count; i++)
{
xcoords[i] = core.GetDataMemory().ReadInt32(points + i * 8);
ycoords[i] = core.GetDataMemory().ReadInt32(points + i * 8 + 4);
}
for (int i = 2; i < count; i++)
{
mCurrentDrawTarget.FillTriangle(
xcoords[i - 2], ycoords[i - 2],
xcoords[i - 1], ycoords[i - 1],
xcoords[i - 0], ycoords[i - 0],
(int)mCurrentColor);
}
};
syscalls.maSetDrawTarget = delegate(int drawTarget)
{
int oldDrawTarget = mCurrentDrawTargetIndex;
if (drawTarget == mCurrentDrawTargetIndex) return oldDrawTarget;
if (drawTarget == MoSync.Constants.HANDLE_SCREEN)
{
mCurrentDrawTarget = mBackBuffer;
mCurrentDrawTargetIndex = drawTarget;
示例2: Init
//.........这里部分代码省略.........
int textWidth = 0;
int textHeight = 0;
GetTextSize(text, out textWidth, out textHeight);
return MoSync.Util.CreateExtent(textWidth, textHeight);
};
syscalls.maDrawTextW = delegate(int left, int top, int str)
{
String text = core.GetDataMemory().ReadWStringAtAddress(str);
if (text.Length == 0) return;
DrawText(text, left, top);
};
syscalls.maGetTextSizeW = delegate(int str)
{
String text = core.GetDataMemory().ReadWStringAtAddress(str);
int textWidth = 0;
int textHeight = 0;
GetTextSize(text, out textWidth, out textHeight);
return MoSync.Util.CreateExtent(textWidth, textHeight);
};
syscalls.maFillTriangleFan = delegate(int points, int count)
{
int[] newPoints = new int[count * 2 + 2];
for (int i = 0; i < count; i++)
{
newPoints[i * 2 + 0] = core.GetDataMemory().ReadInt32(points + i * 8 + MoSync.Struct.MAPoint2d.x);
newPoints[i * 2 + 1] = core.GetDataMemory().ReadInt32(points + i * 8 + MoSync.Struct.MAPoint2d.y);
}
newPoints[count * 2 + 0] = core.GetDataMemory().ReadInt32(points + MoSync.Struct.MAPoint2d.x);
newPoints[count * 2 + 1] = core.GetDataMemory().ReadInt32(points + MoSync.Struct.MAPoint2d.y);
mCurrentDrawTarget.FillPolygon(newPoints, (int)mCurrentColor);
};
syscalls.maFillTriangleStrip = delegate(int points, int count)
{
int[] xcoords = new int[count];
int[] ycoords = new int[count];
for (int i = 0; i < count; i++)
{
xcoords[i] = core.GetDataMemory().ReadInt32(points + i * 8 + MoSync.Struct.MAPoint2d.x);
ycoords[i] = core.GetDataMemory().ReadInt32(points + i * 8 + MoSync.Struct.MAPoint2d.y);
}
for (int i = 2; i < count; i++)
{
mCurrentDrawTarget.FillTriangle(
xcoords[i - 2], ycoords[i - 2],
xcoords[i - 1], ycoords[i - 1],
xcoords[i - 0], ycoords[i - 0],
(int)mCurrentColor);
}
};
syscalls.maSetDrawTarget = delegate(int drawTarget)
{
int oldDrawTarget = mCurrentDrawTargetIndex;
if (drawTarget == mCurrentDrawTargetIndex) return oldDrawTarget;
if (drawTarget == MoSync.Constants.HANDLE_SCREEN)
{
mCurrentDrawTarget = mBackBuffer;
mCurrentDrawTargetIndex = drawTarget;