Jules…don’t hate me, lol! Here’s the output of the sample program:
[attachment=0]stroke.png[/attachment]
And here is the code that generates it
#include "juce.h"
struct Panel : Component
{
~Panel() { deleteAllChildren(); }
void paint (Graphics& g)
{
g.setColour( Colours::grey );
g.fillAll();
int x=getWidth()/2;
int top=getHeight()/2-20;
int bottom=top+40;
Point<float> pt[6];
pt[0].setXY( x+1.5, top+17.5 );
pt[1].setXY( x+8.5, top+1.5 );
// these next two points form the messed up segment of the stroke
pt[2].setXY( x+8.5, top+0.5 );
pt[3].setXY( x-7.5, top+0.5 );
pt[4].setXY( x-7.5, top+1.5 );
pt[5].setXY( x-0.5, top+17.5 );
Path p;
p.startNewSubPath (pt[0].getX(), pt[0].getY());
for( int i=1; i<6; i++ )
p.lineTo (pt[i].getX(), pt[i].getY());
p.closeSubPath();
g.setColour (Colours::white);
g.fillPath (p);
g.fillPath (p,AffineTransform::translation(-24,0));
g.setColour (Colours::black);
g.strokePath (p, 1);
g.strokePath (p, 1, AffineTransform::translation(24,0));
}
};
struct MainWindow : DocumentWindow, Button::Listener
{
MainWindow()
: DocumentWindow (JUCE_T("Test")
, Colours::black
, DocumentWindow::allButtons
, true )
{
Panel* p = new Panel;
p->setSize( 512, 384 );
setContentComponent (p, true, true);
centreWithSize (getWidth(), getHeight());
setVisible( true );
}
~MainWindow() {}
void buttonClicked (Button* button)
{
Component* c = getContentComponent()->getChildComponent(1);
c->setVisible (true);
c->setTopLeftPosition (64, 64);
}
void closeButtonPressed() { JUCEApplication::quit(); }
};
struct MainApp : JUCEApplication
{
MainApp() : mainWindow(0) { s_app=this; }
~MainApp() { s_app=0; }
static MainApp& GetInstance() { return *s_app; }
const String getApplicationName() { return JUCE_T("JuceTest"); }
const String getApplicationVersion() { return JUCE_T("0.1.0"); }
bool moreThanOneInstanceAllowed() { return true; }
void anotherInstanceStarted (const String& commandLine) {}
void initialise (const String& commandLine)
{
mainWindow = new MainWindow;
}
void shutdown()
{
delete mainWindow;
}
static MainApp* s_app;
MainWindow* mainWindow;
};
MainApp* MainApp::s_app = 0;
START_JUCE_APPLICATION (MainApp)