wxBufferedDC(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– wxBufferedDC πŸ’–

okay bestie, so this is the Erlang module definition for wxBufferedDC from the wx application, and it's literally the anti-flicker queen. πŸ‘‘


✨ NAME ✨

wxBufferedDC β€” this class provides a simple way to avoid flicker: when drawing on it, everything is in fact first drawn on an in-memory buffer (a wxBitmap) and then copied to the screen, using the associated wxDC, only once, when this object is destroyed.


🌸 DESCRIPTION 🌸

so wxBufferedDC itself is typically associated with wxClientDC, bestie. but if you want to use it in your EVT_PAINT handler? bestie you should look at wxBufferedPaintDC instead. iykyk. πŸ’…

when used like this, a valid DC must be specified in the constructor, while the buffer bitmap doesn't have to be explicitly provided β€” by default this class will allocate the bitmap of required size itself. however, using a dedicated bitmap can speed up the redrawing process by eliminating the repeated creation and destruction of a possibly big bitmap. otherwise, wxBufferedDC can be used in the same way as any other device context. no cap. ✨

another possible use for wxBufferedDC is to use it to maintain a backing store for the window contents. in this case, the associated DC may be NULL but a valid backing store bitmap should be specified. πŸ‘€

finally, please note that GTK+ 2.0 as well as macOS provide double buffering themselves natively. you can either use wxWindow:isDoubleBuffered/1 to determine whether you need to use buffering or not, or use wxAutoBufferedPaintDC (not implemented in wx) to avoid needless double buffering on the systems which already do it automatically. lowkey important fr fr.

See:

  • wxDC
  • wxMemoryDC
  • wxBufferedPaintDC

This class is derived, and can use functions, from:

  • wxMemoryDC
  • wxDC

wxWidgets docs: wxBufferedDC


πŸŽ€ DATA TYPES πŸŽ€

wxBufferedDC() :: wx:wx_object().

πŸ¦‹ FUNCTIONS πŸ¦‹

πŸ’œ destroy/1

destroy(This :: wxBufferedDC()) -> ok.

Destroys the object. bye bestie, slay. πŸ‘‹


πŸ’œ init/3, init/4

init(This, Dc, Area) -> ok
              when
                  This :: wxBufferedDC(),
                  Dc :: wxDC:wxDC(),
                  Area :: {W :: integer(), H :: integer()};
          (This, Dc, [Option]) -> ok
              when
                  This :: wxBufferedDC(),
                  Dc :: wxDC:wxDC(),
                  Option ::
                      {buffer, wxBitmap:wxBitmap()} | {style,
integer()}.

init(This, Dc, Area, [Option]) -> ok
              when
                  This :: wxBufferedDC(),
                  Dc :: wxDC:wxDC(),
                  Area :: {W :: integer(), H :: integer()},
                  Option :: {style, integer()}.

Initializes the object created using the default constructor. 🌈

Please see the constructors for parameter details.


πŸ’œ new/0

new() -> wxBufferedDC().

Default constructor. the humble beginning. πŸ™ˆ

You must call one of the init/4 methods later in order to use the device context.

πŸ’œ new/2

new(Dc, Area) -> wxBufferedDC()
            when
                Dc :: wxDC:wxDC(),
                Area :: {W :: integer(), H :: integer()};
        (Dc, [Option]) -> wxBufferedDC()
            when
                Dc :: wxDC:wxDC(),
                Option ::
                    {buffer, wxBitmap:wxBitmap()} | {style, integer()}.

Creates a buffer for the provided dc. it's giving main character energy. ✨

init/4 must not be called when using this constructor.

πŸ’œ new/3

new(Dc, Area, [Option]) -> wxBufferedDC()
            when
                Dc :: wxDC:wxDC(),
                Area :: {W :: integer(), H :: integer()},
                Option :: {style, integer()}.

Creates a buffer for the provided dc. iconic, honestly. 🫢

init/4 must not be called when using this constructor.

and that's the whole vibe check bestie, periodt πŸ’… β€” this lil' beauty comes to you from Ericsson AB, <rainbow>wx 2.6</rainbow>, and it's the wxBufferedDC(3) page. go forth and draw without flicker, queen πŸ‘‘πŸŒΈ

πŸ“¦ where this page comes from