473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Bitmap or Image

Whats is there any reason to use a Bitmap(Image) over an Image(Bitmap)? I'm
making a container to hold bitmaps sorta like the ImageList class(that
doesn't fix the sizes) but I'm not sure if I should use Images or Bitmaps?
I don't know of the real distinction between them excep that the Bitmap
class allows you lower level access to the image data and stuff(but does it
come at a price)?

Thanks,
Jon
Oct 23 '06 #1
4 1630
Hi Jon,

Image is an abstract class, and the base class for MetaFile and Bitmap.

I'd use Bitmap as everything the Image can do, Bitmap can do as well.
Since Bitmap inherits from Image, all places expecting an Image object can
take a Bitmap object.
On Mon, 23 Oct 2006 05:28:20 +0200, Jon Slaughter
<Jo***********@Hotmail.comwrote:
Whats is there any reason to use a Bitmap(Image) over an Image(Bitmap)?
I'm
making a container to hold bitmaps sorta like the ImageList class(that
doesn't fix the sizes) but I'm not sure if I should use Images or
Bitmaps?
I don't know of the real distinction between them excep that the Bitmap
class allows you lower level access to the image data and stuff(but does
it
come at a price)?

Thanks,
Jon



--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 23 '06 #2
"Jon Slaughter" <Jo***********@Hotmail.comwrote in message
news:oF******************@newssvr13.news.prodigy.c om...
Whats is there any reason to use a Bitmap(Image) over an Image(Bitmap)?
I'm making a container to hold bitmaps sorta like the ImageList class(that
doesn't fix the sizes) but I'm not sure if I should use Images or Bitmaps?
I don't know of the real distinction between them excep that the Bitmap
class allows you lower level access to the image data and stuff(but does
it come at a price)?
Image is the base class and is inherited by Bitmap and Metafile. If you wish
to support both Bitmaps and Metafiles then use Image. If you only want to
use Bitmaps then use Bitmap, there won't be any overhead as the object will
be a bitmap anyway.

Michael
Oct 23 '06 #3
Well, Image is the abstract base class of Bitmap. Having a list of
Images does mean that theoretically you can handle /any/ Image
implementation, but there aren't many... in the core MS libraries this
is just Bitmap and Metafile (IIRC), although in reality Bitmap is by
far the more common. If you only need to handle Bitmap, then a list of
Bitmaps should be fine, and save some casting. If you don't need the
extra Bitmp properties, then use Image.
but does it come at a price
No; since Image is abstract, you cannot have just an Image; typically
you have a Bitmap, but treat it like the base Image; but it is still a
Bitmap ;-p. In terms of storage in your class, it is still just a
pointer to the heap, so identical.

Marc

Oct 23 '06 #4
Ok, Thanks guys. I would like to use both an image and metafile since it
offers a more robust solution. I play around with it and see what happens.
Basically I'm trying to setup a button that displays a user defined set of
images depending on the state. Obviously bitmaps are nice but not always
needed and vector graphics are simple and tend to offer an easier
implementation(such as what the OS already uses). It seems much easier just
to create teh metafile with some external program and load it instead of
using a bunch of graphics commands to draw it. (but I suppose I can just
keep a list of images that represent the state and draw them using DrawImage
and not worry to much about the underlying type)
Thanks,
Jon
Oct 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: CroDude | last post by:
Hi all! I have problems when writting bitmap to a byte array and after reading it back form byte to Bitmap object. What I do is this: First I throw Bitmap to a memory-stream and then I write it...
7
by: chuck | last post by:
I load a bitmap using GDI+ now, I want to collect all the pixel values, (in RGB but without the A component) onto a color array, say... dim btmp1(,) as color is there a method that can help me...
8
by: Nathan Sokalski | last post by:
I am trying to write code to rotate a graphic that I have. Here is the code I am currently using: Dim frogbitmap As New Bitmap(Drawing.Image.FromFile(Server.MapPath("images/frog.gif"))) Dim...
7
by: Fir5tSight | last post by:
Hi All, I used the following code in C#: using System.Drawing; //blah blah blah Bitmap bmp = new Bitmap();
1
by: Smokey Grindel | last post by:
I have a bitmap object I want to return as a JPEG image with a compression set at 90% and progressive passes enabled, how can I do this in .NET 2.0? Progressive passes are not necessary but the...
14
by: eliss.carmine | last post by:
I'm using TCP/IP to send a Bitmap object over Sockets. This is my first time using C# at all so I don't know if this is the "right" way to do it. I've already found out several times the way I was...
0
by: benfly08 | last post by:
Hi, guys. I have a program to draw bar/pie chart based on the data i hard coded in it. However, my image comes with "BLACK" background color. I don't know how to fix this. The code snippet is...
2
by: Tina | last post by:
I have a System.Drawing.Bitmap myImage; I also have a webcontrols.Image on my web page. I want to put the bitmap into the image but the image can only get it's bitmap from ImageURL which can be a...
5
by: stef | last post by:
hello I can find all kind of procedures to convert an array to a bitmap (wxPython, PIL), but I can't find the reverse, either - convert a bitmap to an array or - read a bitmap file to an...
2
by: Peter Oliphant | last post by:
The Image class allows loading a bitmap from a graphic file. So far I've gotten it to work with JPG and BMP files. What other graphic file formats are supported in this way? Is this fixed based...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.