draw point

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi,
i want to draw every Xms some point to my background bitmap of my plugin , i think i check-out everything. I use sdk 2.0 with standard VST library

Im really helpless

in ADEitor.hpp

Code: Select all

class ADEditor : public AEffGUIEditor, public CControlListener 
{
...........
public:
 	void idle();
............	
private:
    CDrawContext *pcontext;
.........
};
in ADEitor.cpp

Code: Select all

........
void ADEditor::idle ()
{    
long x=150, y=20; 
CPoint p; 
CColor  greenColor = {0, 255, 0, 0}; 
pcontext = new CDrawContex(frame,NULL,systemWindow); 
AEffGUIEditor::idle (); 
pcontext->drawPoint(p(x,y), greenColor);
} 
.........
Thank you

Post

i can compile my program but i see no point...

Post

Dont you need to copy the context you created back to somewhere? Do you even need to create a new context?

Paul
__________________________
Paul Chana
Senior Software Engineer
FXpansion Audio UK Ltd

Post

i want to create new context (or use some else context) but important is, that i want in the idle() function draw some point and i dont know how
Thanks Jan

Post

jan.lux wrote:i want to create new context (or use some else context) but important is, that i want in the idle() function draw some point and i dont know how
Thanks Jan
I believe you need to setFrameColor(green) for the green to happen.


for Minion (free VST) here's how I made an offscreen context work in VSTGUI to draw the ball animation(warning - Im not very experienced at programming).

in the Idle function, I set my control (draw area) to be dirty (setDirty).

then in my controls draw function:

Code: Select all

COffscreenContext *oc = new COffscreenContext ( getParent (), XWidth, YHeight, kBlackCColor );  

then I draw stuff:

Code: Select all

oc->drawEllipse(Ball);
then copy the offscreen context:

Code: Select all

CRect recty (X, Y, X + XWidth, Y + YHeight);
oc->copyFrom (InContext, recty, ballp (0,0));      

Post

idle() doesn't provide you with a context to draw on.
you should write a CView and put your drawing code in

draw (CDrawContext *pContext);

then you just have to tell your CView to redraw() in idle().

Code: Select all

void CMdspGui::idle()
{
	AEffGUIEditor::idle();

	for(long i=0;i<(int)_views.size();i++)
	{
		_views[i]->redraw();
	}
}
also remeber that when using an offscreen context you have to shift your coordinate...
I've spent some time finding why my CView wasn't drawn at all or at the wrong place...

Code: Select all

	COffscreenContext *OSDC = new COffscreenContext(getParent (), size.width(), size.height(), _background);
	CRect totalRect(size); totalRect.offset(-size.left,-size.top);
	OSDC->setFillColor(_background);
	OSDC->fillRect(totalRect);
	OSDC->setFrameColor(_foreground);
	OSDC->drawRect(totalRect);
	OSDC->copyFrom(pContext,size,CPoint(0,0));
	delete OSDC;
	setDirty (false);

Post

Thank you for your quick answer,
mdsp wrote: void CMdspGui::idle()
{
AEffGUIEditor::idle();

for(long i=0;i<(int)_views.size();i++)
{
_views->redraw();
}
}


What do you mean with _views it this case?

Im not sure if i can use function setDirty(), because i work with VSTGUI 1.0 :? , in this case isn function setDirty() accesible

i can try maybe this?

Code: Select all

 dirty=false
Thanks for answer

Post

Thank you for your quick answer,

What do you mean with _views it this case?
it's just an array of the views that I have in my GUI. for convenience I use a std::vector<CView *> but you could just use a CView[]
Im not sure if i can use function setDirty(), because i work with VSTGUI 1.0 :? , in this case isn function setDirty() accesible
I don't know either, I'm using the VSTGUI that comes with VSTSDK 2.3 not the one on sourceforge.
i can try maybe this?

Code: Select all

 dirty=false
it's up to you.

Post

why don't you use the latest VST version?

Post

texture wrote:why don't you use the latest VST version?
why? there's, no real reason, it's just that I have the 2.3 SDK on my HD and that I haven't thought about updating the VSTGUI.

I've heard that png support and real alphablending is now possible.

what are the other new features compared to the old one?

BTW I'd like to have a try at wxWidget for VST, has anyone made it work?

Post

mdsp wrote:
texture wrote:why don't you use the latest VST version?
why? there's, no real reason, it's just that I have the 2.3 SDK on my HD and that I haven't thought about updating the VSTGUI.
It was directed at Jan.lux - he said he was using version 1.0 and does not have setDirty(). I wondered if he had a specific reason for using that version..

Post

Thanks lot for all answer guis
texture wrote: It was directed at Jan.lux - he said he was using version 1.0 and does not have setDirty(). I wondered if he had a specific reason for using that version..
Im now beginning in cerating of VST plugs. I began my first work with SDK 2.3 (i thing SDK 2.3 use VSTGUI 1.0 )


If i now copy new vstgui.h (from sourceforge) to my old project, this will take me lot of errors - some problem with the class AudioEffect.

In future i will starting in new project with the newest vstgui 8)

Post

IIRC SDK 2.3 uses VSTGUI 2.2 and has obviously setDirty()

Post

im sorry , maybe i called wrong the function setDirty() (and compiler sad me the function setDirty() is not accesible)

Post Reply

Return to “DSP and Plugin Development”