HighTechTalks DotNet Forums  

Graphics object for 8 bit Bitmap?

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss Graphics object for 8 bit Bitmap? in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
chapmjw
 
Posts: n/a

Default Graphics object for 8 bit Bitmap? - 11-14-2006 , 05:20 PM







Is it possilbe to use the Graphics object for drawing onto a bitmap
that is 8bit greyscale or 8bit indexed color.
My application has to create a huge bitmap and I need it as small as
possible.

Has anyone got a suggestion better than creating my own drawing
functions and drawing onto a byte array?
thanks
jim


Reply With Quote
  #2  
Old   
Michael Phillips, Jr.
 
Posts: n/a

Default Re: Graphics object for 8 bit Bitmap? - 11-14-2006 , 05:31 PM






Per the MSDN documentation, you cannot create a Graphics object from an
indexed bitmap.

You can use GDI. Create your 8 bpp bitmap as a DIB (i.e., CreateDIBSection)
and use BitBlt or any of the GDI variations to draw to your 8bpp bitmap.

"chapmjw" <chapmjw (AT) gmail (DOT) com> wrote

Quote:
Is it possilbe to use the Graphics object for drawing onto a bitmap
that is 8bit greyscale or 8bit indexed color.
My application has to create a huge bitmap and I need it as small as
possible.

Has anyone got a suggestion better than creating my own drawing
functions and drawing onto a byte array?
thanks
jim




Reply With Quote
  #3  
Old   
Ziad Elmalki
 
Posts: n/a

Default Re: Graphics object for 8 bit Bitmap? - 12-17-2006 , 01:57 AM




Here is a good article on creating 8bit bitmaps in C#. You cannot use the graphics object and have to use lock and unlock methods or create a byte array and use the overloaded bitmap constructor that takes the pointer to the byte array.

http://www.iter.dk/dotnet/image/
---
Posted via DotNetSlackers.com

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.