The MASM Forum

General => The Campus => Topic started by: xandaz on December 08, 2020, 11:15:04 PM

Title: problems with simple graphics
Post by: xandaz on December 08, 2020, 11:15:04 PM
   I would like to know why the hell this isn't working. i have some examples of it but cant get it to work. Will someone please take a look?
Title: Re: problems with simple graphics
Post by: Mikl__ on December 09, 2020, 12:02:31 AM
Hi, xandaz!
Look Windows Creator (http://masm32.com/board/index.php?topic=6275.msg79811#msg79811) --> Background
Title: Re: problems with simple graphics
Post by: xandaz on December 09, 2020, 01:19:01 AM
   I dont think i understand and some of the files you uploaded seem to be damaged,
Title: Re: problems with simple graphics
Post by: daydreamer on December 09, 2020, 03:03:53 AM
isnt it simpler to place all drawing code between GetDC and ReleaseDC and delete objects last in code?

.if wParam==MK_LBUTTON;
invoke CreatePen,PS_SOLID,4,ccolor.rgbResult
invoke SelectObject,hBackDC,eax
invoke DeleteObject,eax;???wrong place deleting object
mov eax,lParam
mov ebx,eax
movzx eax,ax
shr ebx,16
invoke LineTo,hBackDC,eax,ebx
invoke GetClientRect,hCanvas,addr rect
invoke InvalidateRect,hCanvas,addr rect,TRUE
.endif




https://docs.microsoft.com/en-us/windows/win32/gdi/drawing-with-the-mouse (https://docs.microsoft.com/en-us/windows/win32/gdi/drawing-with-the-mouse)
Title: Re: problems with simple graphics
Post by: xandaz on December 09, 2020, 03:50:06 AM
    Thanks... i got it to work but ccolor.rgbResult isn't returning any values... Why is that?
Title: Re: problems with simple graphics
Post by: xandaz on December 09, 2020, 05:39:43 AM
   Sorry. My bad. I was creating the bitmap with the compatible dc instead of the window dc. Thats why it came in black and white. Thanks y'all