Windows Vista Forums
Vista Forums Home Join Vista Forums Donate 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

BitmapFrame GetPixel/SetPixel

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-10-2006   #1 (permalink)
StefanT
Guest


 

BitmapFrame GetPixel/SetPixel

Hi all,

is there any way to get or set the color pixel for an instance of
BitmapFrame, or shall I use the Bitmap class ?
In GDI+ the bitmap class have a GetPixel and SetPixel.

Best regards,
Stefan

My System SpecsSystem Spec
Old 01-10-2006   #2 (permalink)
robertwl@nospam.microsoft.com
Guest


 

re: BitmapFrame GetPixel/SetPixel

The only way to do this is to:
1. CopyPixels into an array (of bytes or ints or floats, depending on the pixel format you're interested in)
2. update the pixels
3. use BitmapSource.Create to create a new BitmapSource

Robert.

-----Original Message-----
From: stefan_tabaranu
Posted At: Monday, January 09, 2006 6:30 AM
Posted To: microsoft.public.windows.developer.winfx.avalon
Conversation: BitmapFrame GetPixel/SetPixel
Subject: BitmapFrame GetPixel/SetPixel


Hi all,

is there any way to get or set the color pixel for an instance of
BitmapFrame, or shall I use the Bitmap class ?
In GDI+ the bitmap class have a GetPixel and SetPixel.

Best regards,
Stefan
My System SpecsSystem Spec
Old 01-10-2006   #3 (permalink)
StefanT
Guest


 

re: BitmapFrame GetPixel/SetPixel

Yap, that's it, I manage to set the color pixel, thx a lot.

Another question, for animated gif we can use GifBitmapEncoder and I can add
frames. Is there any way to set the opacity of the frame, how much time a
frame is displayed, looping ...

Best regards,
Stefan

"robertwl@nospam.microsoft.com" wrote:

> The only way to do this is to:
> 1. CopyPixels into an array (of bytes or ints or floats, depending on the pixel format you're interested in)
> 2. update the pixels
> 3. use BitmapSource.Create to create a new BitmapSource
>
> Robert.
>
> -----Original Message-----
> From: stefan_tabaranu
> Posted At: Monday, January 09, 2006 6:30 AM
> Posted To: microsoft.public.windows.developer.winfx.avalon
> Conversation: BitmapFrame GetPixel/SetPixel
> Subject: BitmapFrame GetPixel/SetPixel
>
>
> Hi all,
>
> is there any way to get or set the color pixel for an instance of
> BitmapFrame, or shall I use the Bitmap class ?
> In GDI+ the bitmap class have a GetPixel and SetPixel.
>
> Best regards,
> Stefan
>

My System SpecsSystem Spec
Old 01-10-2006   #4 (permalink)
robertwl@nospam.microsoft.com
Guest


 

re: BitmapFrame GetPixel/SetPixel

If you're using the RenderTargetBitmap approach to creating frames of a GIF, then you can use the VisualOpacity and/or VisualOpacityMask properties on Visual.

Is that what you're looking to do?

Cheers,

Robert.

-----Original Message-----
From: stefan_tabaranu
Posted At: Monday, January 09, 2006 8:26 AM
Posted To: microsoft.public.windows.developer.winfx.avalon
Conversation: BitmapFrame GetPixel/SetPixel
Subject: re: BitmapFrame GetPixel/SetPixel


Yap, that's it, I manage to set the color pixel, thx a lot.

Another question, for animated gif we can use GifBitmapEncoder and I can add
frames. Is there any way to set the opacity of the frame, how much time a
frame is displayed, looping ...

Best regards,
Stefan

"robertwl@nospam.microsoft.com" wrote:

> The only way to do this is to:
> 1. CopyPixels into an array (of bytes or ints or floats, depending on the pixel format you're interested in)
> 2. update the pixels
> 3. use BitmapSource.Create to create a new BitmapSource
>
> Robert.
>
> -----Original Message-----
> From: stefan_tabaranu
> Posted At: Monday, January 09, 2006 6:30 AM
> Posted To: microsoft.public.windows.developer.winfx.avalon
> Conversation: BitmapFrame GetPixel/SetPixel
> Subject: BitmapFrame GetPixel/SetPixel
>
>
> Hi all,
>
> is there any way to get or set the color pixel for an instance of
> BitmapFrame, or shall I use the Bitmap class ?
> In GDI+ the bitmap class have a GetPixel and SetPixel.
>
> Best regards,
> Stefan
>

My System SpecsSystem Spec
Old 01-10-2006   #5 (permalink)
StefanT
Guest


 

re: BitmapFrame GetPixel/SetPixel

Thx a lot Robert for you help, you really help me a lot.

When I try to create animated gifs in Photoshop you can set properties for
each frame in the gif. Properties like how much time a frame is dispayed,
opacity of the frame. I need something at level frame.

Best regards,
Stefan

"robertwl@nospam.microsoft.com" wrote:

> If you're using the RenderTargetBitmap approach to creating frames of a GIF, then you can use the VisualOpacity and/or VisualOpacityMask properties on Visual.
>
> Is that what you're looking to do?
>
> Cheers,
>
> Robert.
>
> -----Original Message-----
> From: stefan_tabaranu
> Posted At: Monday, January 09, 2006 8:26 AM
> Posted To: microsoft.public.windows.developer.winfx.avalon
> Conversation: BitmapFrame GetPixel/SetPixel
> Subject: re: BitmapFrame GetPixel/SetPixel
>
>
> Yap, that's it, I manage to set the color pixel, thx a lot.
>
> Another question, for animated gif we can use GifBitmapEncoder and I can add
> frames. Is there any way to set the opacity of the frame, how much time a
> frame is displayed, looping ...
>
> Best regards,
> Stefan
>
> "robertwl@nospam.microsoft.com" wrote:
>
> > The only way to do this is to:
> > 1. CopyPixels into an array (of bytes or ints or floats, depending on the pixel format you're interested in)
> > 2. update the pixels
> > 3. use BitmapSource.Create to create a new BitmapSource
> >
> > Robert.
> >
> > -----Original Message-----
> > From: stefan_tabaranu
> > Posted At: Monday, January 09, 2006 6:30 AM
> > Posted To: microsoft.public.windows.developer.winfx.avalon
> > Conversation: BitmapFrame GetPixel/SetPixel
> > Subject: BitmapFrame GetPixel/SetPixel
> >
> >
> > Hi all,
> >
> > is there any way to get or set the color pixel for an instance of
> > BitmapFrame, or shall I use the Bitmap class ?
> > In GDI+ the bitmap class have a GetPixel and SetPixel.
> >
> > Best regards,
> > Stefan
> >

>

My System SpecsSystem Spec
Old 01-10-2006   #6 (permalink)
StefanT
Guest


 

re: BitmapFrame GetPixel/SetPixel

Robert is possible to add metadata to a gif file and after that to be able to
get metadata. I want to sign the gif file with a RSA algorithm, I can sign
the file if I put an extra frame in gif but I had to hide the frame from
being displayed and at this moment I don't know how to to that.

If it's possible to get or set some metadata in the gif file my problem is
solved, I only find a Power Point presentation on Internet from PDC with a
small sample about how to retrive the metadata.

Best regards,
Stefan

"StefanT" wrote:

> Thx a lot Robert for you help, you really help me a lot.
>
> When I try to create animated gifs in Photoshop you can set properties for
> each frame in the gif. Properties like how much time a frame is dispayed,
> opacity of the frame. I need something at level frame.
>
> Best regards,
> Stefan
>
> "robertwl@nospam.microsoft.com" wrote:
>
> > If you're using the RenderTargetBitmap approach to creating frames of a GIF, then you can use the VisualOpacity and/or VisualOpacityMask properties on Visual.
> >
> > Is that what you're looking to do?
> >
> > Cheers,
> >
> > Robert.
> >
> > -----Original Message-----
> > From: stefan_tabaranu
> > Posted At: Monday, January 09, 2006 8:26 AM
> > Posted To: microsoft.public.windows.developer.winfx.avalon
> > Conversation: BitmapFrame GetPixel/SetPixel
> > Subject: re: BitmapFrame GetPixel/SetPixel
> >
> >
> > Yap, that's it, I manage to set the color pixel, thx a lot.
> >
> > Another question, for animated gif we can use GifBitmapEncoder and I can add
> > frames. Is there any way to set the opacity of the frame, how much time a
> > frame is displayed, looping ...
> >
> > Best regards,
> > Stefan
> >
> > "robertwl@nospam.microsoft.com" wrote:
> >
> > > The only way to do this is to:
> > > 1. CopyPixels into an array (of bytes or ints or floats, depending on the pixel format you're interested in)
> > > 2. update the pixels
> > > 3. use BitmapSource.Create to create a new BitmapSource
> > >
> > > Robert.
> > >
> > > -----Original Message-----
> > > From: stefan_tabaranu
> > > Posted At: Monday, January 09, 2006 6:30 AM
> > > Posted To: microsoft.public.windows.developer.winfx.avalon
> > > Conversation: BitmapFrame GetPixel/SetPixel
> > > Subject: BitmapFrame GetPixel/SetPixel
> > >
> > >
> > > Hi all,
> > >
> > > is there any way to get or set the color pixel for an instance of
> > > BitmapFrame, or shall I use the Bitmap class ?
> > > In GDI+ the bitmap class have a GetPixel and SetPixel.
> > >
> > > Best regards,
> > > Stefan
> > >

> >

My System SpecsSystem Spec
Old 01-11-2006   #7 (permalink)
Joh
Guest


 

re: BitmapFrame GetPixel/SetPixel

I think it's awfully inefficient way to modify one or a few pixels of a large
bitmap.
Do you have any plan to support more efficient way of bitmap modification
such as direct access to the bitmap buffer?

Jake

"robertwl@nospam.microsoft.com" wrote:

> The only way to do this is to:
> 1. CopyPixels into an array (of bytes or ints or floats, depending on the pixel format you're interested in)
> 2. update the pixels
> 3. use BitmapSource.Create to create a new BitmapSource
>
> Robert.
>
> -----Original Message-----
> From: stefan_tabaranu
> Posted At: Monday, January 09, 2006 6:30 AM
> Posted To: microsoft.public.windows.developer.winfx.avalon
> Conversation: BitmapFrame GetPixel/SetPixel
> Subject: BitmapFrame GetPixel/SetPixel
>
>
> Hi all,
>
> is there any way to get or set the color pixel for an instance of
> BitmapFrame, or shall I use the Bitmap class ?
> In GDI+ the bitmap class have a GetPixel and SetPixel.
>
> Best regards,
> Stefan
>

My System SpecsSystem Spec
Old 01-11-2006   #8 (permalink)
Drew Marsh
Guest


 

re: BitmapFrame GetPixel/SetPixel

Joh wrote:

> I think it's awfully inefficient way to modify one or a few pixels of
> a large
> bitmap.
> Do you have any plan to support more efficient way of bitmap
> modification
> such as direct access to the bitmap buffer?


It's probably because of the underlying architecture. If I'm not mistaken,
when working with GPUs, you have to transfer the data out of system memory
across to the GPUs memory. Therefore you cannot share the buffer. Graphics
programming gurus feel free to correct me if I'm wrong.

HTH,
Drew


My System SpecsSystem Spec
Old 01-11-2006   #9 (permalink)
robertwl@nospam.microsoft.com
Guest


 

re: BitmapFrame GetPixel/SetPixel

GDI+ was a bit different in the sense that the Bitmap object was always cached in memory, so having a SetPixel method made sense. However, this may not be the case in WPF. For applications that do not wish to load the entire image in memory, WPF provides a way to load the image such that it is read from disk on a per-demand basis. In this case, a SetPixel equivalent does not make much sense and would not work. Thus we have chosen to not include this functionality for V1 and will consider such an API for future version.

Robert.

-----Original Message-----
From: Drew Marsh
Posted At: Tuesday, January 10, 2006 3:02 PM
Posted To: microsoft.public.windows.developer.winfx.avalon
Conversation: BitmapFrame GetPixel/SetPixel
Subject: re: BitmapFrame GetPixel/SetPixel


Joh wrote:

> I think it's awfully inefficient way to modify one or a few pixels of
> a large
> bitmap.
> Do you have any plan to support more efficient way of bitmap
> modification
> such as direct access to the bitmap buffer?


It's probably because of the underlying architecture. If I'm not mistaken,
when working with GPUs, you have to transfer the data out of system memory
across to the GPUs memory. Therefore you cannot share the buffer. Graphics
programming gurus feel free to correct me if I'm wrong.

HTH,
Drew
My System SpecsSystem Spec
Old 01-11-2006   #10 (permalink)
StefanT
Guest


 

re: BitmapFrame GetPixel/SetPixel

Anyway I used the scheme described by Robert with CopyPixels and it's working
just fine.

The Bitmap class had those methods SetPixel(x,y,color), GetPixel(x,y) and
with GDI+ is relative simple to change pixels colors.

Best regards,
Stefan

"Joh" wrote:

> I think it's awfully inefficient way to modify one or a few pixels of a large
> bitmap.
> Do you have any plan to support more efficient way of bitmap modification
> such as direct access to the bitmap buffer?
>
> Jake
>
> "robertwl@nospam.microsoft.com" wrote:
>
> > The only way to do this is to:
> > 1. CopyPixels into an array (of bytes or ints or floats, depending on the pixel format you're interested in)
> > 2. update the pixels
> > 3. use BitmapSource.Create to create a new BitmapSource
> >
> > Robert.
> >
> > -----Original Message-----
> > From: stefan_tabaranu
> > Posted At: Monday, January 09, 2006 6:30 AM
> > Posted To: microsoft.public.windows.developer.winfx.avalon
> > Conversation: BitmapFrame GetPixel/SetPixel
> > Subject: BitmapFrame GetPixel/SetPixel
> >
> >
> > Hi all,
> >
> > is there any way to get or set the color pixel for an instance of
> > BitmapFrame, or shall I use the Bitmap class ?
> > In GDI+ the bitmap class have a GetPixel and SetPixel.
> >
> > Best regards,
> > Stefan
> >

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista and GDI's SetPixel MueMeister Vista General 2 02-26-2008 01:35 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