## Package Win32::GUI::DC

Back to the Packages

- Constructor

  - new Win32::GUI::DC(WINDOW | DRIVER, DEVICE)

- Methods

  - AbortPath()

  - Arc(X, Y, RADIUS, START, SWEEP)

  - BackColor([COLOR])

  - BeginPath()

  - BkMode([MODE])

  - Circle(X, Y, (WIDTH, HEIGHT | RADIUS))

  - CloseFigure()

  - DrawEdge(LEFT, TOP, RIGHT, BOTTOM, [EDGE, FLAGS])

  - Ellipse(LEFT, TOP, RIGHT, BOTTOM)

  - EndPath()

  - Fill(X, Y, [COLOR], [TYPE])

  - FillPath()

  - GetPixel(X, Y)

  - GetUpdateRect([ERASE])

  - InvertRect(LEFT, TOP, RIGHT, BOTTOM)

  - LineTo(X, Y)

  - MapMode([MODE])

  - MoveTo(X, Y)

  - PaintDesktop()

  - Pie(LEFT, TOP, RIGHT, BOTTOM, XF, YF, XS, YS)

  - Rectangle(LEFT, TOP, RIGHT, BOTTOM)

  - Restore([STATE])

  - Save()

  - SelectObject(OBJECT)

  - SetPixel(X, Y, [COLOR])

  - StrokeAndFillPath()

  - StrokePath()

  - TextColor([COLOR])

  - TextOut(X, Y, TEXT)

  - Validate()

### Constructor

new Win32::GUI::DC(WINDOW | DRIVER, DEVICE)

  Creates a new DC object; the first form (WINDOW is a Win32::GUI object) gets the DC for the specified window (can also be called as WINDOW->GetDC). The second form creates a DC for the specified DEVICE; actually, the only supported DRIVER is the display driver (eg. the screen). To get the DC for the entire screen use:

          $Screen = new Win32::GUI::DC("DISPLAY");

### Methods

AbortPath()

  [TBD]

Arc(X, Y, RADIUS, START, SWEEP)

  [TBD]

BackColor([COLOR])

  Gets or sets the background color.

BeginPath()

  [TBD]

BkMode([MODE])

  Gets or sets the current background mix mode for the DC; possible values are:

       1 TRANSPARENT
       2 OPAQUE

Circle(X, Y, (WIDTH, HEIGHT | RADIUS))

  Draws a circle or an ellipse; X, Y, RADIUS specifies the center point and the radius of the circle, while X, Y, WIDTH, HEIGHT specifies the center point and the size of the ellipse. Returns nonzero if succesful, zero on errors.

CloseFigure()

  [TBD]

DrawEdge(LEFT, TOP, RIGHT, BOTTOM, [EDGE, FLAGS])

  [TBD]

Ellipse(LEFT, TOP, RIGHT, BOTTOM)

  [TBD]

EndPath()

  [TBD]

Fill(X, Y, [COLOR], [TYPE])

  [TBD]

FillPath()

  [TBD]

GetPixel(X, Y)

  Returns the color of the pixel at X, Y.

GetUpdateRect([ERASE])

  Returns the rectangle (as a four-element array containing left, top, right, bottom coordinates) that needs to be updated. If the update region is empty (eg. no need to update, the function returns undef). The optional ERASE parameter can be set to 1 to force an erase of the update region, if there is any; by default, no erase action is performed. This function is intended to be used in a Paint event; see Win32::GUI::Graphic::Paint().

InvertRect(LEFT, TOP, RIGHT, BOTTOM)

  Inverts the content of the rectangle from LEFT, TOP to RIGHT, BOTTOM. Returns nonzero if succesful, zero on errors.

LineTo(X, Y)

  Draws a line from the current drawing position up to, but not including, the point specified by X, Y. Returns nonzero if succesful, zero on errors.

MapMode([MODE])

  [TBD]

MoveTo(X, Y)

  Moves the current drawing position to the point specified by X, Y. Returns nonzero if succesful, zero on errors.

PaintDesktop()

  Fills the DC content with the desktop pattern or wallpaper. Returns nonzero if succesful, zero on errors.

Pie(LEFT, TOP, RIGHT, BOTTOM, XF, YF, XS, YS)

  [TBD]

Rectangle(LEFT, TOP, RIGHT, BOTTOM)

  Draws a rectangle from LEFT, TOP to RIGHT, BOTTOM; the rectangle is outlined with the current pen and filled with the current brush. Returns nonzero if succesful, zero on errors.

Restore([STATE])

  Restores the state of the DC saved by `Save().` STATE can identify a state from the saved stack (use the identifier returned by the corresponding `Save()` call) or a negative number that specifies how many steps backwards in the stack to recall (eg. -1 recalls the last saved state). The default if STATE is not specified is -1. Note that the restored state is removed from the stack, and if you restore an early one, all the subsequent states will be removed too. Returns nonzero if succesful, zero on errors. See also Save().

Save()

  Saves the current state of the DC (this means the currently selected colors, brushes, pens, drawing modes, etc.) to an internal stack. The function returns a number identifying the saved state; this number can then be passed to the `Restore()` function to load it back. If the return value is zero, an error occurred. See also Restore().

SelectObject(OBJECT)

  [TBD]

SetPixel(X, Y, [COLOR])

  Sets the pixel at X, Y to the specified COLOR (or to the current `TextColor()` if COLOR is not specified).

StrokeAndFillPath()

  [TBD]

StrokePath()

  [TBD]

TextColor([COLOR])

  Gets or sets the text color.

TextOut(X, Y, TEXT)

  Draws the specified TEXT string at X, Y, using the currently selected font. Returns nonzero if succesful, zero on errors.

Validate()

  Validates (removes from the update region) the whole DC area. This function is intended to be used in a Paint event; see Win32::GUI::Graphic::Paint(). Returns nonzero if succesful, zero on errors.