def shapes(self): """Create a bunch of unsaved Shapes.""" rect = RectangleI() rect.x = rdouble(10) rect.y = rdouble(20) rect.width = rdouble(30) rect.height = rdouble(40) # Only save theT, not theZ rect.theT = rint(0) rect.textValue = rstring("test-Rectangle") rect.fillColor = rint(rgba_to_int(255, 255, 255, 255)) rect.strokeColor = rint(rgba_to_int(255, 255, 0, 255)) # ellipse without saving theZ & theT ellipse = EllipseI() ellipse.x = rdouble(33) ellipse.y = rdouble(44) ellipse.radiusX = rdouble(55) ellipse.radiusY = rdouble(66) ellipse.textValue = rstring("test-Ellipse") line = LineI() line.x1 = rdouble(200) line.x2 = rdouble(300) line.y1 = rdouble(400) line.y2 = rdouble(500) line.textValue = rstring("test-Line") point = PointI() point.x = rdouble(1) point.y = rdouble(1) point.theZ = rint(1) point.theT = rint(1) point.textValue = rstring("test-Point") polygon = PolygonI() polygon.theZ = rint(5) polygon.theT = rint(5) polygon.fillColor = rint(rgba_to_int(255, 0, 255, 50)) polygon.strokeColor = rint(rgba_to_int(255, 255, 0)) polygon.strokeWidth = LengthI(10, UnitsLength.PIXEL) points = "10,20, 50,150, 200,200, 250,75" polygon.points = rstring(points) mask = MaskI() mask.setTheC(rint(0)) mask.setTheZ(rint(0)) mask.setTheT(rint(0)) mask.setX(rdouble(100)) mask.setY(rdouble(100)) mask.setWidth(rdouble(500)) mask.setHeight(rdouble(500)) mask.setTextValue(rstring("test-Mask")) mask.setBytes(None) return [rect, ellipse, line, point, polygon, mask]
def ellipse(): o = EllipseI() populate_shape(o) if SCHEMA_VERSION == "2015-01": o.cx = rdouble(1.0) o.cy = rdouble(2.0) o.rx = rdouble(3.0) o.ry = rdouble(4.0) else: o.x = rdouble(1.0) o.y = rdouble(2.0) o.radiusX = rdouble(3.0) o.radiusY = rdouble(4.0) o.id = rlong(1L) return o
def ellipse(): o = EllipseI() populate_shape(o) if SCHEMA_VERSION == '2015-01': o.cx = rdouble(1.0) o.cy = rdouble(2.0) o.rx = rdouble(3.0) o.ry = rdouble(4.0) else: o.x = rdouble(1.0) o.y = rdouble(2.0) o.radiusX = rdouble(3.0) o.radiusY = rdouble(4.0) o.id = rlong(1L) return o
def shapes(self): """Create a bunch of unsaved Shapes.""" rect = RectangleI() rect.x = rdouble(10) rect.y = rdouble(20) rect.width = rdouble(30) rect.height = rdouble(40) rect.textValue = rstring("test-Rectangle") rect.fillColor = rint(rgba_to_int(255, 255, 255, 255)) rect.strokeColor = rint(rgba_to_int(255, 255, 0, 255)) ellipse = EllipseI() ellipse.x = rdouble(33) ellipse.y = rdouble(44) ellipse.radiusX = rdouble(55) ellipse.radiusY = rdouble(66) ellipse.textValue = rstring("test-Ellipse") line = LineI() line.x1 = rdouble(20) line.x2 = rdouble(30) line.y1 = rdouble(40) line.y2 = rdouble(50) line.textValue = rstring("test-Line") point = PointI() point.x = rdouble(50) point.y = rdouble(50) point.textValue = rstring("test-Point") polygon = PolygonI() polygon.fillColor = rint(rgba_to_int(255, 0, 255, 50)) polygon.strokeColor = rint(rgba_to_int(255, 255, 0)) polygon.strokeWidth = LengthI(10, UnitsLength.PIXEL) points = "10,20, 50,150, 100,100, 150,75" polygon.points = rstring(points) polyline = PolylineI() polyline.points = rstring(points) return [rect, ellipse, line, point, polygon, polyline]