I wonder whether it scales the filters. Go-go gadget "testbed" project...

... Time passes :)

At first glance, it seems that filters are applied after scaling, but stroke
widths don't get below 1 pixel:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
creationComplete="cc()">

    <mx:Script>
        <![CDATA[

            protected function cc() : void {

                drawIn(b1, 0xff);
                drawIn(b2, 0xffff);
                drawIn(b3, 0xffff00);
            }

            protected function drawIn(box : Canvas, bg : Number) : void {

                box.graphics.clear();

                box.graphics.moveTo(0,0);
                box.graphics.beginFill(bg,1);
                box.graphics.drawRect(0,0,100,100);
                box.graphics.endFill();

                box.graphics.moveTo(0,0);
                box.graphics.lineStyle(1,0,1);
                box.graphics.lineTo(100,100);

                box.graphics.moveTo(0,50);
                box.graphics.lineTo(100,50);

                box.graphics.moveTo(50,0);
                box.graphics.lineTo(50,100);
            }

        ]]>
    </mx:Script>

    <mx:Canvas horizontalCenter="0" verticalCenter="0" width="100"
height="100" id="b2">
        <mx:filters>
            <mx:DropShadowFilter alpha="0.8" blurX="0" blurY="0" angle="90"
distance="15"/>
        </mx:filters>
    </mx:Canvas>

    <mx:Canvas horizontalCenter="-120" verticalCenter="0" width="100"
height="100" id="b1">
        <mx:filters>
            <mx:DropShadowFilter alpha="0.8" blurX="0" blurY="0" angle="90"
distance="15"/>
        </mx:filters>
    </mx:Canvas>

    <mx:Canvas horizontalCenter="120" verticalCenter="0" width="100"
height="100" id="b3">
        <mx:filters>
            <mx:DropShadowFilter alpha="0.8" blurX="0" blurY="0" angle="90"
distance="15"/>
        </mx:filters>
    </mx:Canvas>

    <mx:Button label="Scale" horizontalCenter="0" verticalCenter="-80"
click="b1.scaleX=0.5;b1.scaleY=0.5;b3.scaleX=2;b3.scaleY=2"/>

</mx:Application>


On Wed, May 28, 2008 at 10:02 AM, Alex Harui <[EMAIL PROTECTED]> wrote:

>    I'm not sure what the player does for filtering.  I assume it draws
> offscreen and filters there so if you scale you still get highest fidelity
> drawing before scaling.
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Josh McDonald
> *Sent:* Tuesday, May 27, 2008 4:29 PM
>
> *To:* [email protected]
> *Subject:* Re: [flexcomponents] Fwd: Center/Shrink To Fit
>
>
>
> Shit I'm a jerk. I meant filters, my bad!
>
> -J
>
> On Wed, May 28, 2008 at 9:04 AM, Alex Harui <[EMAIL PROTECTED]> wrote:
>
> I think MOVE effects may use bitmap caching, but I don't think RESIZE does.
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Josh McDonald
> *Sent:* Tuesday, May 27, 2008 3:56 PM
>
>
> *To:* [email protected]
> *Subject:* Re: [flexcomponents] Fwd: Center/Shrink To Fit
>
>
>
> I thought any effect turns a "render as bitmap" internal flag on? I know
> I've put effects I didn't need on certain components that contained
> textFields that weren't behaving properly (such as the text ignoring .alpha
> and such).
>
> -J
>
> On Wed, May 28, 2008 at 1:06 AM, Alex Harui <[EMAIL PROTECTED]> wrote:
>
> I'll have to ask the player rendering guys for the exact answer.  I do know
> the player works in 20ths of a pixel, so that'd be my first guess.
>
>
>
> I'm not sure what you mean in the last question.  Effects or no effects,
> all transforms we do attempt to not use bitmaps (unless the raw data is a
> bitmap), in order to get highest-fidelity.
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Josh McDonald
> *Sent:* Monday, May 26, 2008 10:01 PM
>
>
> *To:* [email protected]
> *Subject:* Re: [flexcomponents] Fwd: Center/Shrink To Fit
>
>
>
> Yeah you're right, my bad :)
>
> As for scaling - I'm definitely not as knowledgeable as I'd like to be
> about what goes on (when dealing with non-bitmaps). What does flash do if
> you scale down rather than up? Does it scale drawing commands to sub-pixel
> values? What about stroke widths? Do they bottom out at say 1 or half a
> pixel? If you have an effect on your component, does it scale and then
> convert to bitmap?
>
> -J
>
> On Tue, May 27, 2008 at 2:39 PM, Alex Harui <[EMAIL PROTECTED]> wrote:
>
> I'm not sure you can get at _scaleX in the override.  I would override
> invalidateSize() and have it check a flag as to whether to call the default
> behavior.  That's what happens in ListBaseContentHolder.
>
>
>
> Going to bitmap will have smoothing problems when scaled, and take up much
> more memory in most cases.
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Josh McDonald
> *Sent:* Monday, May 26, 2008 9:37 PM
> *To:* [email protected]
> *Subject:* Re: [flexcomponents] Fwd: Center/Shrink To Fit
>
>
>
> That's a great idea Alex - subclass Canvas for your scaling child, and
> override set scaleX and set scaleY like so:
>
>     override public function set scaleX(value:Number):void
>     {
>         if (_scaleX == value)
>             return;
>
>         _scaleX = value;
>
>         invalidateProperties();
>         //invalidateSize();
>
>         dispatchEvent(new Event("scaleXChanged"));
>     }
>
> Although I think that will come back to bite you if you ever have something
> else that changes the scaleX or scaleY on that component, as your container
> probably won't be notified about the different size.
>
> Of course, if there's no interaction with the object you're trying to
> scale, I'd probably just render it to a bitmap and display that at whatever
> size you please. Seems less hacky.
>
> -J
>
> On Tue, May 27, 2008 at 2:02 PM, Alex Harui <[EMAIL PROTECTED]> wrote:
>
> One way is to block invalidateSize when scaling the child.  See
> ListBaseContentHolder
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Richard Rodseth
> *Sent:* Monday, May 26, 2008 12:09 PM
> *To:* [email protected]
> *Subject:* [flexcomponents] Fwd: Center/Shrink To Fit
>
>
>
> I haven't done any more work on this, but I thought I'd see if the
> smaller flexcomponents list had any advice for me. I'm thinking maybe
> I should emulate SWFLoader and use a DisplayObject as "content
> container". Advice appreciated.
>
> ---------- Forwarded message ----------
> From: Richard Rodseth <[EMAIL PROTECTED] <rrodseth%40gmail.com>>
> Date: Fri, May 23, 2008 at 5:00 PM
> Subject: Re: Center/Shrink To Fit
> To: [EMAIL PROTECTED] <flexcoders%40yahoogroups.com>
>
> Is there a way to set the scale of a component without triggering
> invalidateSize() ?
>
> My initial effort to create a "ScaleToFit" component involved setting
> scaleX and scaleY in updateDisplayList. But that results in some
> recursion. Perhaps this is the wrong place to set the scale.
>
> I notice that SWFLoader uses a DisplayObject as a content holder, but
> my attempts to cast "this" to DisplayObject before setting the
> property didn't help - the UIComponent version of "set scaleX" is
> still invoked.
>
> On Fri, May 23, 2008 at 7:37 AM, Richard Rodseth <[EMAIL 
> PROTECTED]<rrodseth%40gmail.com>>
> wrote:
> > I'm looking to find or create a component which would scale (not
> > resize) its contents smaller if they were larger than this component's
> > bounds, and center them if they're smaller. I could imagine
> > extensions to support "expand to fit" as well, but that's not needed
> > currently.
> >
> > The "contents" can be a single child if that helps, or the full child
> > list of a container. I've done a bit of custom component development,
> > but would appreciate any suggestions/pointers for this scenario.
> >
> > Thanks in advance.
> >
>
>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>
>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>
>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>
>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>
>  
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to