Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

How can i change a color value in a image object

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-10-2006   #1 (permalink)
=?Utf-8?B?VGhvbWFzIE11ZWxsZXI=?=
Guest


 

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?=
Guest


 

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==?=
Guest


 

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=?=
Guest


 

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
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't change Color of pages using color/appearance Nate Vista installation & setup 1 12-24-2007 12:27 AM
Toolbar Color Change? OCJedi Vista General 10 08-07-2007 12:12 PM
change tab color KittyJHG Vista General 1 03-19-2007 08:25 PM
change taskbar color Vista General 10 02-02-2007 12:37 PM
Canon Color Image Runner 3200 =?Utf-8?B?SlBAQU1Q?= Vista hardware & devices 0 09-25-2006 07:45 PM


Vistax64.com 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 2005-2008

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 47 48 49 50 51