本文整理汇总了C#中MonoMac.CoreGraphics.CGContext.DrawImage方法的典型用法代码示例。如果您正苦于以下问题:C# CGContext.DrawImage方法的具体用法?C# CGContext.DrawImage怎么用?C# CGContext.DrawImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoMac.CoreGraphics.CGContext
的用法示例。
在下文中一共展示了CGContext.DrawImage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawInContext
public override void DrawInContext (CGContext ctx)
{
current_frame = current_frame % frames.Length;
if (frames[current_frame] == null)
frames[current_frame] = GuiUtil.CGImageFromBitmap (grp.GetFrame (current_frame),
grp.Width, grp.Height,
palette,
true);
ctx.DrawImage (new RectangleF (x, y, grp.Width, grp.Height), frames[current_frame]);
}
示例2: RenderGlyphToContext
public static void RenderGlyphToContext (CGContext context, PointF position, Glyph g, Fnt font, byte[] palette, int offset)
{
byte[] buf = new byte[g.Width * g.Height * 4];
int i = 0;
for (int y = g.Height - 1; y >= 0; y--) {
for (int x = g.Width - 1; x >= 0; x--) {
if (g.Bitmap[y,x] == 0)
buf [i + 0] = 0;
else if (g.Bitmap[y,x] == 1)
buf [i + 0] = 255;
else
buf [i + 0] = 128;
buf[i + 1] = palette[ (g.Bitmap[y,x]) * 3 + offset + 0];
buf[i + 2] = palette[ (g.Bitmap[y,x]) * 3 + offset + 1];
buf[i + 3] = palette[ (g.Bitmap[y,x]) * 3 + offset + 2];
if (buf[i+1] == 252 && buf[i+2] == 0 && buf[i+3] == 252)
buf[i + 0] = 0;
i += 4;
}
}
CGImage glyphImage = CreateImage (buf, (ushort)g.Width, (ushort)g.Height, 32, g.Width * 4);
context.DrawImage (new RectangleF (position, new SizeF (g.Width, g.Height)), glyphImage);
}
示例3: DrawPattern
void DrawPattern (CGContext context)
{
var destRect = new sd.RectangleF(0, 0, image.Width, image.Height);
context.ConcatCTM (new CGAffineTransform (1, 0, 0, -1, 0, image.Height));
context.DrawImage (destRect, image);
}
示例4: DrawLayer
public override void DrawLayer (CALayer layer, CGContext context)
{
RectangleF box = context.GetClipBoundingBox ();
int tile_x = (int)(box.X / 32);
int tile_y = (int)((renderer.pixel_height - box.Y) / 32);
try {
ushort[,] mapTiles = renderer.Chk.MapTiles;
CGImage image = renderer.GetTile (mapTiles[tile_x, tile_y]);
context.DrawImage (box, image);
}
catch (Exception e) {
Console.WriteLine (e);
}
}
示例5: DrawTexture
// test draw pattern
protected void DrawTexture(CGContext context)
{
var destRect = new RectangleF(0,0,textureImage.Width,textureImage.Height);
context.DrawImage(destRect, textureImage.NativeCGImage);
if (wrapMode == WrapMode.TileFlipX)
{
context.ConcatCTM(CGAffineTransform.MakeScale(-1,1));
context.DrawImage(destRect, textureImage.NativeCGImage);
}
if (wrapMode == WrapMode.TileFlipY)
{
var transformY = new CGAffineTransform(1, 0, 0, -1,
textureImage.Width,
textureImage.Height);
context.ConcatCTM(transformY);
context.DrawImage(destRect, textureImage.NativeCGImage);
}
if (wrapMode == WrapMode.TileFlipXY)
{
// draw the original
var transform = new CGAffineTransform(1, 0, 0, 1,
0, textureImage.Height);
context.ConcatCTM(transform);
context.DrawImage(destRect, textureImage.NativeCGImage);
// reset the transform
context.ConcatCTM (context.GetCTM().Invert());
// draw next to original one that is flipped by x axis
transform = new CGAffineTransform(-1, 0, 0, 1,
textureImage.Width * 2, textureImage.Height);
context.ConcatCTM(transform);
context.DrawImage(destRect, textureImage.NativeCGImage);
// reset the transform
context.ConcatCTM (context.GetCTM().Invert());
// draw one that is flipped by Y axis under the oricinal
transform = new CGAffineTransform(1, 0, 0, -1,
0, textureImage.Height);
context.ConcatCTM(transform);
context.DrawImage(destRect, textureImage.NativeCGImage);
// draw the last one of the quadrant which is flipped by both the y and x axis
context.ConcatCTM (context.GetCTM().Invert());
transform = new CGAffineTransform(-1, 0, 0, -1,
textureImage.Width * 2, textureImage.Height);
context.ConcatCTM(transform);
context.DrawImage(destRect, textureImage.NativeCGImage);
}
}
示例6: DrawLayer
public override void DrawLayer (CALayer layer, CGContext context)
{
if (el.Player.CurrentFrame != null)
context.DrawImage (new RectangleF ( 0, el.Height - el.Player.CurrentFrame.Height * el.playerZoom, el.Player.CurrentFrame.Width, el.Player.CurrentFrame.Height), el.Player.CurrentFrame);
}