// Dispose of this image. protected override void Dispose(bool disposing) { if (xImage != null) { xImage.Destroy(); xImage = null; } }
public override void DrawImage(IToolkitImage image, int x, int y) { Xsharp.Image ximage = (image as DrawingImage).GetNativeImage(); if (ximage != null) { graphics.DrawImage(x, y, ximage); } }
// Dispose of this image. protected override void Dispose(bool disposing) { if(xImage != null) { xImage.Destroy(); xImage = null; } }
public override void ImageChanged() { if (xImage != null) { xImage.Dispose(); xImage = null; } if (base.image != null) { xImage = new Xsharp.Image (screen, base.image.GetFrame(base.frame)); } }
public override void ImageChanged() { if(xImage != null) { xImage.Dispose(); xImage = null; } if(base.image != null) { xImage = new Xsharp.Image (screen, base.image.GetFrame(base.frame)); } }
// Select this brush into a graphics object. public void Select(IToolkitGraphics _graphics) { DrawingGraphics graphics = (_graphics as DrawingGraphics); if (graphics != null && image != null) { Xsharp.Graphics g = graphics.graphics; Xsharp.Image nativeImage = image.GetNativeImage(); g.Function = GCFunction.GXcopy; g.SubwindowMode = SubwindowMode.ClipByChildren; g.SetFillTiled(nativeImage.Pixmap, (int)(dstRect.X), (int)(dstRect.Y)); } }
// Set this window's icon. void IToolkitTopLevelWindow.SetIcon(Icon icon) { DotGNU.Images.Frame frame = ToolkitManager.GetImageFrame(icon); Xsharp.Image origIcon = Icon; if (frame != null) { Icon = new Xsharp.Image(Screen, frame); } else { Icon = null; } if (origIcon != null) { origIcon.Dispose(); } }
// Draw an image. public override void DrawImage (IToolkitImage image, System.Drawing.Point[] src, System.Drawing.Point[] dest) { if ((src[1].X - src[0].X) == (dest[1].X - dest[0].X) && (src[2].Y - src[0].Y) == (dest[2].Y - dest[0].Y)) { // Draw a sub-image, without stretching the pixels. Xsharp.Image ximage = (image as DrawingImage).GetNativeImage(); if (ximage != null) { graphics.DrawImage(dest[0].X, dest[0].Y, ximage, src[0].X, src[0].Y, src[1].X - src[0].X, src[2].Y - src[0].Y); } } else { // Hard case: stretch the image before drawing it. base.DrawImage(image, src, dest); } }
// Set this window's icon. void IToolkitTopLevelWindow.SetIcon(Icon icon) { DotGNU.Images.Frame frame = ToolkitManager.GetImageFrame(icon); Xsharp.Image origIcon = Icon; if(frame != null) { Icon = new Xsharp.Image(Screen, frame); } else { Icon = null; } if(origIcon != null) { origIcon.Dispose(); } }