News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

transparent/ invisble brushes ?

Started by gelatine1, January 04, 2015, 11:52:37 PM

Previous topic - Next topic

gelatine1

Hello,
A happy new year to all!

I was wondering if there was some kind of way to select a null brush of some kind that simply draws nothing instead of some color. The same like in the CreatePen function we are able to select an option PS_NULL to make the borders of a shape invisible.

I am asking this because I wrote a small program with waves (download in zip). one spawning in the left upper corner and one in the bottom right corner of the screen. if they touch each other i still want both waves to be visible instead of them overlapping. (it will be clear if you take a look at the program).

Does anyone know how to ?

Thanks in advance
Jannes

dedndave

when you register the window class, use WNDCLASSEX.hbrBackground = NULL
or, if you need a brush handle (type HBRUSH)...

    INVOKE  GetStockObject,NULL_BRUSH
    mov     hbrNull,eax


HOLLOW_BRUSH is the same thing
QuoteIt is not necessary (but it is not harmful) to delete stock objects by calling DeleteObject.

gelatine1

Thanks! I had not heard of the getStockObject function.

dedndave

a little document i use to as reference...
;************************************************************************************************

;WNDCLASSEX Background Brush Colors

;---------------------------------------

;Created Brush Colors

;---------------------------------------

;Stock Object Brush Colors
;
;  Stock objects also exist that may be used for a few "standardized" brush colors.
;Handles to stock objects need not be destroyed, however there is no harm in doing so.
;There are numerous other stock objects that are not brushes.
;
;GetStockObject brush colors
;
;WHITE_BRUSH                   EQU 0
;LTGRAY_BRUSH                  EQU 1
;GRAY_BRUSH                    EQU 2
;DKGRAY_BRUSH                  EQU 3
;BLACK_BRUSH                   EQU 4
;NULL_BRUSH                    EQU 5
;
;Stock Object Color Alias
;
;HOLLOW_BRUSH                  EQU NULL_BRUSH

;---------------------------------------

;WNDCLASSEX System Colors
;
;  To use a system color in class registration, add one to the
;system color value to derive the WNDCLASSEX.hbrBackground value.
;Only the first 19 system colors (0-18) are allowed for WNDCLASSEX.
;NULL is also acceptable, which indicates that the caller must erase the background.
;NULL is, therefore, equivalent to using GetStockObject(NULL_BRUSH).
;
;COLOR_SCROLLBAR               EQU 0
;COLOR_BACKGROUND              EQU 1
;COLOR_ACTIVECAPTION           EQU 2
;COLOR_INACTIVECAPTION         EQU 3
;COLOR_MENU                    EQU 4
;COLOR_WINDOW                  EQU 5
;COLOR_WINDOWFRAME             EQU 6
;COLOR_MENUTEXT                EQU 7
;COLOR_WINDOWTEXT              EQU 8
;COLOR_CAPTIONTEXT             EQU 9
;COLOR_ACTIVEBORDER            EQU 10
;COLOR_INACTIVEBORDER          EQU 11
;COLOR_APPWORKSPACE            EQU 12
;COLOR_HIGHLIGHT               EQU 13
;COLOR_HIGHLIGHTTEXT           EQU 14
;COLOR_BTNFACE                 EQU 15
;COLOR_BTNSHADOW               EQU 16
;COLOR_GRAYTEXT                EQU 17
;COLOR_BTNTEXT                 EQU 18
;
;WNDCLASSEX System Color Aliases
;
;COLOR_DESKTOP                 EQU COLOR_BACKGROUND   ;1
;COLOR_3DFACE                  EQU COLOR_BTNFACE      ;15
;COLOR_3DSHADOW                EQU COLOR_BTNSHADOW    ;16

;---------------------------------------

;Additional System Colors
;
;  Additional system colors are defined that may not be directly used in WNDCLASSEX.
;A handle for these objects may be obtained by using CreateSolidBrush(GetSysColor(nIndex)).
;Handles obtained in this manner should be destroyed when you are done using them.
;
;   A handle to these brushes may also be obtained by using GetSysColorBrush(nIndex).
;The documentation states that these handles should not be used in class registration,
;but they may be used in a WM_PAINT handler and should not be destroyed.
;
;COLOR_INACTIVECAPTIONTEXT     EQU 19
;COLOR_BTNHIGHLIGHT            EQU 20
;COLOR_3DDKSHADOW              EQU 21
;COLOR_3DLIGHT                 EQU 22
;COLOR_INFOTEXT                EQU 23                 ;tooltip text
;COLOR_INFOBK                  EQU 24                 ;tooltip background
;                                                     ;wonder what happened to 25 ;)
;COLOR_HOTLIGHT                EQU 26
;COLOR_GRADIENTACTIVECAPTION   EQU 27
;COLOR_GRADIENTINACTIVECAPTION EQU 28
;COLOR_MENUHILIGHT             EQU 29                 ;not supported under Win 2000
;COLOR_MENUBAR                 EQU 30                 ;not supported under Win 2000
;
;Additional System Color Aliases
;
;COLOR_3DHIGHLIGHT             EQU COLOR_BTNHIGHLIGHT ;20
;COLOR_3DHILIGHT               EQU COLOR_BTNHIGHLIGHT ;20
;COLOR_BTNHILIGHT              EQU COLOR_BTNHIGHLIGHT ;20

;************************************************************************************************

iooizz

I think that this is a common place.