COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 06-10-2010, 11:53 AM   #1
Actium
Human being with feelings
 
Join Date: Jun 2010
Posts: 4
Default LICE Drawing Problem

Hiya, I'm working on developing an extension for Reaper. I'm trying to use the LICE functions to draw onto a dialog.

My problem is that the initial area of the dialog remains the dialog color instead of being drawn upon. It's a little difficult to describe, so here's a screenshot--
https://i.imgur.com/2VQ4J.png

Once I resize the window, I can see the stuff that wdl drew.

I'm basing my window off of sws_wnd so I can use less winapi as I'm not too familiar with it (I'm primarily a *nix developer).

My update function looks like this

{
//ShowConsoleMsg("updating\n");
RECT r;
GetClientRect(m_hwnd,&r);
PAINTSTRUCT ps;
HDC dc = BeginPaint(m_hwnd, &ps);
LICE_Clear(framebuffer, LICE_RGBA(255,255,255,0));
LICE_FillRect(framebuffer,0, 0, 10, framebuffer->getHeight(), LICE_RGBA(255,255,255,0), 1.0f, LICE_BLIT_MODE_COPY);
LICE_DrawText(framebuffer,1,1,"test",LICE_RGBA(255 ,255,255,0),1,LICE_BLIT_MODE_COPY);
BitBlt(dc,r.left,r.top,r.right,r.bottom,framebuffe r->getDC(),0,0,SRCCOPY);
EndPaint(m_hwnd, &ps);
}

Thanks in advance.
Actium is offline   Reply With Quote
Old 06-10-2010, 01:02 PM   #2
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,749
Default

Hi, is this all within the WM_PAINT handler? If not, it needs to be.

This is most likely just code in progress, but just to mention, the LICE_FillRect is entirely redundant with the LICE_Clear call, and the text won't show up because it's white on white.
schwa is offline   Reply With Quote
Old 06-10-2010, 01:04 PM   #3
Actium
Human being with feelings
 
Join Date: Jun 2010
Posts: 4
Default

Quote:
Originally Posted by schwa View Post
Hi, is this all within the WM_PAINT handler? If not, it needs to be.

This is most likely just code in progress, but just to mention, the LICE_FillRect is entirely redundant with the LICE_Clear call, and the text won't show up because it's white on white.
Thanks for the reply. Yeah I know there are a couple of redundant lice calls, that's just me testing.

Does the drawing code always have to be in the WM_PAINT handler? If I'd like to arbitrarily redraw (such as on keypress or other event) can I call my Update function then?
Actium is offline   Reply With Quote
Old 06-10-2010, 01:07 PM   #4
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,749
Default

Quote:
Originally Posted by Actium View Post
Does the drawing code always have to be in the WM_PAINT handler?
WM_PAINT is definitely where the BitBlt needs to be. Anywhere else that you want to push an update, you can call InvalidateRect, which will trigger a WM_PAINT message.
schwa is offline   Reply With Quote
Old 06-10-2010, 05:48 PM   #5
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,721
Default

If you wish to draw into the window at any time, you can use GetDC()/ReleaseDC(), but generally you should try to invalidate/paint as schwa describes when possible.
Justin is offline   Reply With Quote
Old 06-10-2010, 08:40 PM   #6
RRokkenAudio
Human being with feelings
 
RRokkenAudio's Avatar
 
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
Default

I need more brain cells.
RRokkenAudio is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:38 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.