wxDC(3)
wxDC π β¨
okay bestie, welcome to wxDC(3) β this is the Erlang Module Definition for wxDC, and no cap, it's a big one. Buckle up, we're doing this in parts π
πΈ NAME πΈ
wxDC β a wxDC is a "device context" onto which graphics and text can be drawn. ποΈβ¨
π DESCRIPTION π
It's literally meant to represent different output devices and it offers a common abstract API for drawing on any of them. One API, many canvases, we love a flexible queen π
wxWidgets also offers an alternative drawing API based on the modern drawing backends GDI+, CoreGraphics, Cairo and Direct2D. See wxGraphicsContext, wxGraphicsRenderer and related classes. There's also a wxGCDC linking the APIs by offering the wxDC API on top of a wxGraphicsContext. Iconic crossover event fr π«Ά
β οΈ wxDC is an abstract base class and cannot be created directly. Periodt.
So which ones can you actually use? Use wxPaintDC, wxClientDC, wxWindowDC, wxScreenDC, wxMemoryDC or wxPrinterDC (not implemented in wx).
Also bestie, notice this: device contexts which are associated with windows (i.e. wxClientDC, wxWindowDC and wxPaintDC) use the window font and colours by default (starting with wxWidgets 2.9.0) but the other device context classes use system-default values β so you always must set the appropriate fonts and colours before using them. No skipping that step, it's giving undefined-vibes otherwise π
In addition to the versions of the methods documented below, there are also versions which accept single {X,Y} parameter instead of the two wxCoord ones or {X,Y} and {Width,Height} instead of the four wxCoord parameters. Convenience overloads, slay π
Beginning with wxWidgets 2.9.0 the entire wxDC code has been reorganized. All platform dependent code (actually all drawing code) has been moved into backend classes which derive from a common wxDCImpl class. The user-visible classes such as wxClientDC and wxPaintDC merely forward all calls to the backend implementation. Middle management for graphics, lowkey iconic π§
π Device and logical units π
In the wxDC context there is a distinction between logical units and device units.
Device units are the units native to the particular device; e.g. for a screen, a device unit is a pixel. For a printer, the device unit is defined by the resolution of the printer (usually given in DPI: dot-per-inch).
All wxDC functions use instead logical units, unless where explicitly stated. Logical units are arbitrary units mapped to device units using the current mapping mode (see setMapMode/2).
This mechanism allows reusing the same code which prints on e.g. a window on the screen to print on e.g. a paper. Write once, print anywhere, main character energy π
β¨ Support for Transparency / Alpha Channel β¨
In general wxDC methods don't support alpha transparency and the alpha component of wx_color() is simply ignored β and you need to use wxGraphicsContext for full transparency support. π
There are, however, a few exceptions, and they ate:
- First, under macOS and GTK+ 3 colours with alpha channel are supported in all the normal wxDC-derived classes as they use
wxGraphicsContextinternally. - Second, under all platforms
wxSVGFileDC(not implemented in wx) also fully supports alpha channel.
In both of these cases the instances of wxPen or wxBrush that are built from wx_color() use the colour's alpha values when stroking or filling. π¨
π¦ Support for Transformation Matrix π¦
On some platforms (currently under MSW, GTK+ 3, macOS) wxDC has support for applying an arbitrary affine transformation matrix to its coordinate system (since 3.1.1 this feature is also supported by wxGCDC in all ports). Call CanUseTransformMatrix() (not implemented in wx) to check if this support is available and then call SetTransformMatrix() (not implemented in wx) if it is. If the transformation matrix is not supported, SetTransformMatrix() (not implemented in wx) always simply returns false and doesn't do anything. A polite no, we respect it π
This feature is only available when wxUSE_DC_TRANSFORM_MATRIX build option is enabled.
See:
- Overview dc
wxGraphicsContext
wxWidgets docs: wxDC
π DATA TYPES π
wxDC() :: wx:wx_object().
π FUNCTIONS π
blit(This, Dest, Size, Source, Src, [Option]) -> boolean()
when
This :: wxDC(),
Dest :: {X :: integer(), Y :: integer()},
Size :: {W :: integer(), H :: integer()},
Source :: wxDC(),
Src :: {X :: integer(), Y :: integer()},
Option ::
{rop, wx:wx_enum()} |
{useMask, boolean()} |
{srcPtMask, {X :: integer(), Y :: integer()}}.
Copy from a source DC to this DC. A whole glow-up transplant, we love to see it β¨
With this method you can specify the destination coordinates and the size of area to copy which will be the same for both the source and target DCs. If you need to apply scaling while copying, use StretchBlit() (not implemented in wx). No stretching here bestie, that's a different function π
Notice that source DC coordinates xsrc and ysrc are interpreted using the current source DC coordinate system, i.e. the scale, origin position and axis directions are taken into account when transforming them to physical (pixel) coordinates.
Remark: There is partial support forblit/6inwxPostScriptDC, under X.
See:
wxMemoryDCwxBitmapwxMask
calcBoundingBox(This, X, Y) -> ok
when
This :: wxDC(),
X :: integer(),
Y :: integer().
Adds the specified point to the bounding box which can be retrieved with minX/1, maxX/1 and minY/1, maxY/1 functions.
See: resetBoundingBox/1
clear(This) -> ok
when This :: wxDC().
Clears the device context using the current background brush. Fresh start, clean slate, reset era πΈ
Note that setBackground/2 method must be used to set the brush used by clear/1, the brush used for filling the shapes set by setBrush/2 is ignored by it. Yes really, they're different brushes, don't @ me π
If no background brush was set, solid white brush is used to clear the device context.
crossHair(This, Pt) -> ok
when
This :: wxDC(),
Pt :: {X :: integer(), Y :: integer()}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
destroyClippingRegion(This) -> ok
when This :: wxDC().
Destroys the current clipping region so that none of the DC is clipped. Free the pixels, unleash the art π¦
See: setClippingRegion/3
deviceToLogicalX(This, X) -> integer()
when This :: wxDC(), X :: integer().
Convert device X coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation.
deviceToLogicalXRel(This, X) -> integer()
when This :: wxDC(), X :: integer().
Convert device X coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation.
Use this for converting a width, for example. Widths don't care about which way the axes point, iykyk π
deviceToLogicalY(This, Y) -> integer()
when This :: wxDC(), Y :: integer().
Converts device Y coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation.
deviceToLogicalYRel(This, Y) -> integer()
when This :: wxDC(), Y :: integer().
Convert device Y coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation.
Use this for converting a height, for example. Same energy as the X one, just vertical π«Ά
drawArc(This, PtStart, PtEnd, Centre) -> ok
when
This :: wxDC(),
PtStart :: {X :: integer(), Y :: integer()},
PtEnd :: {X :: integer(), Y :: integer()},
Centre :: {X :: integer(), Y :: integer()}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
drawBitmap(This, Bmp, Pt, [Option]) -> ok
when
This :: wxDC(),
Bmp :: wxBitmap:wxBitmap(),
Pt :: {X :: integer(), Y :: integer()},
Option :: {useMask, boolean()}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
drawCheckMark(This, Rect) -> ok
when
This :: wxDC(),
Rect ::
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
drawCircle(This, Pt, Radius) -> ok
when
This :: wxDC(),
Pt :: {X :: integer(), Y :: integer()},
Radius :: integer().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
drawEllipse(This, Rect) -> ok
when
This :: wxDC(),
Rect ::
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
drawEllipse(This, Pt, Size) -> ok
when
This :: wxDC(),
Pt :: {X :: integer(), Y :: integer()},
Size :: {W :: integer(), H :: integer()}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
drawEllipticArc(This, Pt, Sz, Sa, Ea) -> ok
when
This :: wxDC(),
Pt :: {X :: integer(), Y :: integer()},
Sz :: {W :: integer(), H :: integer()},
Sa :: number(),
Ea :: number().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
okay that's part 1 bestie, and there's so much more coming π stay tuned β¨
drawIcon
drawIcon(This, Icon, Pt) -> ok
when
This :: wxDC(),
Icon :: wxIcon:wxIcon(),
Pt :: {X :: integer(), Y :: integer()}.
okay so this is an overloaded member function, bestie β provided for convenience, and the only thing it changes is which arguments it accepts compared to the one above. that's it. that's the tea. π«
drawLabel
drawLabel(This, Text, Rect, [Option]) -> ok
when
This :: wxDC(),
Text :: unicode:chardata(),
Rect ::
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()},
Option ::
{alignment, integer()} |
{indexAccel, integer()}.
overloaded member function moment π provided for convenience, differs from the above function only in what argument(s) it accepts.
drawLine
drawLine(This, Pt1, Pt2) -> ok
when
This :: wxDC(),
Pt1 :: {X :: integer(), Y :: integer()},
Pt2 :: {X :: integer(), Y :: integer()}.
another overloaded member function, provided for convenience β differs from the above function only in what argument(s) it accepts. we love a consistent icon. β¨
drawLines
drawLines(This, Points, [Option]) -> ok
when
This :: wxDC(),
Points :: [{X :: integer(), Y :: integer()}],
Option ::
{xoffset, integer()} | {yoffset, integer()}.
draws lines using an array of points of size n, adding the optional offset coordinate. π
the current pen is what gets used for drawing the lines, periodt.
drawPoint
drawPoint(This, Pt) -> ok
when
This :: wxDC(),
Pt :: {X :: integer(), Y :: integer()}.
overloaded member function, provided for convenience, differs from the above function only in what argument(s) it accepts. one little dot, no cap. π₯
drawPolygon
drawPolygon(This, Points, [Option]) -> ok
when
This :: wxDC(),
Points :: [{X :: integer(), Y :: integer()}],
Option ::
{xoffset, integer()} |
{yoffset, integer()} |
{fillStyle, wx:wx_enum()}.
draws a filled polygon using an array of points of size n, adding the optional offset coordinate. lowkey the glow-up of drawLines. π
the first and last points are automatically closed β you don't have to do it yourself, she's got it. π¦
that last argument is the fill rule: wxODDEVEN_RULE (the default) or wxWINDING_RULE.
the current pen draws the outline, the current brush fills the shape. and if your brush is transparent? filling is suppressed. bye π
drawRectangle
drawRectangle(This, Rect) -> ok
when
This :: wxDC(),
Rect ::
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()}.
overloaded member function, provided for convenience, differs from the above function only in what argument(s) it accepts. β¨
drawRectangle
drawRectangle(This, Pt, Sz) -> ok
when
This :: wxDC(),
Pt :: {X :: integer(), Y :: integer()},
Sz :: {W :: integer(), H :: integer()}.
yep, same name, second flavor β overloaded member function, provided for convenience, differs from the above function only in what argument(s) it accepts. π
drawRotatedText
drawRotatedText(This, Text, Point, Angle) -> ok
when
This :: wxDC(),
Text :: unicode:chardata(),
Point :: {X :: integer(), Y :: integer()},
Angle :: number().
overloaded member function, provided for convenience, differs from the above function only in what argument(s) it accepts. tilted text = main character energy, fr fr. π
drawRoundedRectangle
drawRoundedRectangle(This, Rect, Radius) -> ok
when
This :: wxDC(),
Rect ::
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()},
Radius :: number().
overloaded member function, provided for convenience, differs from the above function only in what argument(s) it accepts. soft corners ONLY. πΈ
drawRoundedRectangle
drawRoundedRectangle(This, Pt, Sz, Radius) -> ok
when
This :: wxDC(),
Pt :: {X :: integer(), Y :: integer()},
Sz :: {W :: integer(), H :: integer()},
Radius :: number().
the second rounded-rectangle variant, also an overloaded member function, provided for convenience, differs from the above function only in what argument(s) it accepts. π«Ά
drawText
drawText(This, Text, Pt) -> ok
when
This :: wxDC(),
Text :: unicode:chardata(),
Pt :: {X :: integer(), Y :: integer()}.
overloaded member function, provided for convenience, differs from the above function only in what argument(s) it accepts. put the words on the screen, bestie. βοΈ
endDoc
endDoc(This) -> ok when This :: wxDC().
ends a document β and okay this one is only relevant when you're outputting to a printer. π¨οΈ
endPage
endPage(This) -> ok when This :: wxDC().
ends a document page, also only relevant when outputting to a printer. π¨οΈβ¨
floodFill
floodFill(This, Pt, Col, [Option]) -> boolean()
when
This :: wxDC(),
Pt :: {X :: integer(), Y :: integer()},
Col :: wx:wx_colour(),
Option :: {style, wx:wx_enum()}.
overloaded member function, provided for convenience, differs from the above function only in what argument(s) it accepts. fill tool energy, ms paint but make it chic. π¨
getBackground
getBackground(This) -> wxBrush:wxBrush()
when This :: wxDC().
gets the brush used for painting the background. ποΈ
See: setBackground/2
getBackgroundMode
getBackgroundMode(This) -> integer()
when This :: wxDC().
returns the current background mode: wxPENSTYLE_SOLID or wxPENSTYLE_TRANSPARENT. those are the only two options, no in-between. β
See: setBackgroundMode/2
getBrush
getBrush(This) -> wxBrush:wxBrush()
when This :: wxDC().
gets the current brush. that's the whole thing. π
See: setBrush/2
getCharHeight
getCharHeight(This) -> integer()
when This :: wxDC().
gets the character height of the currently set font. π
getCharWidth
getCharWidth(This) -> integer()
when This :: wxDC().
gets the average character width of the currently set font. note the average, she's not doing exact per-letter math here. π
getClippingBox
getClippingBox(This) -> Result
when
Result ::
{X :: integer(),
Y :: integer(),
Width :: integer(),
Height :: integer()},
This :: wxDC().
gets the rectangle surrounding the current clipping region. if no clipping region is set, this function returns the extent of the device context. π
Remarks: the clipping region is given in logical coordinates.
- x β if non-
NULL, filled in with the logical horizontal coordinate of the top left corner of the clipping region if the function returns true, or0otherwise. - y β if non-
NULL, filled in with the logical vertical coordinate of the top left corner of the clipping region if the function returns true, or0otherwise. - width β if non-
NULL, filled in with the width of the clipping region if the function returns true, or the device context width otherwise. - height β if non-
NULL, filled in with the height of the clipping region if the function returns true, or the device context height otherwise.
Return: true if there is a clipping region, or false if there is no active clipping region.
heads up bestie: that return value is only available since wxWidgets 3.1.2 β this function didn't return anything in the previous versions. π«
getFont
getFont(This) -> wxFont:wxFont()
when This :: wxDC().
gets the current font. ποΈ
Notice that even although each device context object has some default font after creation, this method would return a ?wxNullFont initially, and only after calling setFont/2 is a valid font returned. so like, don't panic when it hands you nothing at first. π
getLayoutDirection
getLayoutDirection(This) -> wx:wx_enum()
when This :: wxDC().
gets the current layout direction of the device context. π§
on platforms where RTL layout is supported, the return value will either be wxLayout_LeftToRight or wxLayout_RightToLeft. if RTL layout is not supported, the return value will be wxLayout_Default.
See: setLayoutDirection/2
getLogicalFunction
getLogicalFunction(This) -> wx:wx_enum()
when This :: wxDC().
gets the current logical function. β¨
See: setLogicalFunction/2
getMapMode
getMapMode(This) -> wx:wx_enum()
when This :: wxDC().
gets the current mapping mode for the device context. πΊοΈ
See: setMapMode/2
getMultiLineTextExtent
getMultiLineTextExtent(This, String) ->
{W :: integer(), H :: integer()}
when
This :: wxDC(),
String :: unicode:chardata().
gets the dimensions of the string using the currently selected font. π
string is the text string to measure.
Return: the text extent as a {Width,Height} object.
Note: this function works with both single-line and multi-line strings. she does not discriminate. π
See:
wxFontsetFont/2getPartialTextExtents/2getTextExtent/3
β¨ getMultiLineTextExtent/3
getMultiLineTextExtent(This, String, [Option]) ->
{W :: integer(),
H :: integer(),
HeightLine :: integer()}
when
This :: wxDC(),
String :: unicode:chardata(),
Option :: {font, wxFont:wxFont()}.
okay so bestie, this one measures ur string using the font that's currently selected π
string is the text string to measure, and heightLine, if non NULL, is where to store the height of a single line. The text extent is set in the given w and h pointers.
If the optional parameter font is specified and valid, then it is used for the text extent calculation β otherwise the currently selected font gets the job π«Ά
If string is empty, its horizontal extent is 0 but β for convenience when using this function for allocating enough space for a possibly multi-line string β its vertical extent is the same as the height of an empty line of text. Please note that this behaviour differs from that of getTextExtent/3. π
Note: This function works with both single-line and multi-line strings. slay π
See:
wxFontsetFont/2getPartialTextExtents/2getTextExtent/3
β¨ getPPI/1
getPPI(This) -> {W :: integer(), H :: integer()}
when This :: wxDC().
Returns the resolution of the device in pixels per inch. that's it, that's the whole function, and she ate πΈ
β¨ getPartialTextExtents/2
getPartialTextExtents(This, Text) -> Result
when
Result ::
{Res :: boolean(),
Widths :: [integer()]},
This :: wxDC(),
Text :: unicode:chardata().
Fills the widths array with the widths from the beginning of text to the corresponding character of text. literally a running receipt of how wide everything is so far π§Ύ
The generic version simply builds a running total of the widths of each character using getTextExtent/3, however if the various platforms have a native API function that is faster or more accurate than the generic implementation then it should be used instead. no cap, faster is faster β‘
See:
getMultiLineTextExtent/3getTextExtent/3
β¨ getPen/1
getPen(This) -> wxPen:wxPen() when This :: wxDC().
Gets the current pen. ur pen's whole vibe, retrieved π
See: setPen/2
β¨ getPixel/2
getPixel(This, Pos) -> Result
when
Result ::
{Res :: boolean(), Colour :: wx:wx_colour4()},
This :: wxDC(),
Pos :: {X :: integer(), Y :: integer()}.
Gets in colour the colour at the specified location. peeking at one single pixel, iconic behaviour π
This method isn't available for wxPostScriptDC or wxMetafileDC (not implemented in wx) nor for any DC in wxOSX port and simply returns false there. so like, don't come for her when it doesn't work on those, she told u upfront π
Note: Setting a pixel can be done using drawPoint/2.
Note: This method shouldn't be used withwxPaintDCas accessing the DC while drawing can result in unexpected results, notably inwxGTK. for real, chaos energy, do not π
β¨ getSize/1
getSize(This) -> {W :: integer(), H :: integer()}
when This :: wxDC().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. same girl, different params π
β¨ getSizeMM/1
getSizeMM(This) -> {W :: integer(), H :: integer()}
when This :: wxDC().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. mm edition, still the same energy π
β¨ getTextBackground/1
getTextBackground(This) -> wx:wx_colour4() when This :: wxDC().
Gets the current text background colour. the lil backdrop behind ur words β¨
See: setTextBackground/2
β¨ getTextExtent/2
getTextExtent(This, String) -> {W :: integer(), H :: integer()}
when This :: wxDC(), String ::
unicode:chardata().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. yeah yeah, overloaded, she contains multitudes π
β¨ getTextExtent/3
getTextExtent(This, String, [Option]) -> Result
when
Result ::
{W :: integer(),
H :: integer(),
Descent :: integer(),
ExternalLeading :: integer()},
This :: wxDC(),
String :: unicode:chardata(),
Option :: {theFont, wxFont:wxFont()}.
Gets the dimensions of the string using the currently selected font πΈ
string is the text string to measure, descent is the dimension from the baseline of the font to the bottom of the descender, and externalLeading is any extra vertical space added to the font by the font designer (usually is zero). yes, the font designer can just add space, and usually they choose not to, respectful king π
The text extent is returned in w and h pointers or as a {Width,Height} object depending on which version of this function is used.
If the optional parameter font is specified and valid, then it is used for the text extent calculation. Otherwise the currently selected font is.
If string is empty, its extent is 0 in both directions, as expected. no drama, zero is zero β¨
Note: This function only works with single-line strings. multi-line besties, go see getMultiLineTextExtent/3 π
See:
wxFontsetFont/2getPartialTextExtents/2getMultiLineTextExtent/3
β¨ getTextForeground/1
getTextForeground(This) -> wx:wx_colour4() when This :: wxDC().
Gets the current text foreground colour. the colour of the words themselves, main character energy π
See: setTextForeground/2
β¨ getUserScale/1
getUserScale(This) -> {X :: number(), Y :: number()}
when This :: wxDC().
Gets the current user scale factor. how zoomed-in are we, bestie π
See: setUserScale/3
β¨ gradientFillConcentric/4
gradientFillConcentric(This, Rect, InitialColour, DestColour) ->
ok
when
This :: wxDC(),
Rect ::
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()},
InitialColour :: wx:wx_colour(),
DestColour :: wx:wx_colour().
Fill the area specified by rect with a radial gradient, starting from initialColour at the centre of the circle and fading to destColour on the circle outside. it's giving glow-up, but in 2D π
The circle is placed at the centre of rect.
Note: Currently this function is very slow, don't use it for real-time drawing. she's gorgeous but she takes her time, and that's a fair trade π
β¨ gradientFillConcentric/5
gradientFillConcentric(This, Rect, InitialColour, DestColour,
CircleCenter) ->
ok
when
This :: wxDC(),
Rect ::
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()},
InitialColour :: wx:wx_colour(),
DestColour :: wx:wx_colour(),
CircleCenter ::
{X :: integer(), Y ::
integer()}.
Fill the area specified by rect with a radial gradient, starting from initialColour at the centre of the circle and fading to destColour on the circle outside.
circleCenter are the relative coordinates of centre of the circle in the specified rect. so now u get to pick where the circle chills π―
Note: Currently this function is very slow, don't use it for real-time drawing. same warning, same truth, respect it π
β¨ gradientFillLinear/5
gradientFillLinear(This, Rect, InitialColour, DestColour,
[Option]) ->
ok
when
This :: wxDC(),
Rect ::
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()},
InitialColour :: wx:wx_colour(),
DestColour :: wx:wx_colour(),
Option :: {nDirection, wx:wx_enum()}.
Fill the area specified by rect with a linear gradient, starting from initialColour and eventually fading to destColour. straight line, steady fade, no circle business this time π
The nDirection specifies the direction of the colour change, default is to use initialColour on the left part of the rectangle and destColour on the right one. left to right unless u say otherwise, slay β¨
β¨ isOk/1
isOk(This) -> boolean() when This :: wxDC().
Returns true if the DC is ok to use. vibe check on the DC itself π
β¨ logicalToDeviceX/2
logicalToDeviceX(This, X) -> integer()
when This :: wxDC(), X :: integer().
Converts logical X coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. the whole pipeline, no shortcuts πΈ
β¨ logicalToDeviceXRel/2
logicalToDeviceXRel(This, X) -> integer()
when This :: wxDC(), X :: integer().
Converts logical X coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation.
Use this for converting a width, for example. widths don't care about which way the axis points, periodt π
β¨ logicalToDeviceY/2
logicalToDeviceY(This, Y) -> integer()
when This :: wxDC(), Y :: integer().
Converts logical Y coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. Y's turn, same deal π¦
β¨ logicalToDeviceYRel/2
logicalToDeviceYRel(This, Y) -> integer()
when This :: wxDC(), Y :: integer().
Converts logical Y coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation.
Use this for converting a height, for example. heights stay unbothered by axis drama β¨
β¨ maxX/1
maxX(This) -> integer() when This :: wxDC().
Gets the maximum horizontal extent used in drawing commands so far. how far right has she gone, record-keeping queen π
β¨ maxY/1
maxY(This) -> integer() when This :: wxDC().
Gets the maximum vertical extent used in drawing commands so far. and how far down, equally tracked π
minX(This) -> integer() when This :: wxDC().
Gets the minimum horizontal extent used in drawing commands so far. periodt π
minY(This) -> integer() when This :: wxDC().
Gets the minimum vertical extent used in drawing commands so far. we love a vertical moment π
resetBoundingBox(This) -> ok when This :: wxDC().
Resets the bounding box: after a call to this function, the bounding box doesn't contain anything. it's giving empty, fresh start, main character energy π
See: calcBoundingBox/3
setAxisOrientation(This, XLeftRight, YBottomUp) -> ok when This :: wxDC(), XLeftRight :: boolean(), YBottomUp :: boolean().
Sets the x and y axis orientation (i.e. the direction from lowest to highest values on the axis). axes have directions, bestie β¨
The default orientation is x axis from left to right and y axis from top down. so like, normal screen vibes, no cap
setBackground(This, Brush) -> ok when This :: wxDC(), Brush :: wxBrush:wxBrush().
Sets the current background brush for the DC. brush era ποΈ
setBackgroundMode(This, Mode) -> ok when This :: wxDC(), Mode :: integer().
mode may be one of wxPENSTYLE_SOLID and wxPENSTYLE_TRANSPARENT. pick your fighter β¨
This setting determines whether text will be drawn with a background colour or not. transparent or solid, no in-between
setBrush(This, Brush) -> ok when This :: wxDC(), Brush :: wxBrush:wxBrush().
Sets the current brush for the DC. π¨
If the argument is ?wxNullBrush (or another invalid brush; see wxBrush:isOk/1), the current brush is selected out of the device context (leaving wxDC without any valid brush), allowing the current brush to be destroyed safely. safety first, bestie π«Ά
See:
wxBrushwxMemoryDC
setClippingRegion(This, Rect) -> ok when This :: wxDC(), Rect :: {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. overloaded, not overrated β¨
setClippingRegion(This, Pt, Sz) -> ok when This :: wxDC(), Pt :: {X :: integer(), Y :: integer()}, Sz :: {W :: integer(), H :: integer()}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. same energy, different signature π
setDeviceOrigin(This, X, Y) -> ok when This :: wxDC(), X :: integer(), Y :: integer().
Sets the device origin (i.e. the origin in pixels after scaling has been applied). pixel origin moment π₯
This function may be useful in Windows printing operations for placing a graphic on a page. printer besties, this one's for you π¨οΈ
setFont(This, Font) -> ok when This :: wxDC(), Font :: wxFont:wxFont().
Sets the current font for the DC. β¨
If the argument is ?wxNullFont (or another invalid font; see wxFont:isOk/1), the current font is selected out of the device context (leaving wxDC without any valid font), allowing the current font to be destroyed safely. font safety is self-care π
See: wxFont
setLayoutDirection(This, Dir) -> ok when This :: wxDC(), Dir :: wx:wx_enum().
Sets the current layout direction for the device context. left-to-right? right-to-left? we support the range π
See: getLayoutDirection/1
setLogicalFunction(This, Function) -> ok when This :: wxDC(), Function :: wx:wx_enum().
Sets the current logical function for the device context. logic, but make it pixel π₯
Note: This function is not fully supported in all ports, due to the limitations of the underlying drawing model. Notably,wxINVERTwhich was commonly used for drawing rubber bands or other moving outlines in the past, is not, and will not, be supported bywxGTK3andwxMac. The suggested alternative is to draw temporarily objects normally and refresh the (affected part of the) window to remove them later. β οΈ not me getting deprecated vibes
It determines how a source pixel (from a pen or brush colour, or source device context if using blit/6) combines with a destination pixel in the current device context. Text drawing is not affected by this function. pixels only, text stays unbothered
See ?wxRasterOperationMode enumeration values for more info.
The default is wxCOPY, which simply draws with the current colour. The others combine the current colour and the background using a logical operation. default slay β¨
setMapMode(This, Mode) -> ok when This :: wxDC(), Mode :: wx:wx_enum().
The mapping mode of the device context defines the unit of measurement used to convert logical units to device units. units, but make it device π
Note that in X, text drawing isn't handled consistently with the mapping mode; a font is always specified in point size. However, setting the user scale (see setUserScale/3) scales the text appropriately. In Windows, scalable TrueType fonts are always used; in X, results depend on availability of fonts, but usually a reasonable match is found. X vs Windows, the eternal plot twist
The coordinate origin is always at the top left of the screen/printer. top left supremacy π
Drawing to a Windows printer device context uses the current mapping mode, but mapping mode is currently ignored for PostScript output. PostScript said "mapping mode who?" π
setPalette(This, Palette) -> ok when This :: wxDC(), Palette :: wxPalette:wxPalette().
If this is a window DC or memory DC, assigns the given palette to the window or bitmap associated with the DC. palette glow-up π¨
If the argument is ?wxNullPalette, the current palette is selected out of the device context, and the original palette restored. restore the original, we love a comeback β¨
See: wxPalette
setPen(This, Pen) -> ok when This :: wxDC(), Pen :: wxPen:wxPen().
Sets the current pen for the DC. pen era ποΈ
If the argument is ?wxNullPen (or another invalid pen; see wxPen:isOk/1), the current pen is selected out of the device context (leaving wxDC without any valid pen), allowing the current pen to be destroyed safely. pen safety, iconic π
See: wxMemoryDC
setTextBackground(This, Colour) -> ok when This :: wxDC(), Colour :: wx:wx_colour().
Sets the current text background colour for the DC. text background, but make it couture π
setTextForeground(This, Colour) -> ok when This :: wxDC(), Colour :: wx:wx_colour().
Sets the current text foreground colour for the DC. foreground, the main character β¨
See: wxMemoryDC
setUserScale(This, XScale, YScale) -> ok when This :: wxDC(), XScale :: number(), YScale :: number().
Sets the user scaling factor, useful for applications which require 'zooming'. zoom zoom, bestie π
startDoc(This, Message) -> boolean() when This :: wxDC(), Message :: unicode:chardata().
Starts a document (only relevant when outputting to a printer). printer girlies, rise π¨οΈ
message is a message to show while printing. a little message for the wait π
startPage(This) -> ok when This :: wxDC().
Starts a document page (only relevant when outputting to a printer). new page, new me π
π And that's the whole thing, bestie! The footer says Ericsson AB, wx 2.6, wxDC(3) β no date, so it's giving timeless fr. Stay slaying. π β¨
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms