Files
mono/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs
T
Miguel de Icaza 52bad3e3db In Short:
Updated System.Drawing, lots of cleanups.
	Added JPEG encoder/decoder back to Bitmap.
	We can load and save images again.
	Still need work to support all formats, everywhere
	PNG codec broken (but at least its plugged back).

2003-10-23  Miguel de Icaza  <[email protected]>

	* bitmap.c (GdipCreateBitmapFromScan0): Do not allocate buffer
	here, expect that our caller to allocate that.

	Do not compute the stride here, expect our caller to do this
	properly.

	* Use the Mono coding conventions.

2003-10-23  Miguel de Icaza  <[email protected]>

	* Image.cs: Kill the InternalImageInfo, everything is now done in
	terms of Image and BitmapData.

	* Rectangle.cs: Make this one also sequential, change from using
	Point + Size to use x, y, width, height;  So we can use GdiPlus.

	* gdipFunctions.cs (GdipBitmapLockBits): Remove the ref from the
	BitmapData class argument, and instead use the [In,Out]
	attributes, which will do struct marshalling on the fields.   Now
	we can use C#'s BitmapData directly to talk to Gdiplus.

	* gdipStructs.cs: Every internal structure that has to talk to
	Gdi+ is properly prefixed, to minimize the confussion.

	* Bitmap.cs Bitmap (int width, int height, PixelFormat format):
	Compute the stride here where we have the BPP information,
	allocate a buffer of the proper size, and pass this to
	GdipCreateBitmapFromScan0

	* Image.cs: Implement Dispose pattern.

2003-10-23  Miguel de Icaza  <[email protected]>

	* JPEGCodec.cs (JSAMPARRAY): Do not allocate memory here anymore,
	we will just have the JPEG library copy directly into our buffer.

	(Encode, Decode): Ported to the new model which avoid copies, and
	eliminates InternalImageInfo.

	TODO: need to port the PNG coder/decoder, and add support for RGBA
	images which got dropped from this version

	* BmpCodec.cs: Rework this one to use BitmapData and Image.  Do
	not use the RawBytes property, instead pull the data one line at a
	time, and write that out.

	* ImageCodecInfo.cs: Make the encoding and decoding delegates take
	a Image parameter;

	* BmpCodec.cs:

	* BitmapData.cs: Make this one sequential, and also mimic the
	layout of GdiPlus.h so we can use this instead of making copies
	back and forth.

svn path=/trunk/mcs/; revision=19354
2003-10-24 05:05:30 +00:00

83 lines
1.1 KiB
C#
Executable File

//
// System.Drawing.Imaging.BitmapData.cs
//
// Author:
// Miguel de Icaza ([email protected]
//
// (C) 2002 Ximian, Inc. http://www.ximian.com
//
using System;
using System.Runtime.InteropServices;
namespace System.Drawing.Imaging
{
[StructLayout(LayoutKind.Sequential)]
public sealed class BitmapData {
int width, height, stride;
PixelFormat pixel_format;
IntPtr address;
int reserved;
public int Height {
get {
return height;
}
set {
height = value;
}
}
public int Width {
get {
return width;
}
set {
width = value;
}
}
public PixelFormat PixelFormat {
get {
return pixel_format;
}
set {
pixel_format = value;
}
}
public int Reserved {
get {
return reserved;
}
set {
reserved = value;
}
}
public IntPtr Scan0 {
get {
return address;
}
set {
address = value;
}
}
public int Stride {
get {
return stride;
}
set {
stride = value;
}
}
}
}