Exemple #1
0
func (f *Imp) Invert() {
	//
	if f.Empty() {
		return
	}
	switch f.sort {
	case Pointset:
		scr.PointsetInv(f.x, f.y)
	case Segments:
		scr.SegmentsInv(f.x, f.y)
	case Polygon:
		if f.filled {
			scr.PolygonInv /* TODO Full */ (f.x, f.y)
		} else {
			scr.PolygonInv(f.x, f.y)
		}
	case Curve:
		scr.CurveInv(f.x, f.y)
		if f.filled {
			n := len(f.x) - 1
			scr.CircleInv(f.x[n], f.y[n], 4)
		}
	case InfLine:
		scr.InfLineInv(f.x[0], f.y[0], f.x[1], f.y[1])
	case Rectangle:
		if f.filled {
			scr.RectangleFullInv(f.x[0], f.y[0], f.x[1], f.y[1])
		} else {
			scr.RectangleInv(f.x[0], f.y[0], f.x[1], f.y[1])
		}
	case Circle:
		if f.filled {
			scr.CircleFullInv(f.x[0], f.y[0], uint(f.x[1]))
		} else {
			scr.CircleInv(f.x[0], f.y[0], uint(f.x[1]))
		}
	case Ellipse:
		if f.filled {
			scr.EllipseFullInv(f.x[0], f.y[0], uint(f.x[1]), uint(f.y[1]))
		} else {
			scr.EllipseInv(f.x[0], f.y[0], uint(f.x[1]), uint(f.y[1]))
		}
	case Text:
		// >>>  sollte in bx integriert werden:
		//  bx.WriteInvGr (tx, x[0], y[0])
		scr.SwitchTransparence(true)
		scr.WriteInvGr(f.tx, f.x[0], f.y[0])
	case Image:
		scr.RectangleInv(f.x[0], f.y[0], f.x[1], f.y[1])
	}
}
Exemple #2
0
func (f *Imp) invert1() {
	//
	switch f.sort {
	case InfLine:
		scr.InfLineInv(f.x[0], f.y[0], f.x[1], f.y[1])
	case Rectangle:
		scr.RectangleInv(f.x[0], f.y[0], f.x[1], f.y[1])
	default:
		scr.EllipseInv(f.x[0], f.y[0], uint(f.x[1]), uint(f.y[1]))
	}
}
Exemple #3
0
func paint(f figure, fo format, x0, y0, x, y int) {
	//
	var a, b uint
	if x >= x0 {
		a = uint(x - x0)
	} else {
		a = uint(x0 - x)
	}
	if y >= y0 {
		b = uint(y - y0)
	} else {
		b = uint(y0 - y)
	}
	switch f {
	case line:
		switch fo {
		case border:
			scr.Line(x0, y0, x, y)
		case inv:
			scr.LineInv(x0, y0, x, y)
		case full:
			// scr.StrichAusgeben (x0, y0, x, y, Staerke)
		}
	case rectangle:
		switch fo {
		case border:
			scr.Rectangle(x0, y0, x, y)
		case inv:
			scr.RectangleInv(x0, y0, x, y)
		case full:
			scr.RectangleFull(x0, y0, x, y)
		}
	case circle:
		if b > a {
			a = b
		}
		switch fo {
		case border:
			scr.Circle(x0, y0, a)
		case inv:
			scr.CircleInv(x0, y0, a)
		case full:
			scr.CircleFull(x0, y0, a)
		}
	case ellipse:
		switch fo {
		case border:
			/*
			     scr.Ellipse ((x0 + x) / 2, (y0 + y) / 2, a, b)
			   case invers:
			     scr.EllipseInv ((x0 + x) / 2, (y + y0) / 2, a, b)
			   case full:
			     scr.EllipseFull ((x0 + x) / 2, (y0 + y) / 2, a, b)
			*/
			scr.Ellipse(x0, y0, a, b)
		case inv:
			scr.EllipseInv(x0, y0, a, b)
		case full:
			scr.EllipseFull(x0, y0, a, b)
		}
	}
	//  scr.Colour (paintColour), (* Wörkeraund: Bildschirm....Invertieren f *)
}