Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - BitmapEffect affected by use inside VisualBrush?

 
 
Old 07-26-2006   #1 (permalink)
=?Utf-8?B?QXZlcnkgWg==?=


 
 

BitmapEffect affected by use inside VisualBrush?

Hi,

I have a canvas which houses a texblock which has an OuterGlow bitmapeffect
applied to it. When the canvas is displayed directly, the bitmap effect
behaves exactly as expected - but when it is used as a VisualBrush the
bitmapeffect goes crazy!

I've taken a side by side screenshot of the problem in action which can be
found at:
http://averymax.com/bitmapeffectcrazy.jpg

So are bitmapeffects affected by somethign like being used inside a
visualbrush, or is this particular case some sort of fluke?

Thanks,
Avery

My System SpecsSystem Spec
Old 07-26-2006   #2 (permalink)
=?Utf-8?B?UmFodWwgUGF0aWw=?=


 
 

RE: BitmapEffect affected by use inside VisualBrush?

Avery,
From the screenshot, it seems that the GlowSize property of the
OuterGlowBitmapEffect is scaled up. To be sure, I'd love to take a look at
any code you might have for this i.e. How is the VisualBrush being used?

Basically, when you use a VisualBrush (say as a background of a Panel), the
VisualBrush stretches to fill. When this stretches, effects interpret the
stretch as a scale transform to be applied.

For example, when you use an OuterGlowBitmapEffect on a Button, and the
button is Scaled up using a ScaleTransform, then a user would expect the
OuterGlowBitmapEffect.GlowSize to increase proportionally to the scale. This
is true for other effects as well (DropShadow, Blur etc i.e. you would want a
scaled Button to look as blurry as a regular button ). The BitmapEffect
properties are not really aware of what a scale means. Hence, we internally
interpret scale transforms and scale interesting properties (like GlowSize,
Blur's Radius, DropShadow's ShadowDepth) .

Given the abvove user scenario, the above solution is only a best-effort and
unclear when we have to deal with non-uniform scaling (because properties
themselves are scale agnostic). And that is what I suspect is the issue in
your scenario (i.e. non-uniform scaling).

You can notice what I am trying to say using the XAML below. If you use
WrapPanel's Width : Height ratio same as the Button's Width:Height ratio, you
see consistent scaling. However, if you set WrapPanel Width=Height, you will
notice the behavior described in your screenshot.

<WrapPanel Width="400" Height="100"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<WrapPanel.Background>
<VisualBrush>
<VisualBrush.Visual>
<Canvas Background="LightBlue" >
<Button Width="200" Height="50" Content="BitmapEffect" FontSize="35" >
<Button.BitmapEffect>
<OuterGlowBitmapEffect GlowColor="red"/>
</Button.BitmapEffect>
</Button>
</Canvas >
</VisualBrush.Visual>
</VisualBrush>
</WrapPanel.Background>
</WrapPanel>

Thanks!
Rahul Patil [MSFT]


"Avery Z" wrote:

> Hi,
>
> I have a canvas which houses a texblock which has an OuterGlow bitmapeffect
> applied to it. When the canvas is displayed directly, the bitmap effect
> behaves exactly as expected - but when it is used as a VisualBrush the
> bitmapeffect goes crazy!
>
> I've taken a side by side screenshot of the problem in action which can be
> found at:
> http://averymax.com/bitmapeffectcrazy.jpg
>
> So are bitmapeffects affected by somethign like being used inside a
> visualbrush, or is this particular case some sort of fluke?
>
> Thanks,
> Avery

My System SpecsSystem Spec
 

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46