So, I haven't quite figured it out, but I think I am getting closer. It is
possible, the math is just a bit beyond my normal skills so it may take some
more time.

Thanks for asking about this. I have always wanted to have inner strokes and
strokes that don't overlap. You asking just pushed me to work on it.

I hate the getBounds() when you have a shape with a stroke.

Best,
Ktu

On Tue, Apr 13, 2010 at 3:13 PM, Ktu <ktu_fl...@cataclysmicrewind.com>wrote:

> I think the static method would work if I were just doing rectangles, but
> with lineTo, curveTo I think it needs to be an object.
>
> A new thought that occurred to me: Have an object that will have a fill
> sprite and a stroke sprite, separate from each other. Then if you call
> lineStyle() with the inner:Boolean = true anytime you call a drawing command
> it would draw a stroke in the stroke Sprite but offset all the values so the
> stroke is inside. If you specify overlap:Boolean = false; then the object
> would compensate so that the stroke does not overlap the fill.
>
> It may work, but it would only really work if lineStyle pixelHinting =
> true, and better still, if I forced all values to be int. There's no reason
> for it not to be anyway.
>
> Does that make sense?
>
> Ktu
>
> On Tue, Apr 13, 2010 at 2:40 PM, Latcho <spamtha...@gmail.com> wrote:
>
>> Thanks for thinking out loud :)
>> Can do that too if I need it. But if you ever write something generic I'd
>> love to use / see it because I don't have the time for this now.
>> Personally I wouldn't extend directly on shape but create some static
>> methods like
>> GraphicsInnerStroke.drawRect(myDispObj.graphics, linestyleObject, method
>> arguments );
>>
>> Cheers,
>> Latcho
>>
>>
>> atm the best thing I can come up with is an object that can recreate the
>> draw methods, assuming that you want a stroke on it. If I am just going to
>> stick with drawRect, drawRoundRect, and drawRoundRectComplex I can do that.
>> Looking into 'drawing' an inner stroke when using lineTo curveTo etc and
>> other draw commands will take a bit more work and time.
>>
>> I kind of feel like it might end up being InnerStroke extends Shape, and
>> creating public methods that are 'override's of the graphics drawing api.
>> Just thoughts out loud.
>>
>> Ktu
>>
>> On Tue, Apr 13, 2010 at 12:09 PM, Latcho <spamtha...@gmail.com <mailto:
>> spamtha...@gmail.com>> wrote:
>>
>>
>>
>>   Hi Ktu,
>>   Thanks for your supportive emails.
>>   I'm not a newbie but I thought I might have missed something on the
>>   API that wasn't apparent in the as3 docs.
>>
>>   It sucks to have it confirmed it isn't supported :)
>>   The thing is I want to stay as close to the original api as possible
>>   preferably without wrappers (we're not only talking about rects but
>>   also curved shapes are possible you see...). Though I'd be happy to
>>   see what you're take on it looks like :)
>>
>>   Thanks,
>>   Latcho
>>
>>
>>   On 13-04-10 16:59, Ktu wrote:
>>
>>        >From my experience, there is no API support for it. It sucks I
>>       know. I deal with this problem all the time.
>>
>>       For transparency, the beginFill(color:uint, alpha:Number); you
>>       can specify alpha. With the system I have shown you, the stroke
>>       would be transparent over top of the original color, so a red
>>       square with a semi transparent blue border would produce purple
>>       as your border.
>>
>>       If you want the stroke to be unaffected by the inside square it
>>       wouldn't be that hard to write a class to handle that. In fact,
>>       I use this so often I think I will do that.
>>
>>       I should be able to finish by Thursday at the latest and I'll
>>       share when I'm done. If you are eager for it, the idea would be
>>       to have build an object, that you would specify dimensions for,
>>       and fill color and alpha, and also the border fill and alpha,
>>       then when it draws the rectangle, it incorporates the stroke
>>       width into consideration so that there are no graphics behind it.
>>
>>       Ktu
>>
>>       On Tue, Apr 13, 2010 at 7:50 AM, spank man <spamtha...@gmail.com
>>       <mailto:spamtha...@gmail.com> <mailto:spamtha...@gmail.com
>>
>>       <mailto:spamtha...@gmail.com>>> wrote:
>>
>>           nice and simple sollution,
>>           but not so fine if you want the inner to be semi-transparent....
>>           Other ideas ? So no API support on this ?
>>
>>
>>           On Tue, Apr 13, 2010 at 4:11 AM, Ktu
>>       <ktu_fl...@cataclysmicrewind.com
>>       <mailto:ktu_fl...@cataclysmicrewind.com>
>>       <mailto:ktu_fl...@cataclysmicrewind.com
>>       <mailto:ktu_fl...@cataclysmicrewind.com>>> wrote:
>>
>>               When I want inside borders I do this:
>>
>>
>>               var spr:Sprite = new Sprite();
>>               addChild(spr);
>>               var g:Graphics = spr.graphics;
>>               g.beginFill(0xFF45A3);
>>
>>               g.drawRect(0, 0, 100, 100);
>>               g.endFill();
>>               drawInsideStroke(g, 0, 0, 100, 100, 1, 0x32010B);
>>
>>               function drawInsideStroke(graphics:Graphics, x:int, y:int,
>>               width:int, height:int, thickness:int = 1, color:uint =
>>       0x000000) {
>>                   graphics.endFill(); // for good measure, but maybe not?
>>                   graphics.beginFill(color);
>>                   graphics.drawRect(x, y, width, height);
>>                   graphics.drawRect( x + thickness, y + thickness, width -
>>               (thickness * 2), height - (thickness * 2) );
>>                   graphics.endFill();
>>
>>               }
>>               trace(spr.width,spr.height);  // -> 110 110
>>               trace(spr.getBounds(this)) // -> (x=-5, y=-5, w=110, h=110)
>>
>>
>>               On Mon, Apr 12, 2010 at 7:14 PM, Latcho
>>       <spamtha...@gmail.com <mailto:spamtha...@gmail.com>
>>       <mailto:spamtha...@gmail.com <mailto:spamtha...@gmail.com>>> wrote:
>>
>>                   Hello,
>>                   Something i still can't solve is that when drawing for
>>                   example a rect in a Shape graphics object with a fat
>>                   lineStyle, the line drawn is always half it's
>>       thicknes in
>>                   the inner part of the rect and half outside; This always
>>                   gives me headaches  when aligning, measuring,
>>         skinning or
>>                   bitmapping stuff since half the line is in the
>>       negative x
>>                   / y coordinate space of the shape..
>>                   I know that I can use the getBounds method to get me the
>>                   accurate  negative x and y offset of the (line)
>>       graphics,
>>                   but what I really want is to have the line beign drawn
>>                   totally within the rect. Is that possible by the default
>>                   graphics api ? Then please expand on my example.
>>
>>                   Thanks.
>>                   Latcho.
>>
>>
>>                   var spr:Sprite = new Sprite();
>>                   addChild(spr);
>>                   var g:Graphics = spr.graphics;
>>                   g.lineStyle(10,0xff0000);
>>                   g.beginFill(0x0000ff);
>>                   g.drawRect(0,0,100,100);
>>                   g.endFill();
>>                   trace(spr.width,spr.height);  // -> 110 110
>>                   trace(spr.getBounds(this)) // -> (x=-5, y=-5, w=110,
>>       h=110)
>>
>>                   _______________________________________________
>>                   Flashcoders mailing list
>>       Flashcoders@chattyfig.figleaf.com
>>       <mailto:Flashcoders@chattyfig.figleaf.com>
>>       <mailto:Flashcoders@chattyfig.figleaf.com
>>       <mailto:Flashcoders@chattyfig.figleaf.com>>
>>
>>       http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>
>>
>>
>>
>>
>>   _______________________________________________
>>   Flashcoders mailing list
>>   Flashcoders@chattyfig.figleaf.com
>>   <mailto:Flashcoders@chattyfig.figleaf.com>
>>   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to