[sc-users] Drawing strings

Andre Bartetzki andre at bartetzki.de
Sun Dec 10 15:30:37 PST 2006



The String methods drawCenteredIn, drawLeftJustIn and drawRightJustIn don't
make use of the font and color args of drawAtPoint.
I think they should be therefore changed to:

    drawCenteredIn { arg inRect, font, color;
        this.drawAtPoint(this.bounds.centerIn(inRect), font, color);
    }
    drawLeftJustIn { arg inRect, font, color;
        var pos, bounds;
        bounds = this.bounds;
        pos = bounds.centerIn(inRect);
        pos.x = inRect.left + 2;
        this.drawAtPoint(pos, font, color);
    }
    drawRightJustIn { arg inRect, font, color;
        var pos, bounds;
        bounds = this.bounds;
        pos = bounds.centerIn(inRect);
        pos.x = inRect.right - 2 - bounds.width;
        this.drawAtPoint(pos, font, color);
    }


And consequently all related methods in Jpen.sc and and PenPlus.sc in
SwingOSC, like

*stringCenteredIn { arg str, inRect;
     ^str.drawCenteredIn( inRect);
    }

to

 *stringCenteredIn { arg str, inRect;
     ^str.drawCenteredIn( inRect, ~penFnt ?? Font.default,
                          ~colrFill ?? Color.black );
    }


h.h. ?




Andre


--------------------------------------------------
Andre Bartetzki 
http://www.bartetzki.de
mailto:andre at bartetzki.de

Tel   +49-(0)30-92375877
VoIP  +49-(0)30-38108677
Fax   +49-(0)30-38108678
UMS   +49-(0)941-599214065 (Voice, Fax, SMS)
Skype bartetzki

--------------------------------------------------




More information about the sc-users mailing list