OEImage

class OEImage : public OEImageBase

OEImage class is implemented as a display list i.e. a container of drawing commands. For example, when the OEImage.DrawLine method is called, rather than immediately drawing a line specified by the parameters, a line drawing operation is created that copies all parameters for later execution.

When the OEImage.Render method is invoked, the drawing commands stored in the OEImage object are executed in the same order in which they were issued.

The following methods are publicly inherited from OEImageBase:

Clear

DrawPie

DrawTriangle

DrawArc

DrawPoint

GetGlobalOffset

DrawCircle

DrawPolygon

GetHeight

DrawCubicBezier

DrawQuadraticBezier

GetMinFontSize

DrawLine

DrawRectangle

GetWidth

DrawPath

DrawText

GetSVGClass

GetSVGGroup

GetSVGGroups

NewSVGClass

NewSVGGroup

PopGroup

PushGroup

SetMinFontSize

Constructors

OEImage(width: float, height: float, bgColor: OEColor = OEWhite) -> OEImage

Default constructor that creates an OEImage with the specified width and height.

width, height

The dimensions of the image, both have to be positive (non-zero) numbers.

bgColor

The color that is used to clear the image upon construction.

The default background color is OEWhite.

A .png image with transparent background can be generated by passing the

OETransparentColor

as the background color.

OEImage(rhs: OEImage) -> OEImage

Copy constructor.

OEImage(rhs: OEImage, scale: float) -> OEImage

Copy constructor with scaling.

scale

The scaling factor is used to create a new image from the given one. The scaling factor has to be a positive (non-zero) number.

The following code snippet shows how to half and double the size of an image.

image = oedepict.OEImage(100.0, 100.0)

image.DrawCircle(oedepict.OEGetCenter(image), 40.0, oedepict.OEBlackPen)
image.DrawText(oedepict.OEGetCenter(image), "circle", oedepict.OEDefaultFont)
oedepict.OEDrawBorder(image, oedepict.OELightGreyPen)

oedepict.OEWriteImage("image.png", image)

halfimage = oedepict.OEImage(image, 0.5)
oedepict.OEWriteImage("halfimage.png", halfimage)

doubleimage = oedepict.OEImage(image, 2.0)
oedepict.OEWriteImage("doubleimage.png", doubleimage)
Examples of image scaling

original image

scale = 0.5

scale = 2.0

../../_images/image.png ../../_images/halfimage.png ../../_images/doubleimage.png

Clear

Clear(color: OEColor) -> None

Appends a clear command to the display list of the OEImage object.

See also

DrawArc

DrawArc(center: OE2DPoint, bgnAngle: float, endAngle: float,
        radius: float, pen: OEPen) -> None

Appends an arc drawing command to the display list of the OEImage object. See example in Figure: Example of drawing an arc.

../../_images/OEImageBase-DrawArc.png

Example of drawing an arc

See also

DrawCircle

DrawCircle(center: OE2DPoint, radius: float, pen: OEPen) -> None

Appends a circle drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a circle.

../../_images/OEImageBase-DrawCircle.png

Example of drawing a circle

See also

DrawCubicBezier

DrawCubicBezier(bgn: OE2DPoint, c1: OE2DPoint, c2: OE2DPoint,
                end: OE2DPoint, pen: OEPen) -> None

Appends a cubic Bézier curve drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a cubic Bezier curve.

../../_images/OEImageBase-DrawCubicBezier.png

Example of drawing a cubic Bezier curve

See also

DrawLine

DrawLine(bgn: OE2DPoint, end: OE2DPoint, pen: OEPen) -> None

Appends a line drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a line.

../../_images/OEImageBase-DrawLine.png

Example of drawing a line

See also

DrawPath

DrawPath(path: OE2DPath, pen: OEPen) -> None

Appends a path drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a path.

../../_images/OEImageBase-DrawPath.png

Example of drawing a path

See also

DrawPie

DrawPie(center: OE2DPoint, bgnAngle: float, endAngle: float,
        radius: float, pen: OEPen) -> None

Appends a pie drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a pie.

../../_images/OEImageBase-DrawPie.png

Example of drawing a pie

See also

DrawPoint

DrawPoint(p: OE2DPoint, color: OEColor) -> None

Appends a point drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a point.

../../_images/OEImageBase-DrawPoint.png

Example of drawing a point

See also

DrawPolygon

DrawPolygon(points: OE2DPointVector, pen: OEPen) -> None

Appends a polygon drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a polygon.

../../_images/OEImageBase-DrawPolygon.png

Example of drawing a polygon

See also

DrawQuadraticBezier

DrawQuadraticBezier(bgn: OE2DPoint, c1: OE2DPoint, end: OE2DPoint,
                    pen: OEPen) -> None

Appends a quadratic Bézier curve drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a quadratic Bezier curve.

../../_images/OEImageBase-DrawQuadraticBezier.png

Example of drawing a quadratic Bezier curve

See also

DrawRectangle

DrawRectangle(tl: OE2DPoint, br: OE2DPoint, pen: OEPen) -> None

Appends a polygon drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a rectangle.

../../_images/OEImageBase-DrawRectangle.png

Example of drawing a rectangle

See also

DrawText

DrawText(c: OE2DPoint, text: str, font: OEFont,
         maxwidth: float = 0.0) -> None

Appends a text drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a text.

../../_images/OEImageBase-DrawText.png

Example of drawing a text

See also

DrawTriangle

DrawTriangle(pA: OE2DPoint, pB: OE2DPoint, pC: OE2DPoint,
             pen: OEPen) -> None

Appends a triangle drawing command to the display list of the OEImage object. See example in Figure: Example of drawing a triangle.

../../_images/OEImageBase-DrawTriangle.png

Example of drawing a triangle

See also

GetHeight

GetHeight() -> float

Returns the height of the OEImage object.

GetWidth

GetWidth() -> float

Returns the width of the OEImage object.

IsEmpty

IsEmpty() -> bool

Returns whether or not the display list of the OEImage object is empty.

Render

Render(image: OEImageBase) -> bool

Renders the image stored in the OEImage object by executing the stored drawing commands in the order in which they were issued.