示例#1
0
        private void FillEllipseXLib(Color color, int x, int y, int width, int height)
        {
            var gcValues = new XGCValues();

            gcValues.foreground = ToPArgb(color);

            var gcValueMask = XGCValueMask.GCForeground;

            var gc = LibX11.XCreateGC(display, drawableId, gcValueMask, ref gcValues);

            try
            {
                if (clipRectangles != null)
                {
                    LibX11.XSetClipRectangles(display, gc, 0, 0, clipRectangles, clipRectangles.Length, 0);
                }

                LibX11.XDrawArc(display, drawableId, gc, x, y, (uint)width - 1, (uint)height - 1, 0, 360 * 64);
                LibX11.XFillArc(display, drawableId, gc, x, y, (uint)width - 1, (uint)height - 1, 0, 360 * 64);
            }
            finally
            {
                LibX11.XFreeGC(display, gc);
            }
        }
示例#2
0
        private void DrawPathWithXLibDirectly(Color color, int width, Point[] points)
        {
            var gcValues = new XGCValues();

            gcValues.cap_style  = X11CapStyle.CapRound;
            gcValues.join_style = X11JoinStyle.JoinRound;
            gcValues.foreground = ToPArgb(color);
            gcValues.line_width = width;

            var gcValueMask = XGCValueMask.GCCapStyle | XGCValueMask.GCForeground | XGCValueMask.GCJoinStyle | XGCValueMask.GCLineWidth;

            var gc = LibX11.XCreateGC(display, drawableId, gcValueMask, ref gcValues);

            try
            {
                if (clipRectangles != null)
                {
                    LibX11.XSetClipRectangles(display, gc, 0, 0, clipRectangles, clipRectangles.Length, 0);
                }

                XPoint[] xPoints = new XPoint[points.Length];
                for (int i = 0; i < points.Length; i++)
                {
                    var point = points[i];
                    xPoints[i] = new XPoint(point.X, point.Y);
                }

                LibX11.XDrawLines(display, drawableId, gc, xPoints, xPoints.Length, X11CoordinateMode.CoordModeOrigin);
            }
            finally
            {
                LibX11.XFreeGC(display, gc);
            }
        }