![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |