// Get the background information for use in graphics object clears. internal void GetBackgroundInfo(out Color bg, out Pixmap pixmap, out int tx, out int ty) { if(background.Index == StandardColor.Inherit) { InputOutputWidget parent = (Parent as InputOutputWidget); if(parent != null) { parent.GetBackgroundInfo (out bg, out pixmap, out tx, out ty); tx -= x; ty -= y; } else { bg = new Color(StandardColor.Background); pixmap = null; tx = 0; ty = 0; } } else if(background.Index == StandardColor.Pixmap) { bg = background; pixmap = backgroundPixmap; tx = 0; ty = 0; } else { bg = background; pixmap = null; tx = 0; ty = 0; } }
/// <summary> /// <para>Set the fill style mode to "solid".</para> /// </summary> public void SetFillSolid() { try { IntPtr display = Lock(); Xlib.XSetFillStyle (display, gc, (int)(Xsharp.FillStyle.FillSolid)); if(tile != null) { Xlib.XSetTSOrigin(display, gc, 0, 0); tile = null; } else if(stipple != null) { Xlib.XSetTSOrigin(display, gc, 0, 0); stipple = null; } } finally { dpy.Unlock(); } }
// Convert an XImage into a Pixmap object. public static Pixmap XImageToPixmap(Screen screen, IntPtr ximage) { int width, height; Xlib.XSharpGetImageSize(ximage, out width, out height); Pixmap pixmap = new Pixmap(screen, width, height); Graphics graphics = new Graphics(pixmap); graphics.PutXImage(ximage, 0, 0, 0, 0, width, height); graphics.Dispose(); return pixmap; }
/// <summary> /// <para>Set the fill style mode to "opaque stippled", with a specific /// stippling bitmap.</para> /// </summary> /// /// <param name="stipple"> /// <para>The stippling bitmap to use.</para> /// </param> /// /// <param name="xorigin"> /// <para>The X co-ordinate of the stippling origin.</para> /// </param> /// /// <param name="yorigin"> /// <para>The Y co-ordinate of the stippling origin.</para> /// </param> /// /// <exception cref="T:System.ArgumentNullException"> /// <para>The <paramref name="stipple"/> value is /// <see langword="null"/>.</para> /// </exception> /// /// <exception cref="T:Xsharp.XException"> /// <para>The <paramref name="xorigin"/> or <paramref name="yorigin"/> /// value is out of range.</para> /// </exception> /// /// <exception cref="T:System.XInvalidOperationException"> /// <para>The <paramref name="tile"/> value is disposed.</para> /// </exception> public void SetFillOpaqueStippled(Bitmap stipple, int xorigin, int yorigin) { if(stipple == null) { throw new ArgumentNullException("stipple"); } if(xorigin < -32768 || xorigin > 32767 || yorigin < -32768 || yorigin > 32767) { throw new XException(S._("X_PointCoordRange")); } try { IntPtr display = Lock(); Xlib.XSetStipple(display, gc, stipple.GetPixmapHandle()); Xlib.XSetFillStyle (display, gc, (int)(Xsharp.FillStyle.FillOpaqueStippled)); Xlib.XSetTSOrigin(display, gc, xorigin, yorigin); this.stipple = stipple; tile = null; } finally { dpy.Unlock(); } }