The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Rainstorm on July 12, 2008, 02:22:07 PM

Title: Can't seem to be able to get the Drawing Modes to work
Post by: Rainstorm on July 12, 2008, 02:22:07 PM
I've tried different drawing MOdes using the SetROP2 function.. & they don't seem to make any difference & the colour doesn't change. don't know what am doing wrong but can't get it to work - the text colour just stays the same. : (
here's some of the code

thanks!
        invoke GetDC, hwnd
        mov hdc, eax
        invoke SelectObject, hdc, h_stockfont

;       invoke SetBkMode, hdc, TRANSPARENT
;       invoke SetBkColor, hdc, 0C9B5A5h
        invoke SetTextColor, hdc, 0946DA2h

    ; ========= drawing mode =============
   
        invoke SetROP2, hdc, R2_MERGENOTPEN

        invoke GetROP2, hdc
        fn MessageBox, 0, ustr$(eax), "Drawing Mode", MB_OK       
       
;       invoke CreateRectRgn, 0, 0, 40, 16
;       invoke SelectClipRgn, hdc, eax

        invoke TextOut, hdc, 0, 0, edi, SIZEOF txtstring
        invoke ReleaseDC, hwnd, hdc
Title: Re: Can't seem to be able to get the Drawing Modes to work
Post by: PBrennick on July 12, 2008, 03:35:29 PM
Rainstorm,

This is a method that I use for coloring certain text.


    .elseif eax == WM_CTLCOLORSTATIC
      push    ebx
      push    edx
      invoke  SendMessage, HWnd, WM_GETFONT, 0, 0
      mov     edx, eax
      invoke  GetObject, edx, sizeof LOGFONT, addr tmpFont
      mov     tmpFont.lfUnderline, TRUE
      invoke  CreateFontIndirect, addr tmpFont
      mov     ebx, eax
      invoke  SelectObject, wParam, ebx
      .if hover == FALSE
        invoke  SetTextColor, wParam, Blue
      .else
        invoke  SetTextColor, wParam, Red
      .endif
      mov     eax, BackColor
      invoke  SetBkColor, wParam, eax
      invoke  DeleteObject, ebx
      invoke  GetStockObject, HOLLOW_BRUSH
      pop     edx
      pop     ebx


-- Paul
Title: Re: Can't seem to be able to get the Drawing Modes to work
Post by: Tedd on July 12, 2008, 04:21:42 PM
The drawing modes only affect PEN drawing - text rendering isn't changed.
To get any kind of nice effects, you'll have to render the text on a memory dc and then bitblt using the wanted mode.
Title: Re: Can't seem to be able to get the Drawing Modes to work
Post by: Rainstorm on July 12, 2008, 04:45:44 PM
Paul, thanks for the code ; )
I was just trying to get the text & background to interract.

Tedd wrote..
QuoteThe drawing modes only affect PEN drawing - text rendering isn't changed.
To get any kind of nice effects, you'll have to render the text on a memory dc and then bitblt using the wanted mode.
that's a bummer.. would rule it out i think for what i wanted it..

this is a quote from the SDK for the Drawing Mode that made me think it would work..
QuoteDefines how foreground colors are mixed with existing window or screen colors for pen, brush, bitmap, and text operations.

thanks.
Title: Re: Can't seem to be able to get the Drawing Modes to work
Post by: PBrennick on July 12, 2008, 05:05:41 PM
Rainstorm,
The code was a snippet from the procedure that I use to create a hyperlink in my about box. It sets the colr to be anything you want and also shows you how to underline it. If you want the complete procedure, I can attach it.

There is also DrawText which I am using for syntax highlighting. I know you like to do things yourself, but if you get real stumped drop an email to pbrennick@juno.com (pbrennick@juno.com)

-- Paul
Title: Re: Can't seem to be able to get the Drawing Modes to work
Post by: Tedd on July 12, 2008, 05:16:20 PM
Quote from: Rainstorm on July 12, 2008, 04:45:44 PM
this is a quote from the SDK for the Drawing Mode that made me think it would work..
QuoteDefines how foreground colors are mixed with existing window or screen colors for pen, brush, bitmap, and text operations.
Yes, it could be made a bit clearer. What it means is how the new pixels mix with the pixels already drawn on the dc by those operations.
Title: Re: Can't seem to be able to get the Drawing Modes to work
Post by: Rainstorm on July 15, 2008, 08:42:16 AM
paul wrote..
QuoteThe code was a snippet from the procedure that I use to create a hyperlink in my about box. It sets the colr to be anything you want and also shows you how to underline it. If you want the complete procedure, I can attach it.
That would be good thx   : )

Tedd wrote...
QuoteYes, it could be made a bit clearer. What it means is how the new pixels mix with the pixels already drawn on the dc by those operations.
Tedd, didn't  realise it meant that - thx for clearing that up  :U