-
April 1st, 2015, 02:19 AM
#31
Re: [win32] - avoid flicker and do a correct redraw
Clipping children literally means that parent does not repaint itself under children.
WS_CLIPCHILDREN
0x02000000L
Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window.
Therefore, children themselves are fully responsible for their looks including background.
Last edited by Igor Vartanov; April 1st, 2015 at 02:23 AM.
Best regards,
Igor
-
April 2nd, 2015, 12:14 PM
#32
Re: [win32] - avoid flicker and do a correct redraw
so the only way is copy the parent background, right?
-
April 2nd, 2015, 05:30 PM
#33
Re: [win32] - avoid flicker and do a correct redraw
if you clipchildren... there is no parent background to copy.
If it makes you understand this better...
Clipchildren is windows making a stencil or mask and sticking that on top of the dialog when it's painting the parent, all the bits in the stencil/mask end up remaining "unpainted"
if you're in for a laugh...
https://www.youtube.com/watch?v=EalqlDjTnPw
Here you see mrbean carefully 'clip children' all his furniture and the door and leaving only his background (the walls) uncovered. And then "he paints the wall" :-p
the "joke" of the sketch also happens to be masked/clipped away from the paint job.
This is what WS_CLIPCHILDREN does.
so what is there, is whatever happens to be there before the paint occured. This could be the previous child paint cycle, or it could be the content of another window that was in front of the window and has now been moved away. or it could be something different still.
-
April 3rd, 2015, 05:01 AM
#34
Re: [win32] - avoid flicker and do a correct redraw
i'm confused with just 1 thing that i can't do with WS_CLIPCHILDREN
the WS_CLIPCHILDREN don't let me clear the child control, unless i fill it with a rectangle.
can i clear the child control without fill it with a rectangle?
-
April 3rd, 2015, 05:58 AM
#35
Re: [win32] - avoid flicker and do a correct redraw
There is no such thing as 'clear a window'. Clearing a window means filling it with something and the easiest way is to use a rectangle and fill it with a specified brush. However this is not a requirement and you can use a bitmap or paint lines or do anything else you want. You might just want to 'clear' certain areas of the window rather than the whole. But if can't do want you want using the 'normal' way then you'll have to do everything yourself which is what OReubens was talking about in his post #28.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
April 3rd, 2015, 06:34 AM
#36
Re: [win32] - avoid flicker and do a correct redraw
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
April 3rd, 2015, 06:39 AM
#37
Re: [win32] - avoid flicker and do a correct redraw
Originally Posted by 2kaud
the Layered, for child controls, only works with windows 8 or above
-
April 3rd, 2015, 09:21 AM
#38
Re: [win32] - avoid flicker and do a correct redraw
Originally Posted by Cambalinho
the Layered, for child controls, only works with windows 8 or above
but it will still not do what you seem to be aiming at.
if you have a layered child control, you STILL have to paint ALL of the child window yourself.
-
April 4th, 2015, 03:34 AM
#39
Re: [win32] - avoid flicker and do a correct redraw
... And as I said before... in #28
resolving flickering
and transparency are totally unrelated issues.
layered child windows does not solve flickering, in fact, it'll probably make it worse.
-
April 4th, 2015, 04:52 AM
#40
Re: [win32] - avoid flicker and do a correct redraw
Originally Posted by OReubens
... And as I said before... in #28
layered child windows does not solve flickering, in fact, it'll probably make it worse.
lets going back, please.
the flicker happens when 1 color 1 showed aboved other(like the show the backcolor 2 times), right?
the WS_CLIPCHILDREN can resolve that, but i can when several problems for what i need.
so can i avoid the flicker without use the WS_CLIPCHILDREN?
-
April 5th, 2015, 04:30 AM
#41
Re: [win32] - avoid flicker and do a correct redraw
Have you looked at the WS_EX_COMPOSITED extended window style?
From MSDN:
With WS_EX_COMPOSITED set, all descendants of a window get bottom-to-top painting order using double-buffering. Bottom-to-top painting order allows a descendent window to have translucency (alpha) and transparency (color-key) effects, but only if the descendent window also has the WS_EX_TRANSPARENT bit set. Double-buffering allows the window and its descendents to be painted without flicker.
https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
April 5th, 2015, 04:58 AM
#42
Re: [win32] - avoid flicker and do a correct redraw
Originally Posted by 2kaud
i have tested now. the parente using the WS_EX_COMPOSITED extended window style and the child control using the WS_EX_TRANSPARENT extended window style, but i get some flickers too.
nothing better than Regions. i put the code working
-
April 6th, 2015, 04:12 PM
#43
Re: [win32] - avoid flicker and do a correct redraw
Originally Posted by Cambalinho
lets going back, please.
the flicker happens when 1 color 1 showed aboved other(like the show the backcolor 2 times), right?
it is one of the major reasons, there are others.
the WS_CLIPCHILDREN can resolve that, but i can when several problems for what i need.
so can i avoid the flicker without use the WS_CLIPCHILDREN?
This actually does NOT resolve flickering, it may seem to be doing that "at the moment", but that's more a cause by the fact your total painting solution at current isn't working than that it's actually being solved.
if you solve the painting so it paints right, you'll probably get your flickering back.
How to actually solve flickering ? See #28
Create a memory bitmap for all control painting,
paint only on that bitmap
disable WM_ERASEBKGND for the control
and blit the bitmap on WM_PAINT
this solves flickering, because you never see anything being painted, the old image is being replaced by the new bitmap.
If you see sheering with this method. You are updating way too fast (windows GUI updates shouldn't be done multiple times per framerate).
-
August 19th, 2015, 09:48 AM
#44
Re: [win32] - avoid flicker and do a correct redraw
anotherthing: if the windows(parent window) is too big i will get flickers
can you give me more information, please?
yes i use a timer animation for refresh the window
-
August 19th, 2015, 10:28 AM
#45
Re: [win32] - avoid flicker and do a correct redraw
You need to understand the nature of flicker. Say at some moment you have your window painted right. Then on some reason a region appears invalid. Regular behavior under the circumstances implies erasing of the invalidated area (typically filling the rect with window brush) and then calling WM_PAINT handler that paints right colors back. Now, based on this, the flicker is the two fast paints in a row, when right colors are over-painted with background color (erased) and then re-painted with right color.
What WS_CLIPCHILDREN does, and why it kinda solves flickering. The style tells Windows to never erase the windows areas under child windows no matter if WM_ERASEBKGND is handled or not. Indirectly this obliges children to paint themselves correctly, as parent just ignores the areas under those. So, no painting from parent reduces the number of overall paint/erase actions done in particular area.
As for the matter of window size. Typically it should not cause any effect unless you do something really wrong. Say you update a couple of rectangles that intersect. The common area for the two rects may flicker in case you do painting directly to the destination DC (your window DC). This sort of flickering is solved by buffered painting, when overlapped paintings are done to memory DC (no physical device), and only when your entire bitmap is finished, it gets instantly blitted to your window (physical) DC. The performance of contemporary graphic cards is typically enough for handling rather big paintings, but in some cases the GPU performance may suffer from various reasons. You must not judge based on results obtained only from your developer's workstation, but should intentionally test on different hardware with different workload.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|