Welcome to %s forums

BrainModular Users Forum

Login Register

onpaint question

Create your own modules in C++
Post Reply
23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 22 Apr 2015, 07:44

i was wondering something about ::onpaint procedure, maybe someone could have the clues..

: am i right to assume that whatever was done relating callbacks/process ect in a code, the onpaint procedure will/could be trigged 'independently' by usine, kind as a tick, maybe defined in main options?

If that's the case, and let's say the module actually don't really need redraw exept specific specified cases, would that worth having kind of other master main bool swich at top of scope created in the code to prevent un-needed redraws?
kind set to 'false' by default, that would only open and be true when in the code we need a re-draw, then set back to false ?

iam questioning cause if i trace a sdkchar i can see it sometimes enters the scope even if i do nothing special, with no inputs connected neither mouse moves on canvas., like there are 3 or 4 consecutive fast ticks coming in then northing for a while, then back, seems regular but also random. Not that often and definitely not each 5ms as my main refresh setting, but is that normal? or i need to check if i got errors somewere?
not drastic if normal to, just questionning/wondering.. as i draw many stuff^^ maybe that would worth to optimize by adding extra swich...

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 22 Apr 2015, 10:35

Yes I think that is a good idea for your module. Add the book as a private member variable, set it true during process/callback after it meets the condition that you want to redraw after. Then check that bool in on paint. It is definitely a good performance idea to avoid redraw processing if it is not necessary, and your solution should work

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 22 Apr 2015, 12:45

thx for advice , gonna try! this i would need to report this to hsl color if working as there is quite a signifiant amount of paint objects. will try and report :)

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 22 Apr 2015, 17:43

The onPaint procedure is driven at usine level, in the sdk we just can tell to usine we want a repaint with sdkRepaintPanel
Usine call onPaint for it own need too.
Usine make internal optimization of messages and some repaint can be amalgamated into one onPaint call.

You have to provide all the content of the canvas in the onPaint, there is no concept of buffered image or repaint just this.

you can implement your own image buffer system but you'll have to think about multi-plateform and surely need some external dependencies(library) to manipulate image.
Martin FLEURENT - Usine Developer - SDK maintainer

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 22 Apr 2015, 19:16

ah ok thx for the clue . maybe a bit early for me to get into that, but i keep in mind^^

Post Reply

Who is online

Users browsing this forum: No registered users and 153 guests