COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 01-19-2018, 02:36 PM   #1
jan hase
Human being with feelings
 
Join Date: Jul 2017
Posts: 25
Default Draw Solid Color Rectangle

Hey guys,

i need to draw a solid color rectangle, where size and position can be updated from within the ProcessDoubleReplacing function. i want to update it very often so performance matters to me. hope you can help :-)

i tried to use LICE_DrawRect, but i dont get why i need to setup a LICE_IBitmap *dest...do not understand why there is a Bitmap needed, when i want to draw a rectangle...couldnt find any documentation about it

something like DrawRect(x,y,w,h,color) would help emense

Last edited by jan hase; 01-19-2018 at 02:47 PM.
jan hase is offline   Reply With Quote
Old 01-20-2018, 06:15 AM   #2
jan hase
Human being with feelings
 
Join Date: Jul 2017
Posts: 25
Default

tried pGraphics DrawRect...

IRECT SampleSquare1(0, 0, 5, 5);
pGraphics->DrawRect(&COLOR_WHITE, &SampleSquare1);

..no errors, but it doesnt show a white square in the upper left corner with size 5*5 px
jan hase is offline   Reply With Quote
Old 01-20-2018, 08:46 AM   #3
olilarkin
Human being with feelings
 
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
Default

if you need something in the gui to update regularly, the drawing should all be done in the main/ui thread. you do not "draw" from process replacing, although you can tell the control to update and flag it as dirty so it gets redrawn the next time the GUI draws

here you will find an example peak meter control that draws a filled rectangle

https://github.com/olilarkin/wdl-ol/...ontrols.h#L363

the value is set from process replacing here:

https://github.com/olilarkin/wdl-ol/...rgets.cpp#L206

in fact this peak meter control redraws at the frame rate set when the IGraphics object was created in the plug-in constructor

because the method IsDirty() has been overridden so that it always returns true

bool IsDirty() { return true;}
__________________
VirtualCZ | Endless Series | iPlug2 | Linkedin | Facebook
olilarkin is offline   Reply With Quote
Old 01-20-2018, 01:22 PM   #4
jan hase
Human being with feelings
 
Join Date: Jul 2017
Posts: 25
Default

awesome, that works, thank you!
jan hase 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 09:09 AM.


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