// Draw a bitmap-based glyph to a "Graphics" object. "bits" must be // in the form of an xbm bitmap. public override void DrawGlyph(int x, int y, byte[] bits, int bitsWidth, int bitsHeight, System.Drawing.Color color) { Xsharp.Bitmap bitmap; bitmap = new Xsharp.Bitmap(bitsWidth, bitsHeight, bits); try { graphics.Foreground = DrawingToolkit.DrawingToXColor(color); graphics.SetFillStippled(bitmap, x, y); graphics.FillRectangle(x, y, bitsWidth, bitsHeight); graphics.SetFillSolid(); } finally { bitmap.Destroy(); } }
/// <summary> /// <para>Destroy this image if it is currently active.</para> /// </summary> public void Destroy() { if (pixmap != null) { pixmap.Destroy(); pixmap = null; } if (mask != null) { mask.Destroy(); mask = null; } if (pixmapXImage != IntPtr.Zero) { Xlib.XSharpDestroyImage(pixmapXImage); pixmapXImage = IntPtr.Zero; } if (maskXImage != IntPtr.Zero) { Xlib.XSharpDestroyImage(maskXImage); maskXImage = IntPtr.Zero; } }
// Draw a bitmap-based glyph to a "Graphics" object. "bits" must be // in the form of an xbm bitmap. public override void DrawGlyph(int x, int y, byte[] bits, int bitsWidth, int bitsHeight, System.Drawing.Color color) { Xsharp.Bitmap bitmap; bitmap = new Xsharp.Bitmap(bitsWidth, bitsHeight, bits); try { graphics.Foreground = DrawingToolkit.DrawingToXColor(color); graphics.SetFillStippled(bitmap, x, y); graphics.FillRectangle(x, y, bitsWidth, bitsHeight); graphics.SetFillSolid(); } finally { bitmap.Destroy(); } }