The OpenD Programming Language

ScreenPainter

The 2D drawing proxy. You acquire one of these with SimpleWindow.draw rather than constructing it directly. Then, it is reference counted so you can pass it at around and when the last ref goes out of scope, the buffered drawing activities are all carried out.

More...
struct ScreenPainter {
CapableOfBeingDrawnUpon window;
arsd.color.Rectangle currentClipRectangle;
ScreenPainterImplementation* impl;
}

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

clear
void clear(Color color)
drawArc
void drawArc(Point upperLeft, int width, int height, int start, int length)

Draws an arc inside the bounding box given by upperLeft, width, and height, from the angle (start / 64) degrees for (length / 64) degrees of rotation.

drawCircle
void drawCircle(Point upperLeft, int diameter)

this function draws a circle with the drawEllipse() function above, it requires the upper left point and the radius

drawEllipse
void drawEllipse(Point upperLeft, Point lowerRight)

Arguments are the points of the bounding rectangle

drawImage
void drawImage(Point upperLeft, Image i, Point upperLeftOfImage, int w, int h)
drawLine
void drawLine(Point starting, Point ending)

Draws a pen using the current pen / outlineColor

drawPixel
void drawPixel(Point where)

Drawing an individual pixel is slow. Avoid it if possible.

drawPixmap
void drawPixmap(Sprite s, Point upperLeft, Point imageUpperLeft, Size sliceSize)

Draws a pixmap (represented by the Sprite class) on the drawable.

drawPolygon
void drawPolygon(Point[] vertexes)

.

drawPolygon
void drawPolygon(Point[] vertexes)

.

drawRectangle
void drawRectangle(Point upperLeft, int width, int height)
void drawRectangle(Point upperLeft, Size size)
void drawRectangle(Point upperLeft, Point lowerRightInclusive)
void drawRectangle(Rectangle rect)

Draws a rectangle using the current pen/outline color for the border and brush/fill color for the insides The outer lines, inclusive of x = 0, y = 0, x = width - 1, and y = height - 1 are drawn with the outlineColor The rest of the pixels are drawn with the fillColor. If fillColor is transparent, those pixels are not drawn.

drawRectangleRounded
void drawRectangleRounded(Rectangle rect, int borderRadius)
void drawRectangleRounded(Point upperLeft, Size size, int borderRadius)
void drawRectangleRounded(Point upperLeft, Point lowerRight, int borderRadius)

Draws a rectangle with rounded corners. It is outlined with the current foreground pen and filled with the current background brush.

drawText
void drawText(Point upperLeft, char[] text, Point lowerRight, uint alignment)

Draws a string in the window with the set font (see setFont to change it).

drawText
void drawText(DrawableFont font, Point upperLeft, char[] text)

Draws text using a custom font.

fontHeight
int fontHeight()
invalidateRect
void invalidateRect(Rectangle rect)

If you are using manual invalidations, this informs the window system that a section needs to be redrawn.

notifyCursorPosition
void notifyCursorPosition(int x, int y, int width, int height)

EXPERIMENTAL. subject to change.

scrollArea
void scrollArea(Point upperLeft, int width, int height, int dx, int dy)

Scrolls the contents in the bounding rectangle by dx, dy. Positive dx means scroll left (make space available at the right), positive dy means scroll up (make space available at the bottom)

setClipRectangle
arsd.color.Rectangle setClipRectangle(Point pt, int width, int height)
arsd.color.Rectangle setClipRectangle(arsd.color.Rectangle rect)

Sets the clipping region for drawing. If width == 0 && height == 0, disabled clipping.

setFont
void setFont(OperatingSystemFont font)
textSize
Size textSize(char[] text)

Properties

fillColor
Color fillColor [@property setter]
outlineColor
Color outlineColor [@property setter]
pen
Pen pen [@property setter]
rasterOp
RasterOp rasterOp [@property setter]

Detailed Description

Most functions use the outlineColor instead of taking a color themselves. ScreenPainter is reference counted and draws its buffer to the screen when its final reference goes out of scope.

Meta