mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 17:02:10 -10:00
reading bmp files is not yet implemented, and only png files can be written. Support for the rest will show up in the next few days. * gdipFunctions.cs: Added stream delegate helpers for stream loading/saving on linux * Image.cs, Bitmap.cs: Converted to call into GDIPlus for loading/saving image data. * BitmapData.cs: synced up data structure with libgdiplus * BmpCodec.cs, JPEGCodec.cs, PNGCodec.cs: Removed codec impls, left just codecinfo getters; the codecs are in libgdiplus * ImageCodecInfo.cs: removed encode/decode delegates svn path=/trunk/mcs/; revision=25083
60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
//
|
|
// System.Drawing.Imaging.BMPCodec.cs
|
|
//
|
|
// Author:
|
|
// Alexandre Pigolkine ([email protected])
|
|
// Jordi Mas i Hernàndez ([email protected]>, 2004
|
|
// BITMAPINFOHEADER,Decode functions implemented using code/ideas from
|
|
// CxImage (c) 07/Aug/2001 <[email protected]>
|
|
//
|
|
// (C) 2002/2003 Ximian, Inc.
|
|
//
|
|
// Useful documentation about bitmaps
|
|
//
|
|
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_4v1h.asp
|
|
// http://www.csdn.net/Dev/Format/windows/Bmp.html
|
|
// http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html
|
|
//
|
|
// Header structure
|
|
// BITMAPFILEHEADER
|
|
// BITMAPINFOHEADER or BITMAPV4HEADER or BITMAPV5HEADER or BITMAPCOREHEADER
|
|
// RGBQUADS or RGBTRIPLE (optional)
|
|
// Bitmap data
|
|
//
|
|
|
|
namespace System.Drawing.Imaging
|
|
{
|
|
internal class BMPCodec
|
|
{
|
|
internal static ImageCodecInfo CodecInfo {
|
|
get {
|
|
ImageCodecInfo info = new ImageCodecInfo ();
|
|
info.Flags =
|
|
ImageCodecFlags.Encoder |
|
|
ImageCodecFlags.Decoder |
|
|
ImageCodecFlags.Builtin |
|
|
ImageCodecFlags.SupportBitmap;
|
|
|
|
info.FormatDescription = "BITMAP file format";
|
|
info.FormatID = System.Drawing.Imaging.ImageFormat.Bmp.Guid;
|
|
info.MimeType = "image/bmp";
|
|
info.Version = 1;
|
|
|
|
byte[][] signaturePatterns = new byte[1][];
|
|
signaturePatterns[0] = new byte[2];
|
|
signaturePatterns[0][0] = 0x42;
|
|
signaturePatterns[0][1] = 0x4d;
|
|
info.SignaturePatterns = signaturePatterns;
|
|
|
|
byte[][] signatureMasks = new byte[1][];
|
|
signatureMasks[0] = new byte[2];
|
|
signatureMasks[0][0] = 0xff;
|
|
signatureMasks[0][1] = 0xff;
|
|
info.SignatureMasks = signatureMasks;
|
|
|
|
return info;
|
|
}
|
|
}
|
|
}
|
|
}
|