Example #1
0
func Ellipse(x, y, a, b int, n, f bool) {
	//
	x0, y0 := C.int(x-a), C.int(y-b)
	if f {
		if !n {
			C.XSetFunction(display, graphicsContext, C.GXinvert)
		} // C.GXcopyInverted ?
		if !xxb {
			C.XFillArc(display, C.Drawable(window), graphicsContext, C.int(x0), C.int(y0), C.uint(2*a), C.uint(2*b), 0, 64*360)
		}
		C.XFillArc(display, C.Drawable(pixmap), graphicsContext, C.int(x0), C.int(y0), C.uint(2*a), C.uint(2*b), 0, 64*360)
	} else {
		if !n {
			C.XSetFunction(display, graphicsContext, C.GXinvert)
		}
		if !xxb {
			C.XDrawArc(display, C.Drawable(window), graphicsContext, C.int(x0), C.int(y0), C.uint(2*a), C.uint(2*b), 0, 64*360)
		}
		C.XDrawArc(display, C.Drawable(pixmap), graphicsContext, C.int(x0), C.int(y0), C.uint(2*a), C.uint(2*b), 0, 64*360)
	}
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXcopy)
	}
	C.XFlush(display)
}
Example #2
0
func Invert(x, y, x1, y1 uint) {
	//
	if x > x1 || y > y1 {
	} // desaster
	C.XSetFunction(display, graphicsContext, C.GXinvert)
	if !xxb {
		C.XFillRectangle(display, C.Drawable(window), graphicsContext, C.int(x), C.int(y), C.uint(x1-x+1), C.uint(y1-y+1))
	}
	C.XFillRectangle(display, C.Drawable(pixmap), graphicsContext, C.int(x), C.int(y), C.uint(x1-x+1), C.uint(y1-y+1))
	C.XSetFunction(display, graphicsContext, C.GXcopy)
	C.XFlush(display)
}
Example #3
0
func Line(x, y, x1, y1 int, n bool) {
	//
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXinvert)
	}
	if !xxb {
		C.XDrawLine(display, C.Drawable(window), graphicsContext, C.int(x), C.int(y), C.int(x1), C.int(y1))
	}
	C.XDrawLine(display, C.Drawable(pixmap), graphicsContext, C.int(x), C.int(y), C.int(x1), C.int(y1))
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXcopy)
	}
	C.XFlush(display)
}
Example #4
0
func Point(x, y int, n bool) {
	//
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXinvert)
	}
	if !xxb {
		C.XDrawPoint(display, C.Drawable(window), graphicsContext, C.int(x), C.int(y))
	}
	C.XDrawPoint(display, C.Drawable(pixmap), graphicsContext, C.int(x), C.int(y))
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXcopy)
	}
	C.XFlush(display)
}
Example #5
0
func PolygonFull(X, Y []int, n bool) {
	//
	l := len(X)
	if len(Y) != l {
		return
	}
	p := make([]C.XPoint, l)
	for i := 0; i < l; i++ {
		p[i].x, p[i].y = C.short(X[i]), C.short(Y[i])
	}
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXcopyInverted)
	}
	if !xxb {
		C.XFillPolygon(display, C.Drawable(window), graphicsContext, &p[0], C.int(l), C.Convex, C.CoordModeOrigin)
	}
	C.XFillPolygon(display, C.Drawable(pixmap), graphicsContext, &p[0], C.int(l), C.Convex, C.CoordModeOrigin)
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXcopy)
	}
	C.XFlush(display)
}
Example #6
0
func Segments(X, Y, X1, Y1 []int, n bool) {
	//
	l := len(X)
	if len(Y) != l {
		return
	}
	s := make([]C.XSegment, l)
	for i := 0; i < l; i++ {
		s[i].x1, s[i].y1, s[i].x2, s[i].y2 = C.short(X[i]), C.short(Y[i]), C.short(X1[i]), C.short(Y1[i])
	}
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXinvert)
	}
	if !xxb {
		C.XDrawSegments(display, C.Drawable(window), graphicsContext, &s[0], C.int(l))
	}
	C.XDrawSegments(display, C.Drawable(pixmap), graphicsContext, &s[0], C.int(l))
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXcopy)
	}
	C.XFlush(display)
}
Example #7
0
func Rectangle(x, y, w, h int, n, f bool) {
	//
	if f {
		if !n {
			C.XSetFunction(display, graphicsContext, C.GXinvert)
		} // C.GXcopyInverted ?
		if !xxb {
			C.XFillRectangle(display, C.Drawable(window), graphicsContext, C.int(x), C.int(y), C.uint(w), C.uint(h))
		}
		C.XFillRectangle(display, C.Drawable(pixmap), graphicsContext, C.int(x), C.int(y), C.uint(w), C.uint(h))
	} else {
		if !n {
			C.XSetFunction(display, graphicsContext, C.GXinvert)
		}
		if !xxb {
			C.XDrawRectangle(display, C.Drawable(window), graphicsContext, C.int(x), C.int(y), C.uint(w), C.uint(h))
		}
		C.XDrawRectangle(display, C.Drawable(pixmap), graphicsContext, C.int(x), C.int(y), C.uint(w), C.uint(h))
	}
	if !n {
		C.XSetFunction(display, graphicsContext, C.GXcopy)
	}
	C.XFlush(display)
}
Example #8
0
func WriteInvert(s string, x, y int, t bool) {
	//
	C.XSetFunction(display, graphicsContext, C.GXinvert)
	Write(s, x, y, t)
	C.XSetFunction(display, graphicsContext, C.GXcopy)
}