The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Win32::GUI::DC - Work with a Window's DC (Drawing Context)

DESCRIPTION

[TBD]

METHODS

Common methods apply to most windows, controls and resources.

new

new(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");

See also the common options.

AbortPath

AbortPath()

Closes and discards any paths.

Arc

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

Draws a line segment and an arc. The line segment is drawn from the current position to the beginning of the arc. The arc is drawn along the perimeter of a circle with the given radius and center. The length of the arc is defined by the given start and sweep angles.

ArcDirection

ArcDirection([DIRECTION])

Gets or sets the drawing direction to be used for arc and rectangle functions.

ArcTo

ArcTo(LEFT, TOP, RIGHT, BOTTOM, XRADIALF, YRADIALF, XRADIALS, YRADIALS)

Draws an elliptical arc.

BackColor

BackColor([COLOR])

Gets or sets the background color.

BeginPath

BeginPath()

Opens a path bracket.

BitBlt

BitBlt(XD, YD, WD, HD, SOURCE, XS, YS, [ROP=SRCCOPY])

Performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.

BkMode

BkMode([MODE])

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

 1 TRANSPARENT
 2 OPAQUE

CancelDC

CancelDC()

Cancels any pending operation on the device context.

Chord

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

Draws a chord (a region bounded by the intersection of an ellipse and a line segment, called a "secant"). The chord is outlined by using the current pen and filled by using the current brush.

Circle

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

CloseFigure()

Closes an open figure in a path.

CreateCompatibleBitmap

CreateCompatibleBitmap(WIDTH, HEIGHT)

Creates a bitmap compatible with the device that is associated with the specified device context.

CreateCompatibleDC

CreateCompatibleDC()

Creates a memory device context (DC) compatible with the specified device.

CreateDC

CreateDC(DRIVER, DEVICE)

Used by new Win32::GUI::DC. Creates a device context (DC) for a device by using the specified name.

DeleteDC

DeleteDC(HANDLE)

Deletes the specified device context

DeleteObject

DeleteObject(OBJECT)

Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object.

DrawEdge

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

Draws one or more edges of rectangle

DrawFocusRect

DrawFocusRect(LEFT, TOP, RIGHT, BOTTOM)

Draws a rectangle in the style used to indicate that the rectangle has the focus.

DrawFrameControl

DrawFrameControl(LEFT, TOP, RIGHT, BOTTOM, TYPE, STATE)

Draws a frame control of the specified type and style.

If STATE includes DFCS_ADJUSTRECT, then the input parameters LEFT, TOP, RIGHT, BOTTOM are ajusted to exclude the surrounding edge of the push button. If any of LEFT, TOP, RIGHT, BOTTOM are readonly, then DFCS_ADJUSTRECT will be ignored for the readonly parameters.

DrawIcon

DrawIcon(Icon,X, Y)

The DrawIcon method draws an icon or cursor into the specified device context.

DrawText

DrawText(STRING, LEFT, TOP, RIGHT, BOTTOM, [FORMAT=DT_LEFT|DT_SINGLELINE|DT_TOP])

Draws formatted text in the specified rectangle. It formats the text according to the specified method.

Ellipse

Ellipse(LEFT, TOP, RIGHT, BOTTOM)

Draws an ellipse. The center of the ellipse is the center of the specified bounding rectangle. The ellipse is outlined by using the current pen and is filled by using the current brush.

EndPath

EndPath()

Closes a path bracket and selects the path defined by the bracket.

ExtFloodFill

ExtFloodFill(X, Y, COLOR, [TYPE=FLOODFILLSURFACE])

Fills an area of the display surface with the current brush.

Fill

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

Fills an area of the display surface.

FillPath

FillPath()

Closes any open figures in the current path and fills the path's interior by using the current brush and polygon-filling mode.

FillRect

FillRect(LEFT, TOP, RIGHT, BOTTOM, BRUSH)

Fills a rectangle by using the specified brush. This includes the left and top borders, but excludes the right and bottom borders of the rectangle.

FillRgn

FillRgn(Region,Brush)

The FillRgn function fills a region by using the specified brush.

FlattenPath

FlattenPath()

Transforms any curves in the path that is selected, turning each curve into a sequence of lines.

FloodFill

FloodFill(X, Y, COLOR)

Fills an area of the display surface with the current brush.

FrameRect

FrameRect(LEFT, TOP, RIGHT, BOTTOM, BRUSH)

Draws a border around the specified rectangle by using the specified brush. The width and height of the border are always one logical unit.

FrameRgn

FrameRgn(Region,Brush,Width,Height)

The FrameRgn function draws a border around the specified region by using the specified brush.

The Width Specifies the width of vertical brush strokes. The Height Specifies the height of horizontal brush strokes.

GetBrushOrgEx

GetBrushOrgEx(GetBrushOrgEx)

The GetBrushOrgEx method retrieves the current brush origin (x,y) for the specified device context.

GetCurrentObject

GetCurrentObject(HANDLE,OBJECTTYPE)

Obtains a handle to a device context's currently selected object of a specified type.

GetDC

GetDC(HANDLE)

Gets a handle to the DC associated with the given window (eg. gets an HDC from an HWND). Used by new Win32::GUI::DC

GetDeviceCaps

GetDeviceCaps(HANDLE,INDEX)

Retrieves device-specific information about a specified device.

GetMiterLimit

GetMiterLimit()

Returns the miter limit for the specified device context.

GetObjectType

GetObjectType(OBJECT)

Identifies the type of the specified object.

GetPixel

GetPixel(X, Y)

Returns the color of the pixel at X, Y.

GetStockObject

GetStockObject(TYPEOBJECT)

Identifies the type of the specified object.

GetTextExtentPoint

GetTextExtentPoint(STRING)

Computes the width and height of the specified string of text.

GetTextFace

GetTextFace()

Retrieves the typeface name of the font that is selected into the specified device context.

GetUpdateRect

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().

GradientFillRectangle

GradientFillRectangle(X0, Y0, COLOR0, X1, Y1, COLOR1, X2, Y2, COLOR2,DIRECTION)

Fills the area of the Rectangle using smooth shading from color0 to color1. As a default the smoothing will be horizontal, to specify vertical smoothing pass any value as the final parameter.

GradientFillTriangle

GradientFillTriangle(X0, Y0, COLOR0, X1, Y1, COLOR1, X2, Y2, COLOR2)

Fills the area of the triangle using smooth shading from color0 at point zero through to the other points.

InvertRect

InvertRect(LEFT, TOP, RIGHT, BOTTOM)

Inverts a rectangle in a window by performing a logical NOT operation on the color values for each pixel in the rectangle's interior.

InvertRgn

InvertRgn(Region)

The InvertRgn function inverts the colors in the specified region.

Line

Line(X,Y,X1,Y1)

A combination of MoveTo and LineTo

LineTo

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

MapMode([MODE])

[TBD]

MoveTo

MoveTo(X, Y)

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

PaintDesktop

PaintDesktop()

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

PaintRgn

PaintRgn(Region)

The PaintRgn function paints the specified region by using the brush currently selected into the device context.

PathToRegion

PathToRegion()

Creates a region from the path that is selected into the specified device context.

Pie

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

Draws a pie-shaped wedge bounded by the intersection of an ellipse and two radials. The pie is outlined by using the current pen and filled by using the current brush.

PolyBezier

PolyBezier(X1, Y1, X2, Y2, X3, Y3, X4, Y4, [ X, Y, ... ])

Draws one or more Bezier curves. The first curve is drawn from the first point to the fourth point by using the second and third points as control points. Each subsequent curve in the sequence needs exactly three more points: the ending point of the previous curve is used as the starting point, the next two points in the sequence are control points, and the third is the ending point.

PolyBezierTo

PolyBezierTo(X1, Y1, X2, Y2, X3, Y3, [ X, Y, ... ])

Draws cubic Bezier curves. The first curve is drawn from the current position to the third point by using the first two points as control points. For each subsequent curve, the function needs exactly three more points, and uses the ending point of the previous curve as the starting point for the next.

Polygon

Polygon(X1, Y1, X2, Y2, [ X, Y, ... ])

Draws a polygon consisting of two or more vertices connected by straight lines.

Polyline

Polyline(X1, Y1, X2, Y2, [ X, Y, ... ])

Draws one or more straight lines.

PolylineTo

PolylineTo(X1, Y1, [ X, Y, ... ])

Draws one or more straight lines.

Rectangle

Rectangle(LEFT, TOP, RIGHT, BOTTOM)

Draws a rectangle. The rectangle is outlined by using the current pen and filled by using the current brush.

ReleaseDC

ReleaseDC(HWND, HDC)

Releases a device context (DC), freeing it for use by other applications.

Restore

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().

RestoreDC

RestoreDC([STATE])

See Restore()

ROP2

ROP2([MODE])

Gets or sets the foreground mix mode of the specified device context. The mix mode specifies how the pen or interior color and the color already on the screen are combined to yield a new color.

RoundRect

RoundRect(LEFT, TOP, RIGHT, BOTTOM, WIDTH, HEIGHT)

Draws a rectangle with rounded corners. The rectangle is outlined by using the current pen and filled by using the current brush.

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().

SaveDC

SaveDC()

See Save()

SelectClipRgn

SelectClipRgn(Region)

This method selects a region as the current clipping region for the specified device context.

If no region is passed, then this method will remove a device-context's clipping region.

SelectObject

SelectObject(OBJECT)

Selects an object into the specified device context. The new object replaces the previous object of the same type.

SetBrushOrgEx

SetBrushOrgEx(X, Y)

The SetBrushOrgEx method sets the brush origin that GDI assigns to the next brush an application selects into the specified device context. Returns the (x,y) of the previous brush origin.

SetMiterLimit

SetMiterLimit(FLOAT)

Sets the limit for the length of miter joins

SetPixel

SetPixel(X, Y, [COLOR])

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

SetTextJustification

SetTextJustification(BREAKEXTRA, BREAKCOUNT)

Specifies the amount of space the system should add to the break characters in a string of text

StretchBlt

StretchBlt(XD, YD, WD, HD, SOURCE, XS, YS, WD, HD, [ROP=SRCCOPY])

Performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a rectangle of pixels in the destination device context, performing stretching a necessary.

StretchBltMode

StretchBltMode([MODE])

Get or Set bitmap stretching mode in the specified device context.

StrokeAndFillPath

StrokeAndFillPath()

Closes any open figures in a path, strokes the outline of the path by using the current pen, and fills its interior by using the current brush.

StrokePath

StrokePath()

Renders the specified path by using the current pen.

TextAlign

TextAlign([ALIGN])

Set or Get text-alignment setting for the specified device context.

TextCharacterExtra

TextCharacterExtra([CHAREXTRA])

Set or Get the intercharacter spacing.

TextColor

TextColor([COLOR])

Gets or sets the text color.

TextOut

TextOut(X, Y, TEXT)

Writes a character string at the specified location, using the currently selected font, background color, and text color.

Validate

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.

WidenPath

WidenPath()

Redefines the current path as the area that would be painted if the path were stroked using the pen currently selected into the given device context.

EVENTS

Common events apply to most windows and controls.

VERSION

Documentation for Win32::GUI v1.11 created 08 Nov 2014

This document is autogenerated by the build process. Edits made here will be lost. Edit docs/per_package.tpl instead.

SUPPORT

Homepage: http://perl-win32-gui.sourceforge.net/.

For further support join the users mailing list from the website at http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users. There is a searchable list archive at http://sourceforge.net/p/perl-win32-gui/mailman/perl-win32-gui-users/.

COPYRIGHT and LICENCE

Copyright (c) 1997..2014 Aldo Calpini. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.