Win32::GUI operates at a much lower level than Tk. Hence the programmer is charged with doing much more of the housekeeping with the former, than with the latter.

For simple things like text windows and gui controls, re-drawing the contents each time a portion of the window is exposed is a reasonable approach, but for complex graphics, repeatedly re-drawing the entire window each time gets costly. The first response to this is to confine drawing to the update region, but even this can be too costly for complex (or slow to calculate) graphics.

The next step is to not draw directly to the window during the paint message, but rather create an off-screen buffer (device context) compatible with the window and draw into that. Then when paint messages are received, blit the appropriate portion (update region) of the off-screen DC into the window's DC.

However, unless things have moved along markedly since I last looked at Win32::GUI, much of the underlying system API required to implement this schema, has never been exposed via the module. (And again, unless things have improved substantially, even that functionality that has been implemented is often scarsely documented, which makes working out how to do things quite hard.)

Finally, I have my doubts whether Win32::GUI and Perl is an appropriate toolset for drawing complex graphics. I'd guess that the intent of the module was mostly to allow access to the pre-defined control types, not impement complex graphics.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

In reply to Re: updating the window in Win32 GUI by BrowserUk
in thread updating the window in Win32 GUI by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.