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 - How can i change a color value in a image object

 
 
Old 07-10-2006   #1 (permalink)
=?Utf-8?B?VGhvbWFzIE11ZWxsZXI=?=


 
 

How can i change a color value in a image object

Hi @all,

i have in my project a lot of image objects. i becam the image object from a
resource dictionary. I get the image object of a resource Dictionary. My goal
is it, that i change all blue regions in the image object to yellow or green.
How can i do this with an image object from namespace System.Windows.Controls?

Thanks for all answers

TOM_MUE
www.tom-mue.de

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


 
 

RE: How can i change a color value in a image object

You can use image effects to do it, but you may have to create your own.
There may be an SDK sample on this now for June CTP...not sure.

If you do have to use a custom image effect, it's a C++ thing...just FYI.
It's also a software thing too. So, you'll want to be careful with perf
during animations of image effects. I think for V2, ImageEffects will be in
hardware.

"Thomas Mueller" wrote:

> Hi @all,
>
> i have in my project a lot of image objects. i becam the image object from a
> resource dictionary. I get the image object of a resource Dictionary. My goal
> is it, that i change all blue regions in the image object to yellow or green.
> How can i do this with an image object from namespace System.Windows.Controls?
>
> Thanks for all answers
>
> TOM_MUE
> www.tom-mue.de

My System SpecsSystem Spec
Old 07-10-2006   #3 (permalink)
=?Utf-8?B?QnJhbmRvbiBGdXJ0d2FuZ2xlcg==?=


 
 

RE: How can i change a color value in a image object

I see in .Net Reflector that a WriteableBitmap class exists. Might be worth
a look.

Otherwise it looks like using a combination of CopyPixels and Create on a
BitmapSource should allow you to examine the pixel values and replace
whatever colors you desire.

"Thomas Mueller" wrote:

> Hi @all,
>
> i have in my project a lot of image objects. i becam the image object from a
> resource dictionary. I get the image object of a resource Dictionary. My goal
> is it, that i change all blue regions in the image object to yellow or green.
> How can i do this with an image object from namespace System.Windows.Controls?
>
> Thanks for all answers
>
> TOM_MUE
> www.tom-mue.de

My System SpecsSystem Spec
Old 07-11-2006   #4 (permalink)
=?Utf-8?B?VGhvbWFzIE11ZWxsZXI=?=


 
 

RE: How can i change a color value in a image object

hello Brandon and TheRHouge,

Sorry for my late recall and Thanks for all answers. But the answers help me
not.

I think, i have not correctly described my situation. ok here is a new
attempt:

I have a simple XAML- Window Application. The project has also a resource
dictionary file with the name "MyIcons". This resource dictionary is linked
in my window1.xaml with the folowing code:

<Window.Resources>
<ResourceDictionary Source="MyIcons.xaml"/>
</Window.Resources>

in the resource dictionary i have a image draw object that i have exportet
from the expression graphic designer. It is a simple rectangle and the
rectangle contains a circle. the xaml from the image is here

<DrawingImage x:Key="RectImage">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Geometry="F1 M 215.333,207.333L 551.333,207.333L
551.333,400.667L 215.333,400.667L 215.333,207.333 Z ">
<GeometryDrawing.Pen>
<Pen Thickness="1.63255" StartLineCap="Round" EndLineCap="Round"
LineJoin="Round" Brush="#FF000000"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Brush>
<!-- Unnamed_gradient_137 -->
<LinearGradientBrush StartPoint="4.51935e-008,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#FFFFFFFF" Offset="0.005618"/>
<GradientStop Color="#FF8A8A8A" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>

<GeometryDrawing Brush="Red" Geometry="F1 M 380,242C 414.978,242
443.333,270.654 443.333,306C 443.333,341.346 414.978,370 380,370C 345.022,370
316.667,341.346 316.667,306C 316.667,270.654 345.022,242 380,242 Z ">
<GeometryDrawing.Pen>
<Pen Thickness="1.63255" StartLineCap="Round" EndLineCap="Round"
LineJoin="Round" Brush="#FF000000"/>
</GeometryDrawing.Pen>
</GeometryDrawing>

</DrawingGroup.Children>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>

Now i define a image object in the xaml from window1 and set the source of
the key to my drawing image in the resource dictionary. the key is
"RectImage". here is the code:

<Image Source="{DynamicResource RectImage}" />

this works fine. my goal is it now, that i can change the brush from the
last geometry object (the circle object) in the drawing image object. when
you look in the code from the drawing image, you will see the brush is in the
default Red. I will change the brush to green from the code behind or per
tricker an setter in the XAML.

How can i do this?

Thanks for all answers
TOM_MUE
www.tom-mue.de


"Brandon Furtwangler" wrote:

> I see in .Net Reflector that a WriteableBitmap class exists. Might be worth
> a look.
>
> Otherwise it looks like using a combination of CopyPixels and Create on a
> BitmapSource should allow you to examine the pixel values and replace
> whatever colors you desire.
>
> "Thomas Mueller" wrote:
>
> > Hi @all,
> >
> > i have in my project a lot of image objects. i becam the image object from a
> > resource dictionary. I get the image object of a resource Dictionary. My goal
> > is it, that i change all blue regions in the image object to yellow or green.
> > How can i do this with an image object from namespace System.Windows.Controls?
> >
> > Thanks for all answers
> >
> > TOM_MUE
> > www.tom-mue.de

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
changes in color in image program Virtual PC
HELP with color change!!!!!! General Discussion
Can't change Color of pages using color/appearance Vista installation & setup
change tab color Vista General
Canon Color Image Runner 3200 Vista hardware & devices


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