How to cahnge pixel value with gray scale image?

D

Dev S Shrestha

I created a grayscale image

Bitmap img(320,240,PixelFormat8bppIndexed);

I want to set the BYTE values to each of the pixels using

img.SetPixel(x,y,v);

where v is a BYTE value between 0 and 255
It did not work.

Any solution?
 
T

Thomas Matthews

Dev said:
I created a grayscale image

Bitmap img(320,240,PixelFormat8bppIndexed);

I want to set the BYTE values to each of the pixels using

img.SetPixel(x,y,v);

where v is a BYTE value between 0 and 255
It did not work.

Any solution?

Yes, please post the smallest amount of compilable code
that demonstrates your issue. Please state the expected
behavior as well as the actual behavior. Do not attach
the code, just past it into your posting.

Please read the FAQ and Welcome.Txt below for instructions
on how to post.

One reason that your call:
img.SetPixel(x,y,v);
did not 'work' is because x, or y may be out of range.
There may be many other reasons too, but since you did
not post any code, the world will never know.

By the way, the C++ language does not have facilities
for bitmaps and pixels. You need to ask the experts
in a newsgroup about your compiler or platform. There
are many listed in the C++ FAQ and Welcome.TXT listed
below.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,592
Members
45,103
Latest member
VinaykumarnNevatia
Top