- Main Page
- Packages
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# smjg.libs.sdwf.dc.DC Class Reference

Base class of DC wrapper classes. More...

Inheritance diagram for smjg.libs.sdwf.dc.DC:

List of all members.

## Public Types
typedef textColour | textColor
## Public Member Functions
HDC | handle ()
| The Windows handle of this device context.
ROP2 | rop ()
| The binary raster operation used for drawing operations on this DC.
ROP2 | rop (ROP2 r)
| The binary raster operation used for drawing operations on this DC.
bool | transparent ()
| Whether text, brushes and pens will be transparent.
bool | transparent (bool b)
| Whether text, brushes and pens will be transparent.
Saving and Restoring DC States
int | save ()
| Saves the current DC state to a state stack maintained by Windows.
void | restore (int id=-1)
| Restores a saved DC state from the state stack.
GDI Object Selection
Font | font ()
| The font selected into the DC for text operations.
Font | font (Font f)
| The font selected into the DC for text operations.
Pen | pen ()
| The pen selected into the DC for drawing operations.
Pen | pen (Pen p)
| The pen selected into the DC for drawing operations.
Brush | brush ()
| The brush selected into the DC for filling operations.
Brush | brush (Brush b)
| The brush selected into the DC for filling operations.
deprecated void | select (Font f)
| Selects a font into the DC for text operations.
deprecated void | select (Pen p)
| Selects a pen into the DC for drawing operations.
deprecated void | select (Brush b)
| Selects a brush into the DC for filling operations.
Text Measurement and Output
RGBColour | textColour (RGBColour c)
| The colour of text output on this DC.
RGBColour | textColour ()
| The colour of text output on this DC.
TA | textAlign (TA a)
| The alignment of text output on this DC.
TA | textAlign ()
| The alignment of text output on this DC.
RectDim | textExtent (string text)
| Gives the dimensions of the rectangle bounding text, when output with the currently selected font.
void | textOut (int x, int y, string text)
| Outputs text using the font currently selected into the DC.
void | textOut (Point p, string text)
| Outputs text using the font currently selected into the DC.
Graphics: Pixels
void | setPixel (int x, int y, RGBColour colour)
| Sets the colour value of a pixel.
RGBColour | getPixel (int x, int y)
| Gets the colour value of a pixel.
Graphics: Lines and Curves
AD | arcDirection ()
| The direction in which arcs are drawn.
AD | arcDirection (AD dir)
| The direction in which arcs are drawn.
void | moveTo (int x, int y)
| Moves the current drawing position to the given coordinates.
void | moveTo (Point p)
| Moves the current drawing position to the given point.
void | lineTo (int x, int y)
| Draws a straight line from the current drawing position to the given coordinates, using the currently selected pen.
void | lineTo (Point p)
| Draws a straight line from the current drawing position to the given point, using the currently selected pen.
void | arc (int left, int top, int right, int bottom, int x1, int y1, int x2, int y2)
| Draws an arc of an ellipse.
void | arc (Rect r, Point radial1, Point radial2)
| Draws an arc of an ellipse.
void | lineAngleArc (int x, int y, uint radius, float startAngle, float sweepAngle)
| Draws a line segment followed by a circular arc specified by an angle.
void | lineAngleArc (Point centre, uint radius, float startAngle, float sweepAngle)
| Draws a line segment followed by a circular arc specified by an angle.
void | polyline (Point[] p...)
| Draws a continuous sequence of lines.
void | polylineTo (Point[] p...)
| Draws a continuous sequence of lines, starting from the current drawing position.
void | bezier (Point[] p...)
| Draws a Bezier curve of one or more segments.
void | bezier (Point start, BezierSegment[] segments...)
| Draws a Bezier curve of one or more segments.
void | bezierTo (Point[] p...)
| Draws a Bezier curve of one or more segments, starting from the current drawing position.
void | bezierTo (BezierSegment[] segments...)
| Draws a Bezier curve of one or more segments, starting from the current drawing position.
Graphics: Filled Shapes
POLYGON_FILL | polygonFillMode ()
| The method used for filling polygons.
POLYGON_FILL | polygonFillMode (POLYGON_FILL mode)
| The method used for filling polygons.
void | ellipse (int left, int top, int right, int bottom)
| Draws an ellipse.
void | ellipse (Rect r)
| Draws an ellipse.
void | segment (int left, int top, int right, int bottom, int x1, int y1, int x2, int y2)
| Draws a segment (chord slice) of an ellipse.
void | segment (Rect r, Point radial1, Point radial2)
| Draws a segment (chord slice) of an ellipse.
void | sector (int left, int top, int right, int bottom, int x1, int y1, int x2, int y2)
| Draws a sector (pie slice) of an ellipse.
void | sector (Rect r, Point radial1, Point radial2)
| Draws a sector (pie slice) of an ellipse.
void | rectangle (int left, int top, int right, int bottom)
| Draws a rectangle.
void | rectangle (Point topLeft, Point bottomRight)
| Draws a rectangle.
void | rectangle (Point topLeft, RectDim dim)
| Draws a rectangle.
void | rectangle (Rect r)
| Draws a rectangle.
void | rectangle (int left, int top, int right, int bottom, Brush b)
| Fills an unoutlined rectangle using the specified brush.
void | rectangle (Rect r, Brush b)
| Fills an unoutlined rectangle using the specified brush.
void | frameRect (int left, int top, int right, int bottom, Brush b)
| Draws a one-logical-unit border around a rectangle, using the specified brush.
void | frameRect (Rect r, Brush b)
| Draws a one-logical-unit border around a rectangle, using the specified brush.
void | roundRect (int left, int top, int right, int bottom, int roundWidth, int roundHeight)
| Draws a rounded rectangle.
void | roundRect (Rect r, RectDim round)
| Draws a rounded rectangle.
void | invertRect (int left, int top, int right, int bottom)
| Inverts the colours in a rectangle.
void | invertRect (Point topLeft, Point bottomRight)
| Inverts the colours in a rectangle.
void | invertRect (Rect r)
| Inverts the colours in a rectangle.
void | polygon (Point[] p...)
| Draws a polygon.
Bitmap Transfer
void | bitBlt (int toLeft, int toTop, int width, int height, DC fromDC, int fromLeft, int fromTop, uint rop=SRCCOPY)
| Copies a rectangle of bitmap data from another DC to this one.
void | bitBlt (Rect to, DC fromDC, Point fromTopLeft, uint rop=SRCCOPY)
| Copies a rectangle of bitmap data from another DC to this one.
void | bitBlt (Point toTopLeft, DC fromDC, Rect from, uint rop=SRCCOPY)
| Copies a rectangle of bitmap data from another DC to this one.
void | bitBlt (Point toTopLeft, MemoryDC fromDC, uint rop=SRCCOPY)
| Copies the entire bitmap held on a MemoryDC to this DC.
void | bitBlt (Point toTopLeft, Bitmap bmp, uint rop=SRCCOPY)
| Copies an entire bitmap to this DC.
void | stretchBlt (int toLeft, int toTop, int toWidth, int toHeight, DC fromDC, int fromLeft, int fromTop, int fromWidth, int fromHeight, uint rop=SRCCOPY)
| Transfers a scaled copy of bitmap data from another DC into this one.
void | stretchBlt (Rect to, DC fromDC, Rect from, uint rop=SRCCOPY)
| Transfers a scaled copy of bitmap data from another DC into this one.
void | stretchBlt (Rect to, MemoryDC fromDC, uint rop=SRCCOPY)
| Transfers a scaled copy of the entire bitmap held on a MemoryDC into this DC.
void | stretchBlt (Rect to, Bitmap bmp, uint rop=SRCCOPY)
| Transfers a scaled copy of an entire bitmap onto this DC.
Coordinate System Definition and Transformation
MM | mappingMode ()
| The coordinate mapping mode used for drawing operations on this DC.
MM | mappingMode (MM mode)
| The coordinate mapping mode used for drawing operations on this DC.
void | setScale (Rect device, Rect logical)
| Sets up a logical coordinate system.
void | toLogicalCoords (inout int x, inout int y)
| Transforms the given coordinates from the device coordinate system to the logical coordinate system.
void | toLogicalCoords (inout Point p)
| Transforms the given coordinates from the device coordinate system to the logical coordinate system.
void | toLogicalCoords (Point[] p)
| Transforms the given coordinates from the device coordinate system to the logical coordinate system.
void | toLogicalCoords (inout Rect r)
| Transforms the given coordinates from the device coordinate system to the logical coordinate system.
void | toLogicalCoords (Rect[] r)
| Transforms the given coordinates from the device coordinate system to the logical coordinate system.
void | toDeviceCoords (inout int x, inout int y)
| Transforms the given coordinates from the logical coordinate system to the device coordinate system.
void | toDeviceCoords (inout Point p)
| Transforms the given coordinates from the logical coordinate system to the device coordinate system.
void | toDeviceCoords (Point[] p)
| Transforms the given coordinates from the logical coordinate system to the device coordinate system.
void | toDeviceCoords (inout Rect r)
| Transforms the given coordinates from the logical coordinate system to the device coordinate system.
void | toDeviceCoords (Rect[] r)
| Transforms the given coordinates from the logical coordinate system to the device coordinate system.
Device Information
int | deviceCapability (DEVICE_CAP index)
| Gets the device capability information with the specified index.
DT | deviceType ()
| The type of device.
RectDim | mmSize ()
| The dimensions of the device's usable area millimetres.
RectDim | pixelSize ()
| The dimensions of the device's usable area in device units.
Rect | area ()
| A rectangle representing the device's usable area, in device units.
RectDim | dotsPerInch ()
| The resolution in device units per inch.
int | bitsPerPixelPerPlane ()
| The number of bits per pixel in each 'plane'.
int | planes ()
| The number of 'planes' in the device's memory mapping.
int | bitsPerPixel ()
| The total number of bits in memory for each pixel.
int | paletteSize ()
| The number of entries in the device's palette.
int | colourResolution ()
| The overall colour resolution of the device.
Operators
final int | opEquals (Object o)
final int | opEquals (DC a)
## Protected Member Functions
| this (HDC dc, DCState ss)
## Protected Attributes
DCState | state

## Detailed Description

Base class of DC wrapper classes.

DC is the abstract base class from which the device context wrapper classes are derived.

DC objects in SDWF enforce RAII, ensuring that DCs are promptly released when they go out of scope. Each DC subclass defined within SDWF has the necessary destructor to dispose of the underlying device context.

## Member Typedef Documentation

typedef textColour smjg.libs.sdwf.dc.DC.textColor

## Constructor & Destructor Documentation

smjg.libs.sdwf.dc.DC.this | ( | HDC | dc,
|  | DCState | ss |
| ) |  |  | `[protected]`

## Member Function Documentation

HDC smjg.libs.sdwf.dc.DC.handle | ( |  | ) |

The Windows handle of this device context.

int smjg.libs.sdwf.dc.DC.save | ( |  | ) |

Saves the current DC state to a state stack maintained by Windows.

The DC class also maintains a stack of GDI objects selected into the DC at the time, so that they are not adversely garbage-collected.

Returns:
  an ID number that can be passed to the DC.restore method.

void smjg.libs.sdwf.dc.DC.restore | ( | int | id = `-1` | ) |

Restores a saved DC state from the state stack.

If a state other than the most recently saved one is selected, then it is reached by popping and discarding states from the stack until the requested state is reached.

Parameters:

  | id | the negative of the number of states to pop off the stack, or an ID number returned by save.

ROP2 smjg.libs.sdwf.dc.DC.rop | ( |  | ) |

The binary raster operation used for drawing operations on this DC.

Since:
  0.5

Status:
  test

ROP2 smjg.libs.sdwf.dc.DC.rop | ( | ROP2 | r | ) |

The binary raster operation used for drawing operations on this DC.

Since:
  0.5

Status:
  done

bool smjg.libs.sdwf.dc.DC.transparent | ( |  | ) |

Whether text, brushes and pens will be transparent.

Since:
  0.5

bool smjg.libs.sdwf.dc.DC.transparent | ( | bool | b | ) |

Whether text, brushes and pens will be transparent.

Since:
  0.5

Status:
  done

Font smjg.libs.sdwf.dc.DC.font | ( |  | ) |

The font selected into the DC for text operations.

Since:
  0.5

Status:
  test

Font smjg.libs.sdwf.dc.DC.font | ( | Font | f | ) |

The font selected into the DC for text operations.

Since:
  0.5

Status:
  done

Pen smjg.libs.sdwf.dc.DC.pen | ( |  | ) |

The pen selected into the DC for drawing operations.

Since:
  0.5

Status:
  test

Pen smjg.libs.sdwf.dc.DC.pen | ( | Pen | p | ) |

The pen selected into the DC for drawing operations.

Since:
  0.5

Status:
  done

Brush smjg.libs.sdwf.dc.DC.brush | ( |  | ) |

The brush selected into the DC for filling operations.

Since:
  0.5

Status:
  test

Brush smjg.libs.sdwf.dc.DC.brush | ( | Brush | b | ) |

The brush selected into the DC for filling operations.

Since:
  0.5

Status:
  test

deprecated void smjg.libs.sdwf.dc.DC.select | ( | Font | f | ) |

Selects a font into the DC for text operations.

Parameters:

  | f | the font to select.

Deprecated:
  Superseded by DC.font.

deprecated void smjg.libs.sdwf.dc.DC.select | ( | Pen | p | ) |

Selects a pen into the DC for drawing operations.

Parameters:

  | p | the pen to select.

Deprecated:
  Superseded by DC.pen.

deprecated void smjg.libs.sdwf.dc.DC.select | ( | Brush | b | ) |

Selects a brush into the DC for filling operations.

Parameters:

  | b | the brush to select.

Deprecated:
  Superseded by DC.brush.

RGBColour smjg.libs.sdwf.dc.DC.textColour | ( | RGBColour | c | ) |

The colour of text output on this DC.

RGBColour smjg.libs.sdwf.dc.DC.textColour | ( |  | ) |

The colour of text output on this DC.

TA smjg.libs.sdwf.dc.DC.textAlign | ( | TA | a | ) |

The alignment of text output on this DC.

Since:
  0.51

TA smjg.libs.sdwf.dc.DC.textAlign | ( |  | ) |

The alignment of text output on this DC.

Since:
  0.51

RectDim smjg.libs.sdwf.dc.DC.textExtent | ( | string | text | ) |

Gives the dimensions of the rectangle bounding text, when output with the currently selected font.

Parameters:

  | text | text to measure.

Returns:
  the dimensions of the bounding rectangle.

void smjg.libs.sdwf.dc.DC.textOut | ( | int | x,
|  | int | y,
|  | string | text |
| ) |  |  |

Outputs text using the font currently selected into the DC.

Parameters:

  | x | x-coordinate at which to output text.
  | y | y-coordinate at which to output text.
  | text | the text to output.

void smjg.libs.sdwf.dc.DC.textOut | ( | Point | p,
|  | string | text |
| ) |  |  |

Outputs text using the font currently selected into the DC.

Parameters:

  | p | point at which to output text.
  | text | the text to output.

void smjg.libs.sdwf.dc.DC.setPixel | ( | int | x,
|  | int | y,
|  | RGBColour | colour |
| ) |  |  |

Sets the colour value of a pixel.

Parameters:

  | x | x-coordinate of the pixel to set.
  | y | y-coordinate of the pixel to set.
  | colour | the pixel's new colour value.

Since:
  0.57

Status:
  done

RGBColour smjg.libs.sdwf.dc.DC.getPixel | ( | int | x,
|  | int | y |
| ) |  |  |

Gets the colour value of a pixel.

Parameters:

  | x | x-coordinate of the pixel to set.
  | y | y-coordinate of the pixel to set.

Returns:
  the pixel's colour value.

Since:
  0.57

Status:
  test

AD smjg.libs.sdwf.dc.DC.arcDirection | ( |  | ) |

The direction in which arcs are drawn.

Since:
  0.3

Status:
  test

AD smjg.libs.sdwf.dc.DC.arcDirection | ( | AD | dir | ) |

The direction in which arcs are drawn.

Since:
  0.3

Status:
  test

void smjg.libs.sdwf.dc.DC.moveTo | ( | int | x,
|  | int | y |
| ) |  |  |

Moves the current drawing position to the given coordinates.

void smjg.libs.sdwf.dc.DC.moveTo | ( | Point | p | ) |

Moves the current drawing position to the given point.

void smjg.libs.sdwf.dc.DC.lineTo | ( | int | x,
|  | int | y |
| ) |  |  |

Draws a straight line from the current drawing position to the given coordinates, using the currently selected pen.

Updates the current drawing position to these coordinates.

void smjg.libs.sdwf.dc.DC.lineTo | ( | Point | p | ) |

Draws a straight line from the current drawing position to the given point, using the currently selected pen.

Updates the current drawing position to this point.

void smjg.libs.sdwf.dc.DC.arc | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom,
|  | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2 |
| ) |  |  |

Draws an arc of an ellipse.

Parameters:

  | left | x-coordinate of left edge of ellipse's bounding rectangle.
  | top | y-coordinate of top edge of ellipse's bounding rectangle.
  | right | x-coordinate of right edge of ellipse's bounding rectangle.
  | bottom | y-coordinate of bottom edge of ellipse's bounding rectangle.
  | x1 | x-coordinate of endpoint of first radial line bounding the arc.
  | y1 | y-coordinate of endpoint of first radial line bounding the arc.
  | x2 | x-coordinate of endpoint of second radial line bounding the arc.
  | y2 | y-coordinate of endpoint of second radial line bounding the arc.

void smjg.libs.sdwf.dc.DC.arc | ( | Rect | r,
|  | Point | radial1,
|  | Point | radial2 |
| ) |  |  |

Draws an arc of an ellipse.

Parameters:

  | r | ellipse's bounding rectangle.
  | radial1 | endpoint of first radial line bounding the arc.
  | radial2 | endpoint of second radial line bounding the arc.

void smjg.libs.sdwf.dc.DC.lineAngleArc | ( | int | x,
|  | int | y,
|  | uint | radius,
|  | float | startAngle,
|  | float | sweepAngle |
| ) |  |  |

Draws a line segment followed by a circular arc specified by an angle.

The line segment is drawn from the current drawing position to the beginning of the arc. (Don't ask me why - eccentricity in Windows API.) The end of the arc becomes the new current drawing position.

Parameters:

  | x | x-coordinate of centre of circle of which the arc is to be drawn.
  | y | y-coordinate of centre of circle of which the arc is to be drawn.
  | radius | radius of circle of which arc is to be drawn.
  | startAngle | angle at which to start the arc, measured anti-clockwise from the x-axis.
  | sweepAngle | angle swept by the arc, measured anti-clockwise from `startAngle`.

Since:
  0.3

Status:
  test

void smjg.libs.sdwf.dc.DC.lineAngleArc | ( | Point | centre,
|  | uint | radius,
|  | float | startAngle,
|  | float | sweepAngle |
| ) |  |  |

Draws a line segment followed by a circular arc specified by an angle.

The line segment is drawn from the current drawing position to the beginning of the arc. (Don't ask me why - eccentricity in Windows API.) The end of the arc becomes the new current drawing position.

Parameters:

  | centre | centre of circle of which the arc is to be drawn.
  | radius | radius of circle of which the arc is to be drawn.
  | startAngle | angle at which to start the arc, measured anti-clockwise from the x-axis.
  | sweepAngle | angle swept by the arc, measured anti-clockwise from `startAngle`.

Since:
  0.3

Status:
  test

void smjg.libs.sdwf.dc.DC.polyline | ( | Point[] | p... | ) |

Draws a continuous sequence of lines.

This method doesn't touch the current drawing position.

Parameters:

  | p | array of points to connect in sequential order.

void smjg.libs.sdwf.dc.DC.polylineTo | ( | Point[] | p... | ) |

Draws a continuous sequence of lines, starting from the current drawing position.

The final point in the sequence becomes the new current drawing position.

Parameters:

  | p | array of points to connect in sequential order.

void smjg.libs.sdwf.dc.DC.bezier | ( | Point[] | p... | ) |

Draws a Bezier curve of one or more segments.

This method doesn't touch the current drawing position.

Parameters:

  | p | array of points defining the curve. The first point is the curve's start position. Subsequent points are three for each curve segment: the first control point, the second control point and then the endpoint.

Precondition:
  The length of `p` must be one more than a multiple of three.

Since:
  0.51

Status:
  done

void smjg.libs.sdwf.dc.DC.bezier | ( | Point | start,
|  | BezierSegment[] | segments... |
| ) |  |  |

Draws a Bezier curve of one or more segments.

This method doesn't touch the current drawing position.

Parameters:

  | start | the start point of the curve.
  | segments | array of curve segments.

Since:
  0.51

Status:
  test

void smjg.libs.sdwf.dc.DC.bezierTo | ( | Point[] | p... | ) |

Draws a Bezier curve of one or more segments, starting from the current drawing position.

The endpoint of the final segment becomes the new current drawing position.

Parameters:

  | p | array of points defining the curve. Three points are required for each curve segment: the first control point, the second control point and then the endpoint.

Precondition:
  The length of `must` be a multiple of 3 greater than or equal to 4.

Since:
  0.51

Status:
  test

void smjg.libs.sdwf.dc.DC.bezierTo | ( | BezierSegment[] | segments... | ) |

Draws a Bezier curve of one or more segments, starting from the current drawing position.

The endpoint of the final segment becomes the new current drawing position.

Parameters:

  | segments | array of curve segments.

Since:
  0.51

Status:
  test

POLYGON_FILL smjg.libs.sdwf.dc.DC.polygonFillMode | ( |  | ) |

The method used for filling polygons.

Since:
  0.3

Status:
  test

POLYGON_FILL smjg.libs.sdwf.dc.DC.polygonFillMode | ( | POLYGON_FILL | mode | ) |

The method used for filling polygons.

Since:
  0.3

Status:
  test

void smjg.libs.sdwf.dc.DC.ellipse | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom |
| ) |  |  |

Draws an ellipse.

The ellipse is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | left | x-coordinate of left edge of ellipse's bounding rectangle.
  | top | y-coordinate of top edge of ellipse's bounding rectangle.
  | right | x-coordinate of right edge of ellipse's bounding rectangle.
  | bottom | y-coordinate of bottom edge of ellipse's bounding rectangle.

void smjg.libs.sdwf.dc.DC.ellipse | ( | Rect | r | ) |

Draws an ellipse.

The ellipse is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | r | ellipse's bounding rectangle.

void smjg.libs.sdwf.dc.DC.segment | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom,
|  | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2 |
| ) |  |  |

Draws a segment (chord slice) of an ellipse.

The segment is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | left | x-coordinate of left edge of ellipse's bounding rectangle.
  | top | y-coordinate of top edge of ellipse's bounding rectangle.
  | right | x-coordinate of right edge of ellipse's bounding rectangle.
  | bottom | y-coordinate of bottom edge of ellipse's bounding rectangle.
  | x1 | x-coordinate of endpoint of first radial line bounding the arc defining the segment.
  | y1 | y-coordinate of endpoint of first radial line bounding the arc defining the segment.
  | x2 | x-coordinate of endpoint of second radial line bounding the arc defining the segment.
  | y2 | y-coordinate of endpoint of second radial line bounding the arc defining the segment.

void smjg.libs.sdwf.dc.DC.segment | ( | Rect | r,
|  | Point | radial1,
|  | Point | radial2 |
| ) |  |  |

Draws a segment (chord slice) of an ellipse.

The segment is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | r | ellipse's bounding rectangle.
  | radial1 | endpoint of first radial line bounding the arc defining the segment.
  | radial2 | endpoint of second radial line bounding the arc defining the segment.

void smjg.libs.sdwf.dc.DC.sector | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom,
|  | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2 |
| ) |  |  |

Draws a sector (pie slice) of an ellipse.

The sector is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | left | x-coordinate of left edge of ellipse's bounding rectangle.
  | top | y-coordinate of top edge of ellipse's bounding rectangle.
  | right | x-coordinate of right edge of ellipse's bounding rectangle.
  | bottom | y-coordinate of bottom edge of ellipse's bounding rectangle.
  | x1 | x-coordinate of endpoint of first radial line bounding the sector.
  | y1 | y-coordinate of endpoint of first radial line bounding the sector.
  | x2 | x-coordinate of endpoint of second radial line bounding the sector.
  | y2 | y-coordinate of endpoint of second radial line bounding the sector.

void smjg.libs.sdwf.dc.DC.sector | ( | Rect | r,
|  | Point | radial1,
|  | Point | radial2 |
| ) |  |  |

Draws a sector (pie slice) of an ellipse.

The sector is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | r | ellipse's bounding rectangle.
  | radial1 | endpoint of first radial line bounding the sector.
  | radial2 | endpoint of second radial line bounding the sector.

void smjg.libs.sdwf.dc.DC.rectangle | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom |
| ) |  |  |

Draws a rectangle.

The rectangle is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | left | x-coordinate of left edge of the rectangle.
  | top | y-coordinate of top edge of the rectangle.
  | right | x-coordinate of right edge of the rectangle.
  | bottom | y-coordinate of bottom edge of the rectangle.

void smjg.libs.sdwf.dc.DC.rectangle | ( | Point | topLeft,
|  | Point | bottomRight |
| ) |  |  |

Draws a rectangle.

The rectangle is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | topLeft | top-left corner.
  | bottomRight | bottom-right corner.

Since:
  0.5

Status:
  test

void smjg.libs.sdwf.dc.DC.rectangle | ( | Point | topLeft,
|  | RectDim | dim |
| ) |  |  |

Draws a rectangle.

The rectangle is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | topLeft | top-left corner.
  | dim | dimensions of rectangle.

Since:
  0.5

Status:
  test

void smjg.libs.sdwf.dc.DC.rectangle | ( | Rect | r | ) |

Draws a rectangle.

The rectangle is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | r | rectangle to draw.

void smjg.libs.sdwf.dc.DC.rectangle | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom,
|  | Brush | b |
| ) |  |  |

Fills an unoutlined rectangle using the specified brush.

Parameters:

  | left | x-coordinate of left edge of the rectangle.
  | top | y-coordinate of top edge of the rectangle.
  | right | x-coordinate of right edge of the rectangle.
  | bottom | y-coordinate of bottom edge of the rectangle.
  | b | brush with which to fill.

Status:
  done

void smjg.libs.sdwf.dc.DC.rectangle | ( | Rect | r,
|  | Brush | b |
| ) |  |  |

Fills an unoutlined rectangle using the specified brush.

Parameters:

  | r | rectangle to draw.
  | b | brush with which to fill.

void smjg.libs.sdwf.dc.DC.frameRect | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom,
|  | Brush | b |
| ) |  |  |

Draws a one-logical-unit border around a rectangle, using the specified brush.

Parameters:

  | left | x-coordinate of left edge of the rectangle.
  | top | y-coordinate of top edge of the rectangle.
  | right | x-coordinate of right edge of the rectangle.
  | bottom | y-coordinate of bottom edge of the rectangle.
  | b | brush with which to draw the border.

void smjg.libs.sdwf.dc.DC.frameRect | ( | Rect | r,
|  | Brush | b |
| ) |  |  |

Draws a one-logical-unit border around a rectangle, using the specified brush.

Parameters:

  | r | rectangle to frame.
  | b | brush with which to draw the border.

void smjg.libs.sdwf.dc.DC.roundRect | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom,
|  | int | roundWidth,
|  | int | roundHeight |
| ) |  |  |

Draws a rounded rectangle.

The rounded rectangle is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | left | x-coordinate of left edge of the rectangle.
  | top | y-coordinate of top edge of the rectangle.
  | right | x-coordinate of right edge of the rectangle.
  | bottom | y-coordinate of bottom edge of the rectangle.
  | roundWidth | width of rounding ellipse.
  | roundHeight | height of rounding ellipse.

Status:
  test

void smjg.libs.sdwf.dc.DC.roundRect | ( | Rect | r,
|  | RectDim | round |
| ) |  |  |

Draws a rounded rectangle.

The rounded rectangle is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | r | rectangle to draw.
  | round | dimensions of rounding ellipse.

Status:
  test

void smjg.libs.sdwf.dc.DC.invertRect | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom |
| ) |  |  |

Inverts the colours in a rectangle.

Parameters:

  | left | x-coordinate of left edge of the rectangle.
  | top | y-coordinate of top edge of the rectangle.
  | right | x-coordinate of right edge of the rectangle.
  | bottom | y-coordinate of bottom edge of the rectangle.

void smjg.libs.sdwf.dc.DC.invertRect | ( | Point | topLeft,
|  | Point | bottomRight |
| ) |  |  |

Inverts the colours in a rectangle.

Parameters:

  | topLeft | top-left corner.
  | bottomRight | bottom-right corner.

Since:
  0.57

void smjg.libs.sdwf.dc.DC.invertRect | ( | Rect | r | ) |

Inverts the colours in a rectangle.

Parameters:

  | r | rectangle to invert.

void smjg.libs.sdwf.dc.DC.polygon | ( | Point[] | p... | ) |

Draws a polygon.

The polygon is outlined with the currently selected pen, and filled with the currently selected brush.

Parameters:

  | p | array of vertices of the polygon in sequential order.

void smjg.libs.sdwf.dc.DC.bitBlt | ( | int | toLeft,
|  | int | toTop,
|  | int | width,
|  | int | height,
|  | DC | fromDC,
|  | int | fromLeft,
|  | int | fromTop,
|  | uint | rop = `SRCCOPY` |
| ) |  |  |

Copies a rectangle of bitmap data from another DC to this one.

Parameters:

  | toLeft | x-coordinate of the left edge of the destination rectangle on this DC.
  | toTop | y-coordinate of the top edge of the destination rectangle on this DC.
  | width | width of the rectangle to transfer.
  | height | height of the rectangle to transfer.
  | fromDC | DC from which data is to be transferred.
  | fromLeft | x-coordinate of the left edge of the source rectangle on `fromDC`.
  | fromTop | y-coordinate of the top edge of the source rectangle on `fromDC`.
  | rop | raster operation value, as defined in the Windows API.

void smjg.libs.sdwf.dc.DC.bitBlt | ( | Rect | to,
|  | DC | fromDC,
|  | Point | fromTopLeft,
|  | uint | rop = `SRCCOPY` |
| ) |  |  |

Copies a rectangle of bitmap data from another DC to this one.

Parameters:

  | to | destination rectangle on this DC.
  | fromDC | DC from which data is to be transferred.
  | fromTopLeft | top-left corner of source rectangle on `fromDC`.
  | rop | raster operation value, as defined in the Windows API.

void smjg.libs.sdwf.dc.DC.bitBlt | ( | Point | toTopLeft,
|  | DC | fromDC,
|  | Rect | from,
|  | uint | rop = `SRCCOPY` |
| ) |  |  |

Copies a rectangle of bitmap data from another DC to this one.

Parameters:

  | toTopLeft | top-left corner of destination rectangle on this DC.
  | fromDC | DC from which data is to be transferred.
  | from | source rectangle on `fromDC`.
  | rop | raster operation value, as defined in the Windows API.

void smjg.libs.sdwf.dc.DC.bitBlt | ( | Point | toTopLeft,
|  | MemoryDC | fromDC,
|  | uint | rop = `SRCCOPY` |
| ) |  |  |

Copies the entire bitmap held on a MemoryDC to this DC.

Parameters:

  | toTopLeft | top-left corner of destination rectangle on this DC.
  | fromDC | DC from which data is to be transferred.
  | rop | raster operation value, as defined in the Windows API.

void smjg.libs.sdwf.dc.DC.bitBlt | ( | Point | toTopLeft,
|  | Bitmap | bmp,
|  | uint | rop = `SRCCOPY` |
| ) |  |  |

Copies an entire bitmap to this DC.

Parameters:

  | toTopLeft | top-left corner of destination rectangle on this DC.
  | bmp | bitmap to be transferred.
  | rop | raster operation value, as defined in the Windows API.

Note:
  This method works by creating a temporary MemoryDC. If you wish to transfer multiple bitmaps in succession, it is more efficient to create a single MemoryDC and select the bitmaps into it one after the other.

void smjg.libs.sdwf.dc.DC.stretchBlt | ( | int | toLeft,
|  | int | toTop,
|  | int | toWidth,
|  | int | toHeight,
|  | DC | fromDC,
|  | int | fromLeft,
|  | int | fromTop,
|  | int | fromWidth,
|  | int | fromHeight,
|  | uint | rop = `SRCCOPY` |
| ) |  |  |

Transfers a scaled copy of bitmap data from another DC into this one.

Parameters:

  | toLeft | x-coordinate of the left edge of the destination rectangle on this DC.
  | toTop | y-coordinate of the top edge of the destination rectangle on this DC.
  | toWidth | width of the destination rectangle on this DC.
  | toHeight | height of the destination rectangle on this DC.
  | fromDC | DC from which data is to be transferred.
  | fromLeft | x-coordinate of the left edge of the source rectangle on `fromDC`.
  | fromTop | y-coordinate of the top edge of the source rectangle on `fromDC`.
  | fromWidth | width of the source rectangle on `fromDC`.
  | fromHeight | height of the source rectangle on `fromDC`.
  | rop | raster operation value, as defined in the Windows API.

void smjg.libs.sdwf.dc.DC.stretchBlt | ( | Rect | to,
|  | DC | fromDC,
|  | Rect | from,
|  | uint | rop = `SRCCOPY` |
| ) |  |  |

Transfers a scaled copy of bitmap data from another DC into this one.

Parameters:

  | to | destination rectangle on this DC.
  | fromDC | DC from which data is to be transferred.
  | from | source rectangle on `fromDC`.
  | rop | raster operation value, as defined in the Windows API.

void smjg.libs.sdwf.dc.DC.stretchBlt | ( | Rect | to,
|  | MemoryDC | fromDC,
|  | uint | rop = `SRCCOPY` |
| ) |  |  |

Transfers a scaled copy of the entire bitmap held on a MemoryDC into this DC.

Parameters:

  | to | destination rectangle on this DC.
  | fromDC | DC from which data is to be transferred.
  | rop | raster operation value, as defined in the Windows API.

void smjg.libs.sdwf.dc.DC.stretchBlt | ( | Rect | to,
|  | Bitmap | bmp,
|  | uint | rop = `SRCCOPY` |
| ) |  |  |

Transfers a scaled copy of an entire bitmap onto this DC.

Parameters:

  | to | destination rectangle on this DC.
  | bmp | bitmap to be transferred.
  | rop | raster operation value, as defined in the Windows API.

MM smjg.libs.sdwf.dc.DC.mappingMode | ( |  | ) |

The coordinate mapping mode used for drawing operations on this DC.

MM smjg.libs.sdwf.dc.DC.mappingMode | ( | MM | mode | ) |

The coordinate mapping mode used for drawing operations on this DC.

void smjg.libs.sdwf.dc.DC.setScale | ( | Rect | device,
|  | Rect | logical |
| ) |  |  |

Sets up a logical coordinate system.

Precondition:
  DC.mappingMode must be either MM.ANISOTROPIC or MM.ISOTROPIC. The `logical` rectangle must be of non-zero area.

Parameters:

  | device | a rectangle in device coordinates. To set a coordinate range to cover an entire window's client area, use Window.clientArea.
  | logical | a rectangle in logical coordinates to map to `device`.

Note:
  If the mapping mode is MM.ISOTROPIC, then `logical` will map to the largest possible rectangle with the correct proportions centred within `device`.

void smjg.libs.sdwf.dc.DC.toLogicalCoords | ( | inout int | x,
|  | inout int | y |
| ) |  |  |

Transforms the given coordinates from the device coordinate system to the logical coordinate system.

Parameters:

  | x | the device x-coordinate, which will be replaced by the logical x-coordinate.
  | y | the device y-coordinate, which will be replaced by the logical y-coordinate.

void smjg.libs.sdwf.dc.DC.toLogicalCoords | ( | inout Point | p | ) |

Transforms the given coordinates from the device coordinate system to the logical coordinate system.

Parameters:

  | p | point in device coordinates, which will be replaced by logical coordinates.

void smjg.libs.sdwf.dc.DC.toLogicalCoords | ( | Point[] | p | ) |

Transforms the given coordinates from the device coordinate system to the logical coordinate system.

Parameters:

  | p | array of points in device coordinates, which will be replaced by logical coordinates.

void smjg.libs.sdwf.dc.DC.toLogicalCoords | ( | inout Rect | r | ) |

Transforms the given coordinates from the device coordinate system to the logical coordinate system.

Parameters:

  | r | rectangle in device coordinates, which will be replaced by logical coordinates.

void smjg.libs.sdwf.dc.DC.toLogicalCoords | ( | Rect[] | r | ) |

Transforms the given coordinates from the device coordinate system to the logical coordinate system.

Parameters:

  | r | array of rectangles in device coordinates, which will be replaced by logical coordinates.

Since:
  0.3

Status:
  test

void smjg.libs.sdwf.dc.DC.toDeviceCoords | ( | inout int | x,
|  | inout int | y |
| ) |  |  |

Transforms the given coordinates from the logical coordinate system to the device coordinate system.

Parameters:

  | x | the logical x-coordinate, which will be replaced by the device x-coordinate.
  | y | the logical y-coordinate, which will be replaced by the device y-coordinate.

void smjg.libs.sdwf.dc.DC.toDeviceCoords | ( | inout Point | p | ) |

Transforms the given coordinates from the logical coordinate system to the device coordinate system.

Parameters:

  | p | point in logical coordinates, which will be replaced by device coordinates.

void smjg.libs.sdwf.dc.DC.toDeviceCoords | ( | Point[] | p | ) |

Transforms the given coordinates from the logical coordinate system to the device coordinate system.

Parameters:

  | p | array of points in logical coordinates, which will be replaced by device coordinates.

void smjg.libs.sdwf.dc.DC.toDeviceCoords | ( | inout Rect | r | ) |

Transforms the given coordinates from the logical coordinate system to the device coordinate system.

Parameters:

  | r | rectangle in logical coordinates, which will be replaced by device coordinates.

void smjg.libs.sdwf.dc.DC.toDeviceCoords | ( | Rect[] | r | ) |

Transforms the given coordinates from the logical coordinate system to the device coordinate system.

Parameters:

  | r | array of rectangles in logical coordinates, which will be replaced by device coordinates.

Since:
  0.3

Status:
  test

int smjg.libs.sdwf.dc.DC.deviceCapability | ( | DEVICE_CAP | index | ) |

Gets the device capability information with the specified index.

Parameters:

  | index | identifies information to query.

Returns:
  the requested information, as specified by the Windows API function GetDeviceCaps.

Since:
  0.4

Status:
  done

DT smjg.libs.sdwf.dc.DC.deviceType | ( |  | ) |

The type of device.

Returns:
  constant identifying the device type. For memory DCs, the returned value gives the type of device with which it was created to be compatible.

Since:
  0.4

Status:
  done

RectDim smjg.libs.sdwf.dc.DC.mmSize | ( |  | ) |

The dimensions of the device's usable area millimetres.

For a PrintDC, this is the size of the printable area of the page. For a display DC, this is the size of the screen. The reported size is not related to the physical size of the screen, but to a logical millimetre determined by the system font scale.

Returns:
  the dimensions of the device's usable area, in logical millimetres.

Since:
  0.4

Status:
  done

RectDim smjg.libs.sdwf.dc.DC.pixelSize | ( |  | ) |

The dimensions of the device's usable area in device units.

For a PrintDC, this is the size of the printable area of the page. For a display DC, this is the size of the screen.

Returns:
  the dimensions of the device's usable area, in device units.

Since:
  0.4

Status:
  done

Rect smjg.libs.sdwf.dc.DC.area | ( |  | ) |

A rectangle representing the device's usable area, in device units.

For a PrintDC, this is the size of the printable area of the page. For a display DC, this is the size of the screen.

Returns:
  a rectangle of the device's usable area, with the left and top values set to zero.

Since:
  0.4

Status:
  done

RectDim smjg.libs.sdwf.dc.DC.dotsPerInch | ( |  | ) |

The resolution in device units per inch.

For a display DC, the reported resolution is not related to the physical size of the screen, but to a logical inch determined by the system font scale.

Returns:
  the dimensions in device units of a square with a side length of a logical square inch.

Since:
  0.4

Status:
  done

int smjg.libs.sdwf.dc.DC.bitsPerPixelPerPlane | ( |  | ) |

The number of bits per pixel in each 'plane'.

Since:
  0.4

Status:
  done

int smjg.libs.sdwf.dc.DC.planes | ( |  | ) |

The number of 'planes' in the device's memory mapping.

Planes are disjoint regions of memory that each map to the whole device area, but influence different aspects of each pixel. For example, on some devices the red, green and blue components of a colour are separate planes.

Since:
  0.4

Status:
  done

int smjg.libs.sdwf.dc.DC.bitsPerPixel | ( |  | ) |

The total number of bits in memory for each pixel.

This is equal to `bitsPerPixelPerPlane * planes`.

Since:
  0.4

Status:
  done

int smjg.libs.sdwf.dc.DC.paletteSize | ( |  | ) |

The number of entries in the device's palette.

Returns:
  the number of entries in the device's palette, or `-1` for a non-palette device.

Since:
  0.4

Status:
  done

int smjg.libs.sdwf.dc.DC.colourResolution | ( |  | ) |

The overall colour resolution of the device.

This is the number of bits in the device's colour space, from which palette colours may be picked in the case of a palette device.

Returns:
  the number of bits in the device's colour space. For a non-palette device, this is equivalent to DC.bitsPerPixel.

Since:
  0.4

Status:
  done

final int smjg.libs.sdwf.dc.DC.opEquals | ( | Object | o | ) |

Determines whether this DC is equal to another object.

Since:
  0.4

final int smjg.libs.sdwf.dc.DC.opEquals | ( | DC | a | ) |

Determines whether this DC is equal to another DC. Two DC objects are equal iff they have the same handle, i.e. they interface the same device context. (Is that possible?)

Since:
  0.4

## Member Data Documentation

DCState smjg.libs.sdwf.dc.DC.state`[protected]`

The documentation for this class was generated from the following file:

- dc.d