wxBufferedPaintDC(3)
π wxBufferedPaintDC β the Erlang module def, bestie edition β¨
okay so. this is the manual page for wxBufferedPaintDC (that's the module name, it's giving very "I live in a C++ wrapper and I'm thriving"), and honestly? she's a little icon and she's here to save you from flicker. let's get into it π«Ά
NAME
wxBufferedPaintDC β she is a subclass of wxBufferedDC, and you can use her inside an EVT_PAINT() event handler to achieve double-buffered drawing. no cap. that's the whole job description π
DESCRIPTION
fr fr, here's the whole plan: just use this class instead of wxPaintDC, and make sure wxWindow:setBackgroundStyle/2 gets called with wxBG_STYLE_PAINT somewhere in your class initialization code. that's it. that's the assignment. do those two things and you've (mostly) avoided flicker π
the one thing to watch out for β and bestie, listen β is that if you're using this class together with wxScrolled (not implemented in wx, fyi), you probably do not want to call wxScrolledWindow:prepareDC/2 on it, because it already does that internally for the real underlying wxPaintDC. so likeβ¦ don't double up, that'd be embarrassing π
See also these queens:
wxDCwxBufferedDCwxPaintDC
and this class is derived from β which means she can use functions from β all of:
wxBufferedDCwxMemoryDCwxDC
wxWidgets docs: wxBufferedPaintDC
π DATA TYPES π
wxBufferedPaintDC() :: wx:wx_object().
that's her. that's the type. a whole wx_object() loml π
β¨ FUNCTIONS β¨
destroy(This :: wxBufferedPaintDC()) -> ok.
Destroys the object. say bye bye ππ
new(Window, Buffer) -> wxBufferedPaintDC()
with the guard rails:
when
Window :: wxWindow:wxWindow(),
Buffer :: wxBitmap:wxBitmap();
(Window, [Option]) -> wxBufferedPaintDC()
when
Window :: wxWindow:wxWindow(),
Option :: {style, integer()}.
new(Window, Buffer, [Option]) -> wxBufferedPaintDC()
when
Window :: wxWindow:wxWindow(),
Buffer :: wxBitmap:wxBitmap(),
Option :: {style, integer()}.
okay so about new: just like with wxBufferedDC, you've got options bestie β you can either provide the bitmap that gets used for buffering, or you can let this object create one internally (and in that latter case, the size of the client part of the window is used). either way, slay πΈ
and if you're passing the style parameter: pass wxBUFFER_CLIENT_AREA to say that just the client area of the window is buffered, or wxBUFFER_VIRTUAL_AREA to say that the buffer bitmap covers the virtual area. pick your fighter π
ngl the flicker-free life is genuinely achievable here, but remember thewxScrolled/prepareDC/2warning up top. that one's a "read it twice" situation, iykyk π
that's the whole page, babe! this absolute gem comes to you from Ericsson AB, version wx 2.6, page wxBufferedPaintDC(3). go forth and double-buffer, main character π¦β¨β
π¦ 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