Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

2007-04-24 Sebastien Pouliot <sebastien@ximian.com>

	* adjustablearrowcap.c: Header/types adjustments.
	* adjustablearrowcap.h: New file. Public header.
	* adjustablearrowcap-private.h: New file. Private header.
	* alpha-premul-table.inc: Types adjustment.
	* bmpcodec.c|h: Header/types adjustments.
	* bitmap.c: Header/types adjustments.
	* bitmap.h: New file. Public header.
	* bitmap-private.h: New file. Private header.
	* brush.c: Header adjustments.
	* brush.h: Move private stuff out.
	* brush-private.h: New file. Private header.
	* codecs.h: New file. Contains public codec declarations.
	* codecs-private.h: New file. Private header.
	* customlinecap.c: Header adjustments. 
	* customlinecap.h: Move private stuff out, move public stuff in.
	* customlinecap-private.h: New file. Private header.
	* dstream.c|h: Header adjustments. 
	* emfcodec.c|h: Header/types adjustments.
	* emfplus.h: Header adjustments.
	* font.c: Header/types adjustments.
	* font.h: New file. Public header.
	* fontcollection.h: New file. Public header.
	* fontcollection-private.h: New file. Private header.
	* fontfamily.h: New file. Public header.
	* fontfamily-private.h: New file. Private header.
	* gdip.h: Deprecated. Public and private stuff has been moved into 
	different header files to avoid more errors in the future and make it
	easier to use libgdiplus as a library.
	* gdipenums.h: New file. Contains (only) public enums.
	* gdipstructs.h: New file. Contains (only) public types.
	* gdiplus-private.h: New file. Main private include file.
	* GdiPlusFlat.h: New file. This is *the* header file to include from
	C/C++ projects (i.e. the only one that match MS filenames). Makes it
	easier not to use internal/private (i.e. changing) libgdiplus stuff.
	* general.c: Move public types to public header. Use FcFini if 
	available. Remove DEBUG_MEMLEAKS code (valgrind is much better).
	* general.h: Updated to contain only public stuff.
	* gifcodec.c|h: Header/types adjustments.
	* graphics.c: Header/types adjustments. [Draw|Measure]String functions
	have moved into text.c source file.
	* graphics.h: Move private stuff out and move public stuff in.
	* graphics-path.c: Header/types adjustments.
	* graphics-path.h: Move GpPathIterator functions into their own header 
	file. Moved internal functions into private header file.
	* graphics-path-private.h: New file. Private header.
	* graphics-pathiterator.c: Header/types adjustments.
	* graphics-pathiterator.h: New file. Public header.
	* graphics-pathiterator-private.h: New file. Private header.
	* graphics-private.h: New file. Private header.
	* hatchbrush.c: Header/types adjustments.
	* hatchbrush.h: Move private definitions into a separate header file.
	* hatchbrush-private.h: New file. Private header.
	* icocodec.c|h: Header/types adjustments.
	* image.c: Header/types adjustments. Move codec GUID into codec source
	files.
	* image.h: New file to replace gdipImage.h but contains only public 
	and semi-public stuff.
	* image-private.h: New file. Private header.
	* imageattributes.c: Header/types adjustments. 
	* imageattributes.h: New file. Public header.
	* imageattributes-private.h: New file. Private header.
	* jpegcodec.c|h: Header/types adjustments.
	* lineargradientbrush.c: Header adjustments. 
	* lineargradientbrush.h: Moved private stuff into it's own header file
	* lineargradientbrush-private.h: New file. Private header.
	* matrix.c: Header adjustments and inline matrix_equals.
	* matrix.h: Move private stuff out, move public stuff in.
	* matrix-private.h: New file. Private header.
	* metafile.c|h: Header/types adjustments. 
	* pen.c: Header/types adjustments. 
	* pen.h: New file. Public header.
	* pen-private.h: New file. Private header.
	* pathgradientbrush.c: Header adjustments.
	* pathgradientbrush.h: Move private stuff out.
	* pathgradientbrush-private.h: New file. Private header.
	* pngcodec.c|h: Header/types adjustments. 
	* region.c: Header adjustments.
	* region.h: Move private stuff out.
	* region-bitmap.c|h: Header/types adjustments.
	* region-path-tree.c|h: Header/types adjustments.
	* region-private.h: New file. Private header.
	* solidbrush.c: Header/types adjustments.
	* solidbrush.h: Move private stuff out.
	* solidbrush-private.h: New file. Private header.
	* stringformat.c: Header/types adjustments.
	* stringformat.h: New file. Public header.
	* text.c: New file. [Draw|Mesure]String is moved here. This will help
	having an alternate implementation of them.
	* text.h: New file. Public header.
	* text-private.h: New file. Private header.
	* texturebrush.c: Header/types adjustments.
	* texturebrush.h: Header/types adjustments.
	* texturebrush-private.h: Move private stuff out.
	* tiffcodec.c|h: Header/types adjustments.
	* win32structs.h: New file that contains win32 definitions required by
	libgdiplus.
	* wmfcodec.c|h: Header/types adjustments.
	* Makefile.am: Add new files to the build.


svn path=/trunk/libgdiplus/; revision=76214
  • Loading branch information...
commit 6945c705d606fa6536a3d87924ec3a51b86c5374 1 parent af086e9
Sebastien Pouliot authored
Showing with 6,574 additions and 4,747 deletions.
  1. +101 −0 src/ChangeLog
  2. +100 −0 src/GdiPlusFlat.h
  3. +104 −63 src/Makefile.am
  4. +51 −0 src/adjustablearrowcap-private.h
  5. +5 −6 src/adjustablearrowcap.c
  6. +50 −0 src/adjustablearrowcap.h
  7. +1 −1  src/alpha-premul-table.inc
  8. +172 −0 src/bitmap-private.h
  9. +131 −139 src/bitmap.c
  10. +67 −0 src/bitmap.h
  11. +78 −84 src/bmpcodec.c
  12. +5 −13 src/bmpcodec.h
  13. +64 −0 src/brush-private.h
  14. +2 −2 src/brush.c
  15. +18 −36 src/brush.h
  16. +62 −0 src/codecs-private.h
  17. +72 −0 src/codecs.h
  18. +64 −0 src/customlinecap-private.h
  19. +1 −2  src/customlinecap.c
  20. +19 −40 src/customlinecap.h
  21. +25 −6 src/dstream.c
  22. +2 −1  src/dstream.h
  23. +3 −1 src/emfcodec.c
  24. +2 −4 src/emfcodec.h
  25. +4 −2 src/emfplus.h
  26. +55 −0 src/font-private.h
  27. +21 −23 src/font.c
  28. +57 −0 src/font.h
  29. +47 −0 src/fontcollection-private.h
  30. +44 −0 src/fontcollection.h
  31. +51 −0 src/fontfamily-private.h
  32. +52 −0 src/fontfamily.h
  33. +18 −1,411 src/gdip.h
  34. +0 −393 src/gdipImage.h
  35. +739 −0 src/gdipenums.h
  36. +93 −0 src/gdiplus-private.h
  37. +98 −0 src/gdipstructs.h
  38. +111 −0 src/general-private.h
  39. +21 −78 src/general.c
  40. +24 −55 src/general.h
  41. +57 −53 src/gifcodec.c
  42. +2 −1  src/gifcodec.h
  43. +54 −0 src/graphics-path-private.h
  44. +66 −62 src/graphics-path.c
  45. +80 −80 src/graphics-path.h
  46. +49 −0 src/graphics-pathiterator-private.h
  47. +26 −25 src/graphics-pathiterator.c
  48. +50 −0 src/graphics-pathiterator.h
  49. +135 −0 src/graphics-private.h
  50. +23 −1,223 src/graphics.c
  51. +107 −34 src/graphics.h
  52. +59 −0 src/hatchbrush-private.h
  53. +5 −7 src/hatchbrush.c
  54. +7 −91 src/hatchbrush.h
  55. +7 −4 src/icocodec.c
  56. +1 −4 src/icocodec.h
  57. +65 −0 src/image-private.h
  58. +230 −258 src/image.c
  59. +105 −0 src/image.h
  60. +65 −0 src/imageattributes-private.h
  61. +23 −24 src/imageattributes.c
  62. +64 −0 src/imageattributes.h
  63. +32 −34 src/jpegcodec.c
  64. +2 −2 src/jpegcodec.h
  65. +61 −0 src/lineargradientbrush-private.h
  66. +3 −5 src/lineargradientbrush.c
  67. +26 −30 src/lineargradientbrush.h
  68. +55 −0 src/matrix-private.h
  69. +5 −20 src/matrix.c
  70. +26 −21 src/matrix.h
  71. +6 −3 src/metafile.c
  72. +7 −8 src/metafile.h
  73. +66 −0 src/pathgradientbrush-private.h
  74. +8 −6 src/pathgradientbrush.c
  75. +51 −44 src/pathgradientbrush.h
  76. +68 −0 src/pen-private.h
  77. +16 −12 src/pen.c
  78. +92 −0 src/pen.h
  79. +73 −63 src/pngcodec.c
  80. +2 −2 src/pngcodec.h
  81. +21 −21 src/region-bitmap.c
  82. +19 −6 src/region-bitmap.h
  83. +6 −5 src/region-path-tree.c
  84. +9 −1 src/region-path-tree.h
  85. +70 −0 src/region-private.h
  86. +3 −3 src/region.c
  87. +34 −13 src/region.h
  88. +52 −0 src/solidbrush-private.h
  89. +5 −5 src/solidbrush.c
  90. +22 −23 src/solidbrush.h
  91. +56 −0 src/stringformat-private.h
  92. +14 −14 src/stringformat.c
  93. +67 −0 src/stringformat.h
  94. +69 −0 src/text-private.h
  95. +1,226 −0 src/text.c
  96. +21 −0 src/text.h
  97. +53 −0 src/texturebrush-private.h
  98. +8 −10 src/texturebrush.c
  99. +7 −19 src/texturebrush.h
  100. +156 −145 src/tiffcodec.c
  101. +2 −1  src/tiffcodec.h
  102. +137 −0 src/win32structs.h
  103. +2 −1  src/wmfcodec.c
  104. +2 −4 src/wmfcodec.h
View
101 src/ChangeLog
@@ -1,3 +1,104 @@
+2007-04-24 Sebastien Pouliot <sebastien@ximian.com>
+
+ * adjustablearrowcap.c: Header/types adjustments.
+ * adjustablearrowcap.h: New file. Public header.
+ * adjustablearrowcap-private.h: New file. Private header.
+ * alpha-premul-table.inc: Types adjustment.
+ * bmpcodec.c|h: Header/types adjustments.
+ * bitmap.c: Header/types adjustments.
+ * bitmap.h: New file. Public header.
+ * bitmap-private.h: New file. Private header.
+ * brush.c: Header adjustments.
+ * brush.h: Move private stuff out.
+ * brush-private.h: New file. Private header.
+ * codecs.h: New file. Contains public codec declarations.
+ * codecs-private.h: New file. Private header.
+ * customlinecap.c: Header adjustments.
+ * customlinecap.h: Move private stuff out, move public stuff in.
+ * customlinecap-private.h: New file. Private header.
+ * dstream.c|h: Header adjustments.
+ * emfcodec.c|h: Header/types adjustments.
+ * emfplus.h: Header adjustments.
+ * font.c: Header/types adjustments.
+ * font.h: New file. Public header.
+ * fontcollection.h: New file. Public header.
+ * fontcollection-private.h: New file. Private header.
+ * fontfamily.h: New file. Public header.
+ * fontfamily-private.h: New file. Private header.
+ * gdip.h: Deprecated. Public and private stuff has been moved into
+ different header files to avoid more errors in the future and make it
+ easier to use libgdiplus as a library.
+ * gdipenums.h: New file. Contains (only) public enums.
+ * gdipstructs.h: New file. Contains (only) public types.
+ * gdiplus-private.h: New file. Main private include file.
+ * GdiPlusFlat.h: New file. This is *the* header file to include from
+ C/C++ projects (i.e. the only one that match MS filenames). Makes it
+ easier not to use internal/private (i.e. changing) libgdiplus stuff.
+ * general.c: Move public types to public header. Use FcFini if
+ available. Remove DEBUG_MEMLEAKS code (valgrind is much better).
+ * general.h: Updated to contain only public stuff.
+ * gifcodec.c|h: Header/types adjustments.
+ * graphics.c: Header/types adjustments. [Draw|Measure]String functions
+ have moved into text.c source file.
+ * graphics.h: Move private stuff out and move public stuff in.
+ * graphics-path.c: Header/types adjustments.
+ * graphics-path.h: Move GpPathIterator functions into their own header
+ file. Moved internal functions into private header file.
+ * graphics-path-private.h: New file. Private header.
+ * graphics-pathiterator.c: Header/types adjustments.
+ * graphics-pathiterator.h: New file. Public header.
+ * graphics-pathiterator-private.h: New file. Private header.
+ * graphics-private.h: New file. Private header.
+ * hatchbrush.c: Header/types adjustments.
+ * hatchbrush.h: Move private definitions into a separate header file.
+ * hatchbrush-private.h: New file. Private header.
+ * icocodec.c|h: Header/types adjustments.
+ * image.c: Header/types adjustments. Move codec GUID into codec source
+ files.
+ * image.h: New file to replace gdipImage.h but contains only public
+ and semi-public stuff.
+ * image-private.h: New file. Private header.
+ * imageattributes.c: Header/types adjustments.
+ * imageattributes.h: New file. Public header.
+ * imageattributes-private.h: New file. Private header.
+ * jpegcodec.c|h: Header/types adjustments.
+ * lineargradientbrush.c: Header adjustments.
+ * lineargradientbrush.h: Moved private stuff into it's own header file
+ * lineargradientbrush-private.h: New file. Private header.
+ * matrix.c: Header adjustments and inline matrix_equals.
+ * matrix.h: Move private stuff out, move public stuff in.
+ * matrix-private.h: New file. Private header.
+ * metafile.c|h: Header/types adjustments.
+ * pen.c: Header/types adjustments.
+ * pen.h: New file. Public header.
+ * pen-private.h: New file. Private header.
+ * pathgradientbrush.c: Header adjustments.
+ * pathgradientbrush.h: Move private stuff out.
+ * pathgradientbrush-private.h: New file. Private header.
+ * pngcodec.c|h: Header/types adjustments.
+ * region.c: Header adjustments.
+ * region.h: Move private stuff out.
+ * region-bitmap.c|h: Header/types adjustments.
+ * region-path-tree.c|h: Header/types adjustments.
+ * region-private.h: New file. Private header.
+ * solidbrush.c: Header/types adjustments.
+ * solidbrush.h: Move private stuff out.
+ * solidbrush-private.h: New file. Private header.
+ * stringformat.c: Header/types adjustments.
+ * stringformat.h: New file. Public header.
+ * text.c: New file. [Draw|Mesure]String is moved here. This will help
+ having an alternate implementation of them.
+ * text.h: New file. Public header.
+ * text-private.h: New file. Private header.
+ * texturebrush.c: Header/types adjustments.
+ * texturebrush.h: Header/types adjustments.
+ * texturebrush-private.h: Move private stuff out.
+ * tiffcodec.c|h: Header/types adjustments.
+ * win32structs.h: New file that contains win32 definitions required by
+ libgdiplus.
+ * wmfcodec.c|h: Header/types adjustments.
+ * Makefile.am: Add new files to the build.
+
2007-04-23 Sebastien Pouliot <sebastien@ximian.com>
* bitmap.c: Use a macro to calculate aligned stride.
View
100 src/GdiPlusFlat.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Sebastien Pouliot <sebastien@ximian.com>
+ */
+
+/*
+ * This is *the* public header to be used by C/C++ consumers of GDI+
+ * and has the same name as MS provided header for the "flat API"
+ */
+
+#ifndef _FLATAPI_H
+#define _FLATAPI_H
+
+/*
+ * If you ever need a workaround specific to libgdiplus then use the following define
+ */
+
+#define MONO_LIBGDIPLUS 1
+
+/*
+ * public view of internal stuff (curious about them, check in *-private.h files ;-)
+ */
+
+typedef void GpAdjustableArrowCap;
+typedef void GpBitmap;
+typedef void GpBrush;
+typedef void GpCustomLineCap;
+typedef void GpFont;
+typedef void GpFontCollection;
+typedef void GpFontFamily;
+typedef void GpGraphics;
+typedef void GpHatch;
+typedef void GpImage;
+typedef void GpImageAttributes;
+typedef void GpLineGradient;
+typedef void GpMatrix;
+typedef void GpPath;
+typedef void GpPathIterator;
+typedef void GpPathGradient;
+typedef void GpPen;
+typedef void GpRegion;
+typedef void GpSolidFill;
+typedef void GpState;
+typedef void GpStringFormat;
+typedef void GpTexture;
+
+/*
+ * Do not include those headers directly.
+ * Their content is public but, unlike this file, the header filenames do NOT match MS filenames!
+ */
+
+#include "gdipenums.h"
+#include "gdipstructs.h"
+
+/* FIXME - libgdiplus version is larger than this (and some members are misnamed) */
+typedef struct {
+ UINT Width;
+ UINT Height;
+ INT Stride;
+ PixelFormat PixelFormat;
+ VOID *Scan0;
+ UINT *Reserved;
+} BitmapData;
+
+#include "adjustablearrowcap.h"
+#include "bitmap.h"
+#include "brush.h"
+#include "customlinecap.h"
+#include "font.h"
+#include "fontcollection.h"
+#include "fontfamily.h"
+#include "graphics.h"
+#include "graphics-path.h"
+#include "hatchbrush.h"
+#include "imageattributes.h"
+#include "pen.h"
+#include "matrix.h"
+#include "region.h"
+#include "solidbrush.h"
+#include "stringformat.h"
+#include "text.h"
+
+#endif
View
167 src/Makefile.am
@@ -1,71 +1,112 @@
lib_LTLIBRARIES = libgdiplus.la
libgdiplus_la_SOURCES = \
- adjustablearrowcap.c \
- alpha-premul-table.inc \
- bitmap.c \
- brush.c \
- brush.h \
- cairo-embed.h \
- customlinecap.c \
- customlinecap.h \
- emfcodec.c \
- emfcodec.h \
- emfplus.c \
- emfplus.h \
- font.c \
- gdip.h \
- gdipImage.h \
- general.c \
- general.h \
- graphics.c \
- graphics.h \
- graphics-path.c \
- graphics-path.h \
- graphics-pathiterator.c \
- hatchbrush.c \
- hatchbrush.h \
- icocodec.c \
- icocodec.h \
- image.c \
- lineargradientbrush.c \
- lineargradientbrush.h \
- matrix.c \
- matrix.h \
- metafile.c \
- metafile.h \
- pen.c \
- pathgradientbrush.c \
- pathgradientbrush.h \
- print.c \
- region.c \
- region.h \
- region-bitmap.c \
- region-bitmap.h \
- region-path-tree.c \
- region-path-tree.h \
- solidbrush.c \
- solidbrush.h \
- stringformat.c \
- texturebrush.c \
- texturebrush.h \
- pngcodec.h \
- pngcodec.c \
- gifcodec.h \
- gifcodec.c \
- tiffcodec.h \
- tiffcodec.c \
- bmpcodec.h \
- bmpcodec.c \
- jpegcodec.h \
- imageattributes.c \
- jpegcodec.c \
- dstream.c \
- dstream.h \
- wmfcodec.c \
+ adjustablearrowcap.c \
+ adjustablearrowcap.h \
+ adjustablearrowcap-private.h \
+ alpha-premul-table.inc \
+ bitmap.c \
+ bitmap.h \
+ bitmap-private.h \
+ brush.c \
+ brush.h \
+ brush-private.h \
+ cairo-embed.h \
+ codecs.h \
+ codecs-private.h \
+ customlinecap.c \
+ customlinecap.h \
+ customlinecap-private.h \
+ dstream.c \
+ dstream.h \
+ font.c \
+ font.h \
+ font-private.h \
+ fontcollection.h \
+ fontcollection-private.h \
+ fontfamily.h \
+ fontfamily-private.h \
+ GdiPlusFlat.h \
+ gdiplus-private.h \
+ gdip.h \
+ gdipenums.h \
+ gdipfuncs.h \
+ gdipstructs.h \
+ general.c \
+ general.h \
+ general-private.h \
+ graphics.c \
+ graphics.h \
+ graphics-private.h \
+ graphics-path.c \
+ graphics-path.h \
+ graphics-path-private.h \
+ graphics-pathiterator.c \
+ graphics-pathiterator.h \
+ graphics-pathiterator-private.h \
+ hatchbrush.c \
+ hatchbrush.h \
+ hatchbrush-private.h \
+ icocodec.c \
+ icocodec.h \
+ image.c \
+ image.h \
+ image-private.h \
+ imageattributes.c \
+ imageattributes.h \
+ imageattributes-private.h \
+ lineargradientbrush.c \
+ lineargradientbrush.h \
+ lineargradientbrush-private.h \
+ matrix.c \
+ matrix.h \
+ matrix-private.h \
+ metafile.c \
+ metafile.h \
+ pathgradientbrush.c \
+ pathgradientbrush.h \
+ pathgradientbrush-private.h \
+ pen.c \
+ pen.h \
+ pen-private.h \
+ print.c \
+ region.c \
+ region.h \
+ region-private.h \
+ region-bitmap.c \
+ region-bitmap.h \
+ region-path-tree.c \
+ region-path-tree.h \
+ solidbrush.c \
+ solidbrush.h \
+ solidbrush-private.h \
+ stringformat.c \
+ stringformat.h \
+ stringformat-private.h \
+ text.c \
+ text.h \
+ text-private.h \
+ texturebrush.c \
+ texturebrush.h \
+ texturebrush-private.h \
+ win32structs.h \
+ bmpcodec.h \
+ bmpcodec.c \
+ emfcodec.c \
+ emfcodec.h \
+ emfplus.c \
+ emfplus.h \
+ gifcodec.h \
+ gifcodec.c \
+ jpegcodec.h \
+ jpegcodec.c \
+ pngcodec.h \
+ pngcodec.c \
+ tiffcodec.h \
+ tiffcodec.c \
+ wmfcodec.c \
wmfcodec.h
-
libgdiplus_la_LIBADD = $(GDIPLUS_LIBS)
INCLUDES = $(GDIPLUS_CFLAGS) -Wall -Wno-unused -Wno-format
View
51 src/adjustablearrowcap-private.h
@@ -0,0 +1,51 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Alexandre Pigolkine (pigolkine@gmx.de)
+ * Duncan Mak (duncan@ximian.com)
+ * Miguel de Icaza (miguel@ximian.com)
+ * Ravindra (rkumar@novell.com)
+ * Sanjay Gupta (gsanjay@novell.com)
+ * Vladimir Vukicevic (vladimir@pobox.com)
+ * Geoff Norton (gnorton@customerdna.com)
+ * Jonathan Gilbert (logic@deltaq.org)
+ * Sebastien Pouliot <sebastien@ximian.com>
+ *
+ * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com)
+ */
+
+/*
+ * NOTE: This is a private header files and everything is subject to changes.
+ */
+
+#ifndef __ADJUSTABLEARROWCAP_PRIVATE_H__
+#define __ADJUSTABLEARROWCAP_PRIVATE_H__
+
+#include "gdiplus-private.h"
+#include "customlinecap-private.h"
+
+typedef struct _AdjustableArrowCap {
+ CustomLineCap base;
+ float width;
+ float height;
+ float middle_inset;
+ BOOL fill_state;
+} AdjustableArrowCap;
+
+#include "adjustablearrowcap.h"
+
+#endif
View
11 src/adjustablearrowcap.c
@@ -19,11 +19,10 @@
* Author:
* Ravindra (rkumar@novell.com)
*
- * Copyright (C) 2003-2006 Novell, Inc. http://www.novell.com
+ * Copyright (C) 2003-2007 Novell, Inc. http://www.novell.com
*/
-#include "gdip.h"
-#include "customlinecap.h"
+#include "adjustablearrowcap-private.h"
static GpStatus gdip_adjust_arrowcap_setup (GpGraphics *graphics, GpCustomLineCap *cap);
static GpStatus gdip_adjust_arrowcap_clone_cap (GpCustomLineCap *cap, GpCustomLineCap **clonedCap);
@@ -101,7 +100,7 @@ gdip_adjust_arrowcap_setup (GpGraphics *graphics, GpCustomLineCap *customCap)
// coverity[+alloc : arg-*3]
GpStatus
-GdipCreateAdjustableArrowCap (float height, float width, bool isFilled, GpAdjustableArrowCap **arrowCap)
+GdipCreateAdjustableArrowCap (float height, float width, BOOL isFilled, GpAdjustableArrowCap **arrowCap)
{
GpAdjustableArrowCap *cap;
@@ -190,7 +189,7 @@ GdipGetAdjustableArrowCapMiddleInset (GpAdjustableArrowCap *arrowCap, float *mid
}
GpStatus
-GdipSetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, bool isFilled)
+GdipSetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, BOOL isFilled)
{
if (!arrowCap)
return InvalidParameter;
@@ -201,7 +200,7 @@ GdipSetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, bool isFille
}
GpStatus
-GdipGetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, bool *isFilled)
+GdipGetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, BOOL *isFilled)
{
if (!arrowCap || !isFilled)
return InvalidParameter;
View
50 src/adjustablearrowcap.h
@@ -0,0 +1,50 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Alexandre Pigolkine (pigolkine@gmx.de)
+ * Duncan Mak (duncan@ximian.com)
+ * Miguel de Icaza (miguel@ximian.com)
+ * Ravindra (rkumar@novell.com)
+ * Sanjay Gupta (gsanjay@novell.com)
+ * Vladimir Vukicevic (vladimir@pobox.com)
+ * Geoff Norton (gnorton@customerdna.com)
+ * Jonathan Gilbert (logic@deltaq.org)
+ * Sebastien Pouliot <sebastien@ximian.com>
+ *
+ * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com)
+ */
+
+#ifndef __ADJUSTABLEARROWCAP_H__
+#define __ADJUSTABLEARROWCAP_H__
+
+/* AdjustableArrowCap public API (only!) */
+
+GpStatus GdipCreateAdjustableArrowCap (REAL height, REAL width, BOOL isFilled, GpAdjustableArrowCap **arrowCap);
+
+GpStatus GdipGetAdjustableArrowCapHeight (GpAdjustableArrowCap *arrowCap, REAL *height);
+GpStatus GdipSetAdjustableArrowCapHeight (GpAdjustableArrowCap *arrowCap, REAL height);
+
+GpStatus GdipGetAdjustableArrowCapWidth (GpAdjustableArrowCap *arrowCap, REAL *width);
+GpStatus GdipSetAdjustableArrowCapWidth (GpAdjustableArrowCap *arrowCap, REAL width);
+
+GpStatus GdipGetAdjustableArrowCapMiddleInset (GpAdjustableArrowCap *arrowCap, REAL *middleInset);
+GpStatus GdipSetAdjustableArrowCapMiddleInset (GpAdjustableArrowCap *arrowCap, REAL middleInset);
+
+GpStatus GdipSetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, BOOL isFilled);
+GpStatus GdipGetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, BOOL *isFilled);
+
+#endif
View
2  src/alpha-premul-table.inc
@@ -1,5 +1,5 @@
/* precomputed table for alpha*value divised by 255 */
-const byte pre_multiplied_table[256][256] = {
+const BYTE pre_multiplied_table[256][256] = {
/* 000 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* 001 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
/* 002 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 },
View
172 src/bitmap-private.h
@@ -0,0 +1,172 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Alexandre Pigolkine (pigolkine@gmx.de)
+ * Duncan Mak (duncan@ximian.com)
+ * Miguel de Icaza (miguel@ximian.com)
+ * Ravindra (rkumar@novell.com)
+ * Sanjay Gupta (gsanjay@novell.com)
+ * Vladimir Vukicevic (vladimir@pobox.com)
+ * Geoff Norton (gnorton@customerdna.com)
+ * Jonathan Gilbert (logic@deltaq.org)
+ * Sebastien Pouliot <sebastien@ximian.com>
+ *
+ * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com)
+ */
+
+/*
+ * NOTE: This is a private header files and everything is subject to changes.
+ */
+
+#ifndef __BITMAP_PRIVATE_H__
+#define __BITMAP_PRIVATE_H__
+
+#include "gdiplus-private.h"
+#include "image-private.h"
+
+#define COLOR_PALETTE_FLAGS_DEFAULT 0
+#define COLOR_PALETTE_FLAGS_HAS_ALPHA 1
+#define COLOR_PALETTE_FLAGS_GREYSCALE 2
+#define COLOR_PALETTE_FLAGS_HALFTONE 4
+
+/* LockMode (reserved) flags */
+#define GBD_OWN_SCAN0 (1<<8)
+#define GBD_WRITE_OK (1<<9)
+#define GBD_LOCKED (1<<10)
+#define GBD_TRUE24BPP (1<<11)
+
+#ifdef WORDS_BIGENDIAN
+#define set_pixel_bgra(pixel,index,b,g,r,a) do { \
+ ((unsigned char *)(pixel))[index] = a; \
+ ((unsigned char *)(pixel))[index+1] = r; \
+ ((unsigned char *)(pixel))[index+2] = g; \
+ ((unsigned char *)(pixel))[index+3] = b; \
+ } while (0)
+#else
+#define set_pixel_bgra(pixel,index,b,g,r,a) do { \
+ ((unsigned char *)(pixel))[index] = b; \
+ ((unsigned char *)(pixel))[index+1] = g; \
+ ((unsigned char *)(pixel))[index+2] = r; \
+ ((unsigned char *)(pixel))[index+3] = a; \
+ } while (0)
+#endif
+#define get_pixel_bgra(color, b, g, r, a) do { \
+ a = ((color & 0xff000000) >> 24); \
+ r = ((color & 0x00ff0000) >> 16); \
+ g = ((color & 0x0000ff00) >> 8); \
+ b = (color & 0x000000ff); \
+ } while(0)
+
+/* This structure is mirrored in System.Drawing.Imaging.BitmapData.
+ Any changes here must also be made to BitmapData.cs */
+typedef struct {
+ unsigned int width;
+ unsigned int height;
+ int stride;
+ int pixel_format;
+ BYTE *scan0;
+ unsigned int reserved;
+ /* the rest of the structure isn't part of MS GDI+ definition */
+ ColorPalette *palette;
+ int property_count; /* Number of properties */
+ PropertyItem *property; /* Properties associated with image */
+
+ float dpi_horz; /* */
+ float dpi_vert; /* */
+ ImageFlags image_flags; /* Alpha, ColorSpace, etc. */
+
+ unsigned int left; /* left display coordinate of frame */
+ unsigned int top; /* top display coordinate of frame */
+ unsigned int x; /* LockBits: left coordinate of locked rectangle */
+ unsigned int y; /* LockBits: top coordinate of locked rectangle */
+
+ int transparent; /* Index of transparent color (<24bit only) */
+} BitmapData;
+
+typedef struct {
+ int count; /* Number of bitmaps contained in this frame */
+ BitmapData *bitmap; /* Bitmaps for this frame */
+ GUID frame_dimension; /* GUID describing the frame type */
+} FrameData;
+
+typedef struct _Image {
+ /* Image Description */
+ ImageType type; /* Undefined, Bitmap, MetaFile */
+ ImageFormat image_format; /* BMP, TIF, GIF, PNG, etc. */
+ /* Image Data */
+ int num_of_frames; /* Number of frames */
+ FrameData *frames; /* Array of frames (Page, Time, Resolution) for the image */
+ /* Tracking of active image */
+ int active_frame; /* Index of frame currently used */
+ int active_bitmap_no; /* Index of active bitmap in current frame */
+ BitmapData *active_bitmap; /* Pointer to active frame/bitmap; DO NOT free() */
+ /* Internal fields */
+ int cairo_format;
+ cairo_surface_t *surface;
+} GpBitmap;
+
+
+void gdip_bitmap_init (GpBitmap *bitmap) GDIP_INTERNAL;
+
+GpBitmap *gdip_bitmap_new (void) GDIP_INTERNAL;
+GpBitmap *gdip_bitmap_new_with_frame (const GUID *dimension, BOOL add_bitmapdata) GDIP_INTERNAL;
+FrameData *gdip_frame_add(GpBitmap *bitmap, const GUID *dimension) GDIP_INTERNAL;
+BitmapData *gdip_frame_add_bitmapdata(FrameData *frame) GDIP_INTERNAL;
+GpStatus gdip_bitmap_dispose (GpBitmap *bitmap) GDIP_INTERNAL;
+GpStatus gdip_bitmap_clone (GpBitmap *bitmap, GpBitmap **clonedbitmap) GDIP_INTERNAL;
+GpStatus gdip_bitmap_setactive (GpBitmap *bitmap, const GUID *dimension, int index) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_clone (BitmapData *src, BitmapData **dest, int count) GDIP_INTERNAL;
+ColorPalette *gdip_palette_clone(ColorPalette *original) GDIP_INTERNAL;
+GpStatus gdip_property_get_short (int offset, void *value, unsigned short *result) GDIP_INTERNAL;
+GpStatus gdip_property_get_long (int offset, void *value, guint32 *result) GDIP_INTERNAL;
+GpStatus gdip_property_get_srational (int offset, void *value, unsigned short *numerator, unsigned short *denominator) GDIP_INTERNAL;
+GpStatus gdip_property_get_rational (int offset, void *value, guint32 *numerator, guint32 *denominator) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_add (BitmapData *bitmap_data, PROPID id, ULONG length, WORD type, VOID *value) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_add_byte (BitmapData *bitmap_data, PROPID id, BYTE value) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_add_short (BitmapData *bitmap_data, PROPID id, unsigned short value) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_add_long (BitmapData *bitmap_data, PROPID id, guint32 value) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_add_ASCII (BitmapData *bitmap_data, PROPID id, unsigned char *value) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_add_rational (BitmapData *bitmap_data, PROPID id, guint32 numerator, guint32 denominator) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_add_srational (BitmapData *bitmap_data, PROPID id, unsigned short numerator, unsigned short denominator) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_remove_id (BitmapData *bitmap_data, PROPID id) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_remove_index (BitmapData *bitmap_data, int index) GDIP_INTERNAL;
+GpStatus gdip_bitmapdata_property_find_id (BitmapData *bitmap_data, PROPID id, int *index) GDIP_INTERNAL;
+
+cairo_surface_t* gdip_bitmap_ensure_surface (GpBitmap *bitmap) GDIP_INTERNAL;
+GpBitmap* gdip_convert_indexed_to_rgb (GpBitmap *bitmap) GDIP_INTERNAL;
+
+void gdip_process_bitmap_attributes (GpBitmap *bitmap, void **dest, GpImageAttributes* attr, BOOL *allocated) GDIP_INTERNAL;
+
+
+typedef struct {
+ Rect region;
+ int x, y; /* the offset of the next byte that will be loaded, once the buffer is depleted */
+ unsigned short buffer;
+ int p; /* index of pixel within 'buffer' that was returned by the last call to gdip_pixel_stream_get_next () */
+ int one_pixel_mask;
+ int one_pixel_shift;
+ int pixels_per_byte; /* a negative value is used to indicate a count of bytes per pixel for depths of more than 8 bits */
+ BitmapData *data;
+ BYTE *scan;
+} StreamingState;
+
+GpStatus gdip_init_pixel_stream (StreamingState *state, BitmapData *data, int x, int y, int w, int h) GDIP_INTERNAL;
+unsigned int gdip_pixel_stream_get_next (StreamingState *state) GDIP_INTERNAL;
+
+#include "bitmap.h"
+
+#endif
View
270 src/bitmap.c
@@ -27,18 +27,11 @@
* Sebastien Pouliot <sebastien@ximian.com>
*/
-#include <glib.h>
-#include "gdip.h"
-#include "gdipImage.h"
-#include <string.h>
-#include <unistd.h>
+#include "gdiplus-private.h"
+#include "bitmap-private.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-static GpStatus gdip_bitmap_clone_data_rect (GdipBitmapData *srcData, Rect *srcRect, GdipBitmapData *destData, Rect *destRect);
+static GpStatus gdip_bitmap_clone_data_rect (BitmapData *srcData, Rect *srcRect, BitmapData *destData, Rect *destRect);
/* The default indexed palettes. This code was generated by a tiny C# program.
@@ -79,13 +72,13 @@ static BOOL
gdip_is_a_supported_pixelformat (PixelFormat fmt)
{
switch (fmt) {
- case Format1bppIndexed:
- case Format4bppIndexed:
- case Format8bppIndexed:
- case Format24bppRgb:
- case Format32bppArgb:
- case Format32bppPArgb:
- case Format32bppRgb:
+ case PixelFormat1bppIndexed:
+ case PixelFormat4bppIndexed:
+ case PixelFormat8bppIndexed:
+ case PixelFormat24bppRgb:
+ case PixelFormat32bppArgb:
+ case PixelFormat32bppPArgb:
+ case PixelFormat32bppRgb:
return TRUE;
default:
return FALSE;
@@ -110,16 +103,13 @@ gdip_is_an_indexed_pixelformat (PixelFormat fmt)
void
gdip_bitmap_init (GpBitmap *bitmap)
{
- if (bitmap == NULL) {
+ if (bitmap == NULL)
return;
- }
- memset(bitmap, 0, sizeof(GpBitmap));
+ memset (bitmap, 0, sizeof (GpBitmap));
- bitmap->type = imageBitmap;
+ bitmap->type = ImageTypeBitmap;
bitmap->image_format = INVALID;
-
- return;
}
static GpStatus
@@ -198,9 +188,7 @@ gdip_bitmapdata_init (BitmapData *data)
GpStatus
gdip_property_get_short(int offset, void *value, unsigned short *result)
{
- unsigned char *ptr;
-
- ptr = (unsigned char *)value;
+ BYTE *ptr = (BYTE*)value;
*result = ptr[0] + (ptr[1] << 8);
@@ -210,9 +198,7 @@ gdip_property_get_short(int offset, void *value, unsigned short *result)
GpStatus
gdip_property_get_long(int offset, void *value, guint32 *result)
{
- unsigned char *ptr;
-
- ptr = (unsigned char *)value;
+ BYTE *ptr = (BYTE*)value;
*result = ptr[0] + (ptr[1] << 8) + (ptr[2] << 16) + (ptr[3] << 24);
@@ -222,9 +208,7 @@ gdip_property_get_long(int offset, void *value, guint32 *result)
GpStatus
gdip_property_get_srational(int offset, void *value, unsigned short *numerator, unsigned short *denominator)
{
- unsigned char *ptr;
-
- ptr = (unsigned char *)value;
+ BYTE *ptr = (BYTE*)value;
*numerator = ptr[0] + (ptr[1] << 8);
*denominator = ptr[2] + (ptr[3] << 8);
@@ -235,9 +219,7 @@ gdip_property_get_srational(int offset, void *value, unsigned short *numerator,
GpStatus
gdip_property_get_rational(int offset, void *value, guint32 *numerator, guint32 *denominator)
{
- unsigned char *ptr;
-
- ptr = (unsigned char *)value;
+ BYTE *ptr = (BYTE*)value;
*numerator = ptr[0] + (ptr[1] << 8) + (ptr[2] << 16) + (ptr[3] << 24);
*denominator = ptr[4] + (ptr[5] << 8) + (ptr[6] << 16) + (ptr[7] << 24);
@@ -248,43 +230,43 @@ gdip_property_get_rational(int offset, void *value, guint32 *numerator, guint32
GpStatus
gdip_bitmapdata_property_add_long(BitmapData *bitmap_data, PROPID id, guint32 value)
{
- unsigned char buffer[4];
+ BYTE buffer[4];
buffer[0] = value & 0xff;
buffer[1] = (value & 0x0000ff00) >> 8;
buffer[2] = (value & 0x00ff0000) >> 16;
buffer[3] = (value & 0xff000000) >> 24;
- return gdip_bitmapdata_property_add(bitmap_data, id, 4 , TypeLong, buffer);
+ return gdip_bitmapdata_property_add (bitmap_data, id, 4, PropertyTagTypeLong, buffer);
}
GpStatus
-gdip_bitmapdata_property_add_ASCII(BitmapData *bitmap_data, PROPID id, unsigned char *value)
+gdip_bitmapdata_property_add_ASCII(BitmapData *bitmap_data, PROPID id, BYTE *value)
{
- return gdip_bitmapdata_property_add(bitmap_data, id, strlen((char *)value) + 1, TypeASCII, value);
+ return gdip_bitmapdata_property_add (bitmap_data, id, strlen((char *)value) + 1, PropertyTagTypeASCII, value);
}
GpStatus
-gdip_bitmapdata_property_add_byte(BitmapData *bitmap_data, PROPID id, byte value)
+gdip_bitmapdata_property_add_byte (BitmapData *bitmap_data, PROPID id, BYTE value)
{
- return gdip_bitmapdata_property_add(bitmap_data, id, 1, TypeByte, &value);
+ return gdip_bitmapdata_property_add (bitmap_data, id, 1, PropertyTagTypeByte, &value);
}
GpStatus
gdip_bitmapdata_property_add_short(BitmapData *bitmap_data, PROPID id, unsigned short value)
{
- unsigned char buffer[2];
+ BYTE buffer[2];
buffer[0] = value & 0xff;
buffer[1] = (value & 0x0ff00) >> 8;
- return gdip_bitmapdata_property_add(bitmap_data, id, 2, TypeShort, buffer);
+ return gdip_bitmapdata_property_add (bitmap_data, id, 2, PropertyTagTypeShort, buffer);
}
GpStatus
gdip_bitmapdata_property_add_rational(BitmapData *bitmap_data, PROPID id, guint32 numerator, guint32 denominator)
{
- unsigned char buffer[8];
+ BYTE buffer[8];
buffer[0] = numerator & 0xff;
buffer[1] = (numerator & 0x0000ff00) >> 8;
@@ -296,14 +278,13 @@ gdip_bitmapdata_property_add_rational(BitmapData *bitmap_data, PROPID id, guint3
buffer[6] = (denominator & 0x00ff0000) >> 16;
buffer[7] = (denominator & 0xff000000) >> 24;
-
- return gdip_bitmapdata_property_add(bitmap_data, id, 8, TypeRational, buffer);
+ return gdip_bitmapdata_property_add (bitmap_data, id, 8, PropertyTagTypeRational, buffer);
}
GpStatus
gdip_bitmapdata_property_add_srational(BitmapData *bitmap_data, PROPID id, unsigned short numerator, unsigned short denominator)
{
- unsigned char buffer[4];
+ BYTE buffer[4];
buffer[0] = numerator & 0xff;
buffer[1] = (numerator & 0x0ff00) >> 8;
@@ -311,8 +292,7 @@ gdip_bitmapdata_property_add_srational(BitmapData *bitmap_data, PROPID id, unsig
buffer[2] = denominator & 0xff;
buffer[3] = (denominator & 0xff00) >> 8;
-
- return gdip_bitmapdata_property_add(bitmap_data, id, 8, TypeRational, buffer);
+ return gdip_bitmapdata_property_add (bitmap_data, id, 8, PropertyTagTypeRational, buffer);
}
GpStatus
@@ -329,7 +309,7 @@ gdip_bitmapdata_property_add(BitmapData *bitmap_data, PROPID id, ULONG length, W
if (bitmap_data->property == NULL) {
bitmap_data->property = GdipAlloc(sizeof(PropertyItem));
} else {
- bitmap_data->property = GdipRealloc(bitmap_data->property, sizeof(PropertyItem) * (property_count + 1));
+ bitmap_data->property = gdip_realloc (bitmap_data->property, sizeof(PropertyItem) * (property_count + 1));
}
if (bitmap_data->property == NULL) {
bitmap_data->property_count = 0;
@@ -370,8 +350,8 @@ gdip_bitmapdata_property_remove_id(BitmapData *bitmap_data, PROPID id)
GpStatus
gdip_bitmapdata_property_remove_index(BitmapData *bitmap_data, int index)
{
- unsigned char *src;
- unsigned char *dest;
+ BYTE *src;
+ BYTE *dest;
if (index >= bitmap_data->property_count) {
return PropertyNotFound;
@@ -546,7 +526,7 @@ gdip_frame_add(GpBitmap *bitmap, const GUID *dimension)
/* No frame for the requested dimension exists */
bitmap->num_of_frames++;
- bitmap->frames = GdipRealloc(bitmap->frames, sizeof(FrameData) * (bitmap->num_of_frames));
+ bitmap->frames = gdip_realloc (bitmap->frames, sizeof(FrameData) * (bitmap->num_of_frames));
if (bitmap->frames == NULL) {
return NULL;
}
@@ -576,7 +556,7 @@ gdip_frame_add_bitmapdata(FrameData *frame)
return frame->bitmap;
}
- frame->bitmap = GdipRealloc(frame->bitmap, sizeof(BitmapData) * (frame->count + 1));
+ frame->bitmap = gdip_realloc (frame->bitmap, sizeof(BitmapData) * (frame->count + 1));
if (frame->bitmap == NULL) {
return NULL;
}
@@ -715,7 +695,7 @@ gdip_bitmap_new(void)
/* Create a new bitmap, and create a frame with the given dimension */
GpBitmap *
-gdip_bitmap_new_with_frame(const GUID *dimension, bool add_bitmapdata)
+gdip_bitmap_new_with_frame (const GUID *dimension, BOOL add_bitmapdata)
{
GpBitmap *result;
FrameData *frame;
@@ -781,7 +761,7 @@ GdipCreateBitmapFromFileICM (GDIPCONST WCHAR* filename, GpBitmap **bitmap)
/* coverity[+alloc : arg-*5] */
GpStatus
-GdipCreateBitmapFromScan0 (int width, int height, int stride, int format, void *scan0, GpBitmap **bitmap)
+GdipCreateBitmapFromScan0 (int width, int height, int stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
{
GpStatus status;
FrameData *frame;
@@ -795,35 +775,35 @@ GdipCreateBitmapFromScan0 (int width, int height, int stride, int format, void *
}
switch (format) {
- case Format24bppRgb: {
+ case PixelFormat24bppRgb: {
cairo_format = CAIRO_FORMAT_RGB24;
break;
}
- case Format32bppArgb:
- case Format32bppPArgb:
+ case PixelFormat32bppArgb:
+ case PixelFormat32bppPArgb:
flags = ImageFlagsHasAlpha;
/* fall through */
- case Format32bppRgb:
+ case PixelFormat32bppRgb:
cairo_format = CAIRO_FORMAT_ARGB32;
break;
- case Format16bppRgb555:
- case Format16bppRgb565:
+ case PixelFormat16bppRgb555:
+ case PixelFormat16bppRgb565:
/* fake them as 32bpp RGB as Cairo deprecated CAIRO_FORMAT_RGB16_565 support */
/* why 32bpp ? because that's the result of MS GDI+ when loading them, even if the bitmap is empty */
- format = Format32bppRgb;
+ format = PixelFormat32bppRgb;
stride *= 2;
cairo_format = CAIRO_FORMAT_ARGB32;
break;
- case Format8bppIndexed:
- case Format4bppIndexed: {
+ case PixelFormat8bppIndexed:
+ case PixelFormat4bppIndexed: {
cairo_format = CAIRO_FORMAT_A8;
break;
}
- case Format1bppIndexed: {
+ case PixelFormat1bppIndexed: {
cairo_format = CAIRO_FORMAT_A1;
break;
}
@@ -888,7 +868,7 @@ GdipCreateBitmapFromScan0 (int width, int height, int stride, int format, void *
memset (scan0, 0, stride * height);
} else {
/* Since the pixel format is not an alpha pixel format (i.e., it is
- * either Format24bppRgb or Format32bppRgb), the image should be
+ * either PixelFormat24bppRgb or PixelFormat32bppRgb), the image should be
* initially black, not initially transparent. Thus, we need to set
* the alpha channel, which the user code doesn't think exists but
* Cairo is still paying attention to, to 0xFF.
@@ -936,14 +916,14 @@ GdipCreateBitmapFromScan0 (int width, int height, int stride, int format, void *
bitmap_data->palette->Flags = COLOR_PALETTE_FLAGS_DEFAULT;
switch (format) {
- case Format1bppIndexed:
+ case PixelFormat1bppIndexed:
default_palette = default_Format1bppIndexed_palette;
bitmap_data->palette->Flags |= COLOR_PALETTE_FLAGS_GREYSCALE;
break;
- case Format4bppIndexed:
+ case PixelFormat4bppIndexed:
default_palette = default_Format4bppIndexed_palette;
break;
- case Format8bppIndexed:
+ case PixelFormat8bppIndexed:
default_palette = default_Format8bppIndexed_palette;
bitmap_data->palette->Flags |= COLOR_PALETTE_FLAGS_HALFTONE;
break;
@@ -1002,7 +982,7 @@ GdipCreateBitmapFromGraphics (int width, int height, GpGraphics *graphics, GpBit
bitmap_data->width = width;
bitmap_data->height = height;
bitmap_data->stride = stride;
- bitmap_data->pixel_format = Format32bppArgb;
+ bitmap_data->pixel_format = PixelFormat32bppArgb;
bitmap_data->reserved = GBD_OWN_SCAN0;
bitmap_data->scan0 = GdipAlloc(stride * height);
if (bitmap_data->scan0 == NULL) {
@@ -1020,7 +1000,7 @@ GdipCreateBitmapFromGraphics (int width, int height, GpGraphics *graphics, GpBit
}
GpStatus
-GdipCreateBitmapFromHBITMAP (void *hbm, void *hpal, GpBitmap** bitmap)
+GdipCreateBitmapFromHBITMAP (HBITMAP hbm, HPALETTE hpal, GpBitmap** bitmap)
{
if (!bitmap || !hbm)
return InvalidParameter;
@@ -1029,7 +1009,7 @@ GdipCreateBitmapFromHBITMAP (void *hbm, void *hpal, GpBitmap** bitmap)
}
GpStatus
-GdipCreateHBITMAPFromBitmap (GpBitmap* bitmap, void **hbmReturn, unsigned long background)
+GdipCreateHBITMAPFromBitmap (GpBitmap* bitmap, HBITMAP *hbmReturn, ARGB background)
{
/*
* Note: the handle must survive disposing the bitmap. This means that there's no interoperable way to free this memory.
@@ -1045,7 +1025,7 @@ GdipCreateHBITMAPFromBitmap (GpBitmap* bitmap, void **hbmReturn, unsigned long b
}
GpStatus
-GdipCreateBitmapFromHICON (void *hicon, GpBitmap** bitmap)
+GdipCreateBitmapFromHICON (HICON hicon, GpBitmap** bitmap)
{
GpStatus status;
@@ -1074,7 +1054,7 @@ GdipCreateBitmapFromHICON (void *hicon, GpBitmap** bitmap)
}
GpStatus
-GdipCreateHICONFromBitmap (GpBitmap* bitmap, void **hbmReturn)
+GdipCreateHICONFromBitmap (GpBitmap* bitmap, HICON *hbmReturn)
{
/*
* Note: the handle must survive disposing the bitmap. This means that there's no interoperable way to free this memory.
@@ -1084,7 +1064,7 @@ GdipCreateHICONFromBitmap (GpBitmap* bitmap, void **hbmReturn)
}
GpStatus
-GdipCreateBitmapFromResource(void *hInstance, GDIPCONST WCHAR *lpBitmapName, GpBitmap** bitmap)
+GdipCreateBitmapFromResource (HINSTANCE hInstance, GDIPCONST WCHAR *lpBitmapName, GpBitmap** bitmap)
{
return(NotImplemented);
}
@@ -1157,7 +1137,7 @@ gdip_copy_strides (void *dst, int dstStride, void *src, int srcStride, int realB
* bits must be of the same PixelFormat.
*/
static GpStatus
-gdip_bitmap_clone_data_rect (GdipBitmapData *srcData, Rect *srcRect, GdipBitmapData *destData, Rect *destRect)
+gdip_bitmap_clone_data_rect (BitmapData *srcData, Rect *srcRect, BitmapData *destData, Rect *destRect)
{
int dest_components;
int dest_depth;
@@ -1236,10 +1216,10 @@ gdip_bitmap_clone_data_rect (GdipBitmapData *srcData, Rect *srcRect, GdipBitmapD
} else {
/* the not-so-fast path: no bits are aligned, so the entire image requires bit juggling. */
- unsigned char *src_scan;
- unsigned char *src_scan0;
- unsigned char *dest_scan;
- unsigned char *dest_scan0;
+ BYTE *src_scan;
+ BYTE *src_scan0;
+ BYTE *dest_scan;
+ BYTE *dest_scan0;
unsigned short buffer;
int left_shift;
int x;
@@ -1323,7 +1303,7 @@ gdip_is_pixel_format_conversion_valid (PixelFormat src, PixelFormat dest)
}
#if FALSE
-/* Format24bppRgb is internally stored by Cairo as a four bytes. Convert it to 3-byte (RGB) */
+/* PixelFormat24bppRgb is internally stored by Cairo as a four bytes. Convert it to 3-byte (RGB) */
int
gdip_from_ARGB_to_RGB (BYTE *src, int width, int height, int stride, BYTE **dest, int* dest_stride)
{
@@ -1359,7 +1339,7 @@ gdip_from_ARGB_to_RGB (BYTE *src, int width, int height, int stride, BYTE **dest
}
-/* Format24bppRgb is internally stored by Cairo as a three bytes. Convert it to 4-byte (ARGB) */
+/* PixelFormat24bppRgb is internally stored by Cairo as a three bytes. Convert it to 4-byte (ARGB) */
int
gdip_from_RGB_to_ARGB (BYTE *src, int width, int height, int stride, BYTE **dest, int* dest_stride)
{
@@ -1423,28 +1403,28 @@ gdip_init_pixel_stream (StreamingState *state, BitmapData *data, int x, int y, i
* pixel; this doesn't necessarily mean that the pixel is aligned to the byte. This
* will be handled in gdip_pixel_stream_get_next () each time it starts a new row.
*/
- state->scan = (unsigned char *)(data->scan0) + y * data->stride;
+ state->scan = (BYTE*)(data->scan0) + y * data->stride;
switch (data->pixel_format) {
- case Format1bppIndexed:
+ case PixelFormat1bppIndexed:
state->one_pixel_mask = 0x01;
state->one_pixel_shift = 1;
state->pixels_per_byte = 8;
state->scan += (x >> 3); /* x * 1 / 8 */
break;
- case Format4bppIndexed:
+ case PixelFormat4bppIndexed:
state->one_pixel_mask = 0x0F;
state->one_pixel_shift = 4;
state->pixels_per_byte = 2;
state->scan += (x >> 1); /* x * 4 / 8 */
break;
- case Format8bppIndexed:
+ case PixelFormat8bppIndexed:
state->one_pixel_mask = 0xFF;
state->one_pixel_shift = 8;
state->pixels_per_byte = 1;
state->scan += x; /* x * 8 / 8 */
break;
- case Format24bppRgb:
+ case PixelFormat24bppRgb:
/* GDI+ use 3 bytes for 24 bpp while Cairo use 4 bytes */
if (data->reserved & GBD_TRUE24BPP) {
state->pixels_per_byte = -3;
@@ -1452,7 +1432,7 @@ gdip_init_pixel_stream (StreamingState *state, BitmapData *data, int x, int y, i
break;
}
/* else continue (don't break) */
- case Format32bppRgb:
+ case PixelFormat32bppRgb:
default:
/* indicate full RGB processing */
state->pixels_per_byte = -(gdip_get_pixel_format_bpp (data->pixel_format) >> 3);
@@ -1505,7 +1485,7 @@ gdip_pixel_stream_get_next (StreamingState *state)
state->x = state->region.X;
state->y++;
- state->scan = (unsigned char *)(state->data->scan0)
+ state->scan = (BYTE*)(state->data->scan0)
+ state->y * state->data->stride
+ state->x;
}
@@ -1545,7 +1525,7 @@ gdip_pixel_stream_get_next (StreamingState *state)
state->x = state->region.X;
state->y++;
- state->scan = (unsigned char *)(state->data->scan0)
+ state->scan = (BYTE*)(state->data->scan0)
+ state->y * state->data->stride
+ state->x * gdip_get_pixel_format_bpp (state->data->pixel_format) / 8;
@@ -1584,7 +1564,7 @@ gdip_pixel_stream_get_next (StreamingState *state)
state->x = state->region.X;
state->y++;
- state->scan = (unsigned char *)(state->data->scan0)
+ state->scan = (BYTE*)(state->data->scan0)
+ state->y * state->data->stride
+ state->x * -state->pixels_per_byte;
}
@@ -1616,7 +1596,7 @@ gdip_pixel_stream_set_next (StreamingState *state, unsigned int pixel_value)
state->x = state->region.X;
state->y++;
- state->scan = (unsigned char *)(state->data->scan0)
+ state->scan = (BYTE*)(state->data->scan0)
+ state->y * state->data->stride
+ state->x;
}
@@ -1674,7 +1654,7 @@ gdip_pixel_stream_set_next (StreamingState *state, unsigned int pixel_value)
state->x = state->region.X;
state->y++;
- state->scan = (unsigned char *)(state->data->scan0)
+ state->scan = (BYTE*)(state->data->scan0)
+ state->y * state->data->stride
+ state->x * gdip_get_pixel_format_bpp (state->data->pixel_format) / 8;
@@ -1698,9 +1678,9 @@ gdip_pixel_stream_set_next (StreamingState *state, unsigned int pixel_value)
state->scan [0] = (pixel_value >> 24);
state->scan [1] = (pixel_value >> 16);
state->scan [2] = (pixel_value >> 8);
- state->scan [3] = (state->data->pixel_format == Format32bppRgb) ? 0xFF : pixel_value;
+ state->scan [3] = (state->data->pixel_format == PixelFormat32bppRgb) ? 0xFF : pixel_value;
#else
- if (state->data->pixel_format == Format32bppRgb)
+ if (state->data->pixel_format == PixelFormat32bppRgb)
pixel_value |= 0xFF000000;
*(unsigned int *)state->scan = pixel_value;
#endif
@@ -1724,7 +1704,7 @@ gdip_pixel_stream_set_next (StreamingState *state, unsigned int pixel_value)
state->x = state->region.X;
state->y++;
- state->scan = (unsigned char *)(state->data->scan0)
+ state->scan = (BYTE*)(state->data->scan0)
+ state->y * state->data->stride
+ state->x * -state->pixels_per_byte;
}
@@ -1744,7 +1724,7 @@ gdip_pixel_stream_set_next (StreamingState *state, unsigned int pixel_value)
* - the pixel format conversion has already been validated.
*/
static GpStatus
-gdip_bitmap_change_rect_pixel_format (GdipBitmapData *srcData, Rect *srcRect, GdipBitmapData *destData, Rect *destRect)
+gdip_bitmap_change_rect_pixel_format (BitmapData *srcData, Rect *srcRect, BitmapData *destData, Rect *destRect)
{
PixelFormat srcFormat;
PixelFormat destFormat;
@@ -1817,9 +1797,9 @@ static BOOL
gdip_is_a_32bit_pixelformat (PixelFormat format)
{
switch (format) {
- case Format32bppRgb:
- case Format32bppArgb:
- case Format32bppPArgb: /* all of these use CAIRO_FORMAT_ARGB, which is 4 bytes wide */
+ case PixelFormat32bppRgb:
+ case PixelFormat32bppArgb:
+ case PixelFormat32bppPArgb: /* all of these use CAIRO_FORMAT_ARGB, which is 4 bytes wide */
return TRUE;
default:
return FALSE;
@@ -1869,18 +1849,18 @@ gdip_can_window_without_copy (BitmapData *data, Rect *rect, int format)
void
gdip_make_alpha_opaque (BitmapData *data)
{
- unsigned char *scan0;
+ BYTE *scan0;
int y;
int x;
int o;
int f;
/* sanity check; make sure we aren't mangling any image data */
- if ((data->pixel_format != Format32bppArgb) && (data->pixel_format != Format32bppRgb)) {
+ if ((data->pixel_format != PixelFormat32bppArgb) && (data->pixel_format != PixelFormat32bppRgb)) {
return;
}
- scan0 = (unsigned char *)data->scan0;
+ scan0 = (BYTE*)data->scan0;
f = data->stride - 4 * data->width;
@@ -1893,12 +1873,12 @@ gdip_make_alpha_opaque (BitmapData *data)
#endif
GpStatus
-GdipBitmapLockBits (GpBitmap *bitmap, Rect *srcRect, int flags, int format, GdipBitmapData *locked_data)
+GdipBitmapLockBits (GpBitmap *bitmap, GDIPCONST Rect *srcRect, UINT flags, PixelFormat format, BitmapData *locked_data)
{
int dest_pixel_format_bpp;
int dest_stride;
int dest_size;
- unsigned char *dest_scan0;
+ BYTE *dest_scan0;
Rect destRect;
GpStatus status;
BitmapData *root_data;
@@ -1951,7 +1931,7 @@ GdipBitmapLockBits (GpBitmap *bitmap, Rect *srcRect, int flags, int format, Gdip
root_data->reserved |= GBD_LOCKED;
switch (format) {
- case Format24bppRgb:
+ case PixelFormat24bppRgb:
/* workaround a hack we have (because Cairo use 32bits in this case) */
dest_pixel_format_bpp = 24;
locked_data->reserved |= GBD_TRUE24BPP;
@@ -1988,7 +1968,7 @@ GdipBitmapLockBits (GpBitmap *bitmap, Rect *srcRect, int flags, int format, Gdip
/* If the user wants the original data to be readable, then convert the bits. */
status = Ok;
if ((flags & ImageLockModeRead) != 0) {
- status = gdip_bitmap_change_rect_pixel_format (root_data, srcRect, locked_data, &destRect);
+ status = gdip_bitmap_change_rect_pixel_format (root_data, (GpRect*)srcRect, locked_data, &destRect);
if ((status != Ok) && ((flags & ImageLockModeUserInputBuf) == 0)) {
GdipFree (locked_data->scan0);
locked_data->scan0 = NULL;
@@ -1998,7 +1978,7 @@ GdipBitmapLockBits (GpBitmap *bitmap, Rect *srcRect, int flags, int format, Gdip
}
GpStatus
-GdipBitmapUnlockBits (GpBitmap *bitmap, GdipBitmapData *locked_data)
+GdipBitmapUnlockBits (GpBitmap *bitmap, BitmapData *locked_data)
{
GpStatus status;
BitmapData *root_data;;
@@ -2051,8 +2031,8 @@ GdipBitmapUnlockBits (GpBitmap *bitmap, GdipBitmapData *locked_data)
GpStatus
GdipBitmapSetPixel (GpBitmap *bitmap, int x, int y, ARGB color)
{
- BitmapData *data;
- unsigned char *v;
+ BitmapData *data;
+ BYTE *v;
if ((bitmap == NULL) || (bitmap->active_bitmap == NULL)) {
return InvalidParameter;
@@ -2067,19 +2047,19 @@ GdipBitmapSetPixel (GpBitmap *bitmap, int x, int y, ARGB color)
if (gdip_is_an_indexed_pixelformat (data->pixel_format))
return InvalidParameter;
- v = (unsigned char *)(data->scan0) + y * data->stride;
+ v = (BYTE*)(data->scan0) + y * data->stride;
switch (data->pixel_format) {
- case Format24bppRgb:
- case Format32bppRgb:
+ case PixelFormat24bppRgb:
+ case PixelFormat32bppRgb:
color |= 0xFF000000; /* force the alpha for Cairo */
/* fall through */
- case Format32bppArgb:
- case Format32bppPArgb: {
+ case PixelFormat32bppArgb:
+ case PixelFormat32bppPArgb: {
ARGB *scan = (ARGB *)v;
scan[x] = color;
break;
}
- case Format16bppGrayScale:
+ case PixelFormat16bppGrayScale:
return InvalidParameter;
default:
return NotImplemented;
@@ -2126,15 +2106,15 @@ GdipBitmapGetPixel (GpBitmap *bitmap, int x, int y, ARGB *color)
*color = data->palette->Entries[palette_index];
} else {
- unsigned char *v = ((unsigned char *)data->scan0) + y * data->stride;
+ BYTE *v = ((BYTE*)data->scan0) + y * data->stride;
switch (data->pixel_format) {
- case Format16bppGrayScale:
+ case PixelFormat16bppGrayScale:
return InvalidParameter;
- case Format24bppRgb:
- case Format32bppArgb:
- case Format32bppPArgb:
- case Format32bppRgb: {
+ case PixelFormat24bppRgb:
+ case PixelFormat32bppArgb:
+ case PixelFormat32bppPArgb:
+ case PixelFormat32bppRgb: {
ARGB *scan = (ARGB *)v;
*color = scan[x];
break;
@@ -2171,9 +2151,9 @@ gdip_bitmap_ensure_surface (GpBitmap *bitmap)
if ((bitmap->surface == NULL) && (data != NULL) && (data->scan0 != NULL)) {
switch (data->pixel_format) {
- case Format24bppRgb: {
+ case PixelFormat24bppRgb: {
bitmap->surface = cairo_image_surface_create_for_data(
- (unsigned char *)data->scan0,
+ (BYTE*)data->scan0,
CAIRO_FORMAT_RGB24,
data->width,
data->height,
@@ -2181,11 +2161,11 @@ gdip_bitmap_ensure_surface (GpBitmap *bitmap)
break;
}
- case Format32bppArgb:
- case Format32bppRgb:
- case Format32bppPArgb: {
+ case PixelFormat32bppArgb:
+ case PixelFormat32bppRgb:
+ case PixelFormat32bppPArgb: {
bitmap->surface = cairo_image_surface_create_for_data(
- (unsigned char *)data->scan0,
+ (BYTE*)data->scan0,
CAIRO_FORMAT_ARGB32,
data->width,
data->height,
@@ -2220,7 +2200,7 @@ gdip_convert_indexed_to_rgb (GpBitmap *indexed_bmp)
int y;
GpBitmap *ret;
GpStatus status;
- unsigned char *indexed_scan;
+ BYTE *indexed_scan;
ARGB *rgb_scan;
int pixels_this_byte;
unsigned short sample;
@@ -2240,18 +2220,30 @@ gdip_convert_indexed_to_rgb (GpBitmap *indexed_bmp)
}
switch (data->pixel_format) {
- case Format1bppIndexed: one_pixel_mask = 0x01; one_pixel_shift = 1; pixels_per_byte = 8; break;
- case Format4bppIndexed: one_pixel_mask = 0x0F; one_pixel_shift = 4; pixels_per_byte = 2; break;
- case Format8bppIndexed: one_pixel_mask = 0xFF; one_pixel_shift = 8; pixels_per_byte = 1; break;
- default: /* something is wrong!! */
- return NULL;
+ case PixelFormat1bppIndexed:
+ one_pixel_mask = 0x01;
+ one_pixel_shift = 1;
+ pixels_per_byte = 8;
+ break;
+ case PixelFormat4bppIndexed:
+ one_pixel_mask = 0x0F;
+ one_pixel_shift = 4;
+ pixels_per_byte = 2;
+ break;
+ case PixelFormat8bppIndexed:
+ one_pixel_mask = 0xFF;
+ one_pixel_shift = 8;
+ pixels_per_byte = 1;
+ break;
+ default: /* something is wrong!! */
+ return NULL;
}
if ((palette->Flags & PaletteFlagsHasAlpha) == 0) {
- format = Format32bppRgb;
+ format = PixelFormat32bppRgb;
set_pixel_bgra (&force_alpha, 0, 0, 0, 0, 0xFF); /* full alpha bits set */
} else {
- format = Format32bppArgb;
+ format = PixelFormat32bppArgb;
force_alpha = 0;
}
@@ -2270,7 +2262,7 @@ gdip_convert_indexed_to_rgb (GpBitmap *indexed_bmp)
/* convert the indexed pixels into RGB values and store them into the RGB frame */
for (y=0; y < data->height; y++) {
- indexed_scan = (unsigned char *)(data->scan0) + y * data->stride;
+ indexed_scan = (BYTE*)(data->scan0) + y * data->stride;
rgb_scan = rgb_scan0 + (y * data->width);
/* Speed up the 8bpp case */
if (pixels_per_byte == 1) {
@@ -2302,7 +2294,7 @@ gdip_convert_indexed_to_rgb (GpBitmap *indexed_bmp)
}
/* try to get a GpBitmap out of it :-) */
- status = GdipCreateBitmapFromScan0 (data->width, data->height, rgb_stride, format, rgb_scan0, &ret);
+ status = GdipCreateBitmapFromScan0 (data->width, data->height, rgb_stride, format, (BYTE*)rgb_scan0, &ret);
if (status == Ok) {
ret->active_bitmap->reserved = GBD_OWN_SCAN0;
return ret;
View
67 src/bitmap.h
@@ -0,0 +1,67 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Alexandre Pigolkine (pigolkine@gmx.de)
+ * Duncan Mak (duncan@ximian.com)
+ * Miguel de Icaza (miguel@ximian.com)
+ * Ravindra (rkumar@novell.com)
+ * Sanjay Gupta (gsanjay@novell.com)
+ * Vladimir Vukicevic (vladimir@pobox.com)
+ * Geoff Norton (gnorton@customerdna.com)
+ * Jonathan Gilbert (logic@deltaq.org)
+ * Sebastien Pouliot <sebastien@ximian.com>
+ *
+ * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com)
+ */
+
+#ifndef __BITMAP_H__
+#define __BITMAP_H__
+
+GpStatus GdipCreateBitmapFromFile (GDIPCONST WCHAR* filename, GpBitmap **bitmap);
+GpStatus GdipCreateBitmapFromFileICM (GDIPCONST WCHAR* filename, GpBitmap **bitmap);
+
+GpStatus GdipCreateBitmapFromScan0 (INT width, INT height, INT stride, PixelFormat format, BYTE* scan0, GpBitmap **bitmap);
+GpStatus GdipCreateBitmapFromGraphics (INT width, INT height, GpGraphics *target, GpBitmap **bitmap);
+
+GpStatus GdipCreateBitmapFromHBITMAP (HBITMAP hbm, HPALETTE hpal, GpBitmap** bitmap);
+GpStatus GdipCreateHBITMAPFromBitmap (GpBitmap* bitmap, HBITMAP *hbmReturn, ARGB background);
+
+GpStatus GdipCreateBitmapFromHICON (HICON hicon, GpBitmap** bitmap);
+GpStatus GdipCreateHICONFromBitmap (GpBitmap* bitmap, HICON *hbmReturn);
+
+GpStatus GdipCreateBitmapFromResource (HINSTANCE hInstance, GDIPCONST WCHAR *lpBitmapName, GpBitmap** bitmap);
+
+GpStatus GdipBitmapLockBits (GpBitmap *bitmap, GDIPCONST Rect *rect, UINT flags, PixelFormat format, BitmapData *lockedBitmapData);
+GpStatus GdipBitmapUnlockBits (GpBitmap *bitmap, BitmapData *lockedBitmapData);
+
+GpStatus GdipBitmapSetPixel (GpBitmap *bitmap, INT x, INT y, ARGB color);
+GpStatus GdipBitmapGetPixel (GpBitmap *bitmap, INT x, INT y, ARGB *color);
+
+GpStatus GdipCloneBitmapArea (REAL x, REAL y, REAL width, REAL height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap);
+GpStatus GdipCloneBitmapAreaI (INT x, INT y, INT width, INT height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap);
+
+GpStatus GdipBitmapSetResolution (GpBitmap *bitmap, REAL xdpi, REAL ydpi);
+
+
+/* missing API
+ GdipCreateBitmapFromStream
+ GdipCreateBitmapFromDirectDrawSurface
+ GdipCreateBitmapFromGdiDib
+ GdipCreateBitmapFromGdiDib
+*/
+
+#endif
View
162 src/bmpcodec.c
@@ -39,12 +39,10 @@
* Bitmap data
*/
-#include <stdio.h>
+#include "gdiplus-private.h"
#include "bmpcodec.h"
-#include "gdip.h"
-#include "gdipImage.h"
-#include "dstream.h"
+GUID gdip_bmp_image_format_guid = {0xb96b3cabU, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}};
/* Codecinfo related data*/
static ImageCodecInfo bmp_codec;
@@ -66,7 +64,7 @@ gdip_getcodecinfo_bmp ()
bmp_codec.FormatDescription = (const WCHAR*) bmp_format;
bmp_codec.FilenameExtension = (const WCHAR*) bmp_extension;
bmp_codec.MimeType = (const WCHAR*) bmp_mimetype;
- bmp_codec.Flags = Encoder | Decoder | SupportBitmap | Builtin;
+ bmp_codec.Flags = ImageCodecFlagsEncoder | ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin;
bmp_codec.Version = 1;
bmp_codec.SigCount = 1;
bmp_codec.SigSize = 2;
@@ -86,39 +84,39 @@ gdip_get_bmp_pixelformat (BITMAPINFOHEADER *bih, PixelFormat *dest)
case BI_RLE4:
if (bitCount != 4)
return InvalidParameter;
- *dest = Format4bppIndexed;
+ *dest = PixelFormat4bppIndexed;
break;
case BI_RLE8:
if (bitCount != 8)
return InvalidParameter;
- *dest = Format8bppIndexed;
+ *dest = PixelFormat8bppIndexed;
break;
case BI_BITFIELDS:
if (bitCount != 16)
return InvalidParameter;
/* note: incomplete at this stage */
- *dest = Format16bppRgb565;
+ *dest = PixelFormat16bppRgb565;
break;
default:
switch (bitCount) {
case 32:
- *dest = Format32bppRgb;
+ *dest = PixelFormat32bppRgb;
break;
case 24:
- *dest = Format24bppRgb;
+ *dest = PixelFormat24bppRgb;
break;
case 16:
/* MS produce such files (i.e. bad header) for storing ImageList bitmaps, see bug #80797 */
- *dest = Format16bppRgb565;
+ *dest = PixelFormat16bppRgb565;
break;
case 8:
- *dest = Format8bppIndexed;
+ *dest = PixelFormat8bppIndexed;
break;
case 4:
- *dest = Format4bppIndexed;
+ *dest = PixelFormat4bppIndexed;
break;
case 1:
- *dest = Format1bppIndexed;
+ *dest = PixelFormat1bppIndexed;
break;
default:
g_warning ("Unsupported bitcount (%d) and/or compression (%d).", bitCount, compression);
@@ -140,7 +138,7 @@ gdip_bitmap_fill_info_header (GpBitmap *bitmap, PBITMAPINFOHEADER bmi)
bmi->biWidth = GULONG_FROM_LE (bitmap->active_bitmap->width);
bmi->biHeight = GULONG_FROM_LE (bitmap->active_bitmap->height);
bmi->biPlanes = GUINT16_FROM_LE (1);
- if (format != Format24bppRgb)
+ if (format != PixelFormat24bppRgb)
bmi->biBitCount = GUINT16_FROM_LE (gdip_get_pixel_format_bpp (bitmap->active_bitmap->pixel_format));
else
bmi->biBitCount = GUINT16_FROM_LE (24);
@@ -153,7 +151,7 @@ gdip_bitmap_fill_info_header (GpBitmap *bitmap, PBITMAPINFOHEADER bmi)
bmi->biWidth = bitmap->active_bitmap->width;
bmi->biHeight = bitmap->active_bitmap->height;
bmi->biPlanes = 1;
- if (format != Format24bppRgb)
+ if (format != PixelFormat24bppRgb)
bmi->biBitCount = gdip_get_pixel_format_bpp (bitmap->active_bitmap->pixel_format);
else
bmi->biBitCount = 24;
@@ -166,16 +164,16 @@ gdip_bitmap_fill_info_header (GpBitmap *bitmap, PBITMAPINFOHEADER bmi)
}
static GpStatus
-gdip_read_bmp_rle_8bit (void *pointer, byte *scan0, bool upsidedown, int stride, int scanWidth, int scanCount, ImageSource source)
+gdip_read_bmp_rle_8bit (void *pointer, BYTE *scan0, BOOL upsidedown, int stride, int scanWidth, int scanCount, ImageSource source)
{
- byte code;
+ BYTE code;
int bytes_read;
int col_offset = 0;
int row_offset = (upsidedown ? (scanCount - 1) * stride : 0);
int row_delta = (upsidedown ? -stride : +stride);
int rows_remaining = scanCount;
- bool new_row = FALSE;
+ BOOL new_row = FALSE;
if (scanWidth > stride)
return InvalidParameter;
@@ -212,7 +210,7 @@ gdip_read_bmp_rle_8bit (void *pointer, byte *scan0, bool upsidedown, int stride,
}
case 2: /* jump forward (dx, dy) coordinates */
{
- byte dx, dy;
+ BYTE dx, dy;
bytes_read = gdip_read_bmp_data (pointer, &dx, 1, source);
bytes_read += gdip_read_bmp_data (pointer, &dy, 1, source);
@@ -235,7 +233,7 @@ gdip_read_bmp_rle_8bit (void *pointer, byte *scan0, bool upsidedown, int stride,
/* uncompressed sections must be an even number of bytes long,
* even if they are an odd number of *pixels* long.
*/
- bool pad_byte_present = ((code & 1) != 0);
+ BOOL pad_byte_present = ((code & 1) != 0);
int bytes_to_read = code;
/* wrap rows properly, even though they are inverted in memory */
@@ -286,7 +284,7 @@ gdip_read_bmp_rle_8bit (void *pointer, byte *scan0, bool upsidedown, int stride,
else {
/* we have a run of length 'code'. the colour of the run is the next byte in the file. */
int run_length = code;
- byte pixel_value;
+ BYTE pixel_value;
bytes_read = gdip_read_bmp_data(pointer, &pixel_value, 1, source);
@@ -325,16 +323,16 @@ gdip_read_bmp_rle_8bit (void *pointer, byte *scan0, bool upsidedown, int stride,
}
static GpStatus
-gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride, int scanWidth, int scanCount, ImageSource source)
+gdip_read_bmp_rle_4bit (void *pointer, BYTE *scan0, BOOL upsidedown, int stride, int scanWidth, int scanCount, ImageSource source)
{
- byte code;
+ BYTE code;
int bytes_read;
int col_offset = 0;
int row_offset = (upsidedown ? (scanCount - 1) * stride : 0);
int row_delta = (upsidedown ? -stride : +stride);
int rows_remaining = scanCount;
- bool new_row = FALSE;
+ BOOL new_row = FALSE;
if ((scanWidth & 1) != 0)
scanWidth++;
@@ -373,7 +371,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
}
case 2: /* jump forward (dx, dy) coordinates */
{
- byte dx, dy;
+ BYTE dx, dy;
bytes_read = gdip_read_bmp_data (pointer, &dx, 1, source);
bytes_read += gdip_read_bmp_data (pointer, &dy, 1, source);
@@ -400,7 +398,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
/* uncompressed sections must be an even number of bytes long,
* even if they are an odd number of *pixels* long.
*/
- bool pad_byte_present = ((bytes_of_data & 1) != 0);
+ BOOL pad_byte_present = ((bytes_of_data & 1) != 0);
int bytes_to_read = pixels_to_read / 2; /* leave off the last pixel for now */
@@ -408,7 +406,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
while (bytes_to_read > 0) {
if ((scanWidth - col_offset) == 1) {
/* special case: a pair of pixels is split across two rows. */
- byte pixels, same_row_pixel, next_row_pixel;
+ BYTE pixels, same_row_pixel, next_row_pixel;
bytes_read = gdip_read_bmp_data (pointer, &pixels, 1, source);
@@ -419,7 +417,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
next_row_pixel = pixels & 0x0F;
if ((col_offset & 1) != 0) {
- byte old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
+ BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | same_row_pixel;
}
else
@@ -465,7 +463,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
}
else {
/* bad alignment; nybble-swapping will be required */
- byte last_high_nybble = 0xF0 & scan0[row_offset + col_offset / 2];
+ BYTE last_high_nybble = 0xF0 & scan0[row_offset + col_offset / 2];
int bytes_to_read_this_scan = (scanWidth - col_offset) / 2;
@@ -473,7 +471,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
bytes_to_read_this_scan = bytes_to_read;
while (bytes_to_read_this_scan >= 0) {
- byte pixels;
+ BYTE pixels;
bytes_read = gdip_read_bmp_data (pointer, &pixels, 1, source);
@@ -505,7 +503,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
if ((pixels_to_read & 1) != 0) {
/* half of a byte remains to be inserted into the correct nybble */
- byte pixel;
+ BYTE pixel;
bytes_read = gdip_read_bmp_data (pointer, &pixel, 1, source);
@@ -515,7 +513,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
pixel >>= 4; /* the last pixel is in the high nybble */
if ((col_offset & 1) != 0) {
- byte old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
+ BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | pixel;
}
else
@@ -558,8 +556,8 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
int run_pixels = code;
int run_length = run_pixels / 2;
- byte pixel_values;
- byte inverted_pixel_values;
+ BYTE pixel_values;
+ BYTE inverted_pixel_values;
bytes_read = gdip_read_bmp_data(pointer, &pixel_values, 1, source);
@@ -569,7 +567,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
inverted_pixel_values = ((pixel_values & 0x0F) << 4) | ((pixel_values & 0xF0) >> 4);
if ((col_offset & 1) != 0) {
- byte temp = inverted_pixel_values;
+ BYTE temp = inverted_pixel_values;
inverted_pixel_values = pixel_values;
pixel_values = temp;
}
@@ -577,11 +575,11 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
while (run_length > 0) {
if ((scanWidth - col_offset) == 1) {
/* special case: a pair of pixels is split across two rows. */
- byte same_row_pixel = (pixel_values >> 4) & 0x0F;
- byte next_row_pixel = pixel_values & 0x0F;
+ BYTE same_row_pixel = (pixel_values >> 4) & 0x0F;
+ BYTE next_row_pixel = pixel_values & 0x0F;
if ((col_offset & 1) != 0) {
- byte old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
+ BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | same_row_pixel;
}
else
@@ -602,7 +600,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
/* if the width of the scan is odd, then the nybbles swap
* places each time they cross from one row to the next
*/
- byte temp = inverted_pixel_values;
+ BYTE temp = inverted_pixel_values;
inverted_pixel_values = pixel_values;
pixel_values = temp;
}
@@ -612,7 +610,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
/* make sure we're byte-aligned; if we're not, we need to store a nybble first */
if ((col_offset & 1) != 0) {
- byte old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
+ BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | (pixel_values & 0x0F);
col_offset++;
@@ -642,7 +640,7 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
/* if the width of the scan is odd, then the nybbles swap
* places each time they cross from one row to the next
*/
- byte temp = inverted_pixel_values;
+ BYTE temp = inverted_pixel_values;
inverted_pixel_values = pixel_values;
pixel_values = temp;
}
@@ -654,10 +652,10 @@ gdip_read_bmp_rle_4bit (void *pointer, byte *scan0, bool upsidedown, int stride,
if ((run_pixels & 1) != 0) {
/* half of a byte remains to be inserted into the correct nybble */
- byte pixel = pixel_values >> 4; /* the last pixel is in the high nybble */
+ BYTE pixel = pixel_values >> 4; /* the last pixel is in the high nybble */
if ((col_offset & 1) != 0) {
- byte old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
+ BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2];
scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | pixel;
}
else
@@ -688,7 +686,7 @@ GpStatus
gdip_read_BITMAPINFOHEADER (void *pointer, BITMAPINFOHEADER *bmi, ImageSource source, BOOL *os2format, BOOL *upsidedown)
{
DWORD dw = 0;
- byte *data_read = (byte*)&dw;
+ BYTE *data_read = (BYTE*)&dw;
int size = sizeof (DWORD);
int size_read = gdip_read_bmp_data (pointer, data_read, size, source);
if (size_read < size)
@@ -777,7 +775,7 @@ gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source)
{
BITMAPINFOHEADER bmi;
GpBitmap *result = NULL;
- guchar *pixels = NULL;
+ BYTE *pixels = NULL;
int i;
PixelFormat format;
int colours;
@@ -785,7 +783,7 @@ gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source)
BOOL upsidedown = TRUE;
int size;
int size_read;
- byte *data_read = NULL;
+ BYTE *data_read = NULL;
int line;
int loop;
long index;
@@ -810,7 +808,7 @@ gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source)
}
/* for 16bbp images we need to be more precise */
- if (format == Format16bppRgb565) {
+ if (format == PixelFormat16bppRgb565) {
/* check if we're dealing with a BITMAPV4HEADER (or later) structure */
if (bmi.biSize >= sizeof (BITMAPV4HEADER)) {
/* the new structure contains the ARGB masks */
@@ -850,34 +848,34 @@ gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source)
/* note: CAIRO_FORMAT_RGB16_565 is deprecated so we're promoting the bitmap to 32RGB */
/* why 32bpp when 24 would be enough ? because MS GDI+ loads them as such, but can't display them (empty) */
- format = Format32bppRgb;
+ format = PixelFormat32bppRgb;
/* 16bbp bitmap don't seems reversed like their height indicates */
upsidedown = FALSE;
}
result = gdip_bitmap_new_with_frame (NULL, TRUE);
- result->type = imageBitmap;
+ result->type = ImageTypeBitmap;
result->image_format = BMP;
result->active_bitmap->pixel_format = format;
result->active_bitmap->width = bmi.biWidth;
result->active_bitmap->height = bmi.biHeight;
switch (result->active_bitmap->pixel_format) {
- case Format1bppIndexed:
+ case PixelFormat1bppIndexed:
result->active_bitmap->stride = (result->active_bitmap->width + 7) / 8;
break;
- case Format4bppIndexed:
+ case PixelFormat4bppIndexed:
result->active_bitmap->stride = (result->active_bitmap->width + 1) / 2;
break;
- case Format8bppIndexed:
+ case PixelFormat8bppIndexed:
result->active_bitmap->stride = result->active_bitmap->width;
break;
- case Format24bppRgb:
+ case PixelFormat24bppRgb:
result->active_bitmap->stride = result->active_bitmap->width * 4;
break;
default:
/* For other types, we assume 32 bit and translate into 32 bit from source format */
- result->active_bitmap->pixel_format = Format32bppRgb;
+ result->active_bitmap->pixel_format = PixelFormat32bppRgb;
result->active_bitmap->stride = result->active_bitmap->width * 4;
break;
}
@@ -888,7 +886,7 @@ gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source)
if (colours) {
int palette_entries = colours;
- if (result->active_bitmap->pixel_format == Format4bppIndexed) {
+ if (result->active_bitmap->pixel_format == PixelFormat4bppIndexed) {
palette_entries = 256;
}
@@ -900,13 +898,9 @@ gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source)
result->active_bitmap->palette->Flags = 0;
result->active_bitmap->palette->Count = palette_entries;
- /* Read optional colour table*/
- if (os2format) {
- size = sizeof(byte)*3; /* RGBTRIPLE */
- } else {
- size = sizeof(byte)*4; /* RGBquads */
- }
- data_read = (byte*) GdipAlloc(size);
+ /* Read optional colour table */
+ size = (os2format) ? 3 /* RGBTRIPLE */ : 4 /* RGBquads */;
+ data_read = (BYTE*) GdipAlloc(size);
if (data_read == NULL) {
status = OutOfMemory;
goto error;
@@ -973,7 +967,7 @@ gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source)
}
}
- data_read = (byte*) GdipAlloc(size);
+ data_read = (BYTE*) GdipAlloc(size);
if (data_read == NULL) {
status = OutOfMemory;
goto error;
@@ -1122,7 +1116,7 @@ gdip_load_bmp_image_from_stream_delegate (dstream_t *loader, GpImage **image)
}
int
-gdip_read_bmp_data (void *pointer, byte *data, int size, ImageSource source)
+gdip_read_bmp_data (void *pointer, BYTE *data, int size, ImageSource source)
{
switch (source) {
case File:
@@ -1164,7 +1158,7 @@ gdip_read_bmp_data (void *pointer, byte *data, int size, ImageSource source)
}
static void
-gdip_write_bmp_data (void *pointer, byte *data, int size, bool useFile)
+gdip_write_bmp_data (void *pointer, BYTE *data, int size, BOOL useFile)
{
if (useFile)
fwrite (data, 1, size, (FILE*) pointer);
@@ -1173,7 +1167,7 @@ gdip_write_bmp_data (void *pointer, byte *data, int size, bool useFile)
}
static GpStatus
-gdip_save_bmp_image_to_file_stream (void *pointer, GpImage *image, bool useFile)
+gdip_save_bmp_image_to_file_stream (void *pointer, GpImage *image, BOOL useFile)
{
BITMAPFILEHEADER bmfh;
BITMAPINFOHEADER bmi;
@@ -1181,13 +1175,13 @@ gdip_save_bmp_image_to_file_stream (void *pointer, GpImage *image, bool useFile)
int i;
ARGB color;
int colours = 0;
- unsigned char *entries;
+ BYTE *entries;
int palette_entries;
BitmapData *activebmp;
- byte *scan0;
+ BYTE *scan0;
activebmp = image->active_bitmap;
- if (activebmp->pixel_format != Format24bppRgb) {
+ if (activebmp->pixel_format != PixelFormat24bppRgb) {
bitmapLen = activebmp->stride * activebmp->height;
} else {
bitmapLen = activebmp->width * 3;
@@ -1211,21 +1205,21 @@ gdip_save_bmp_image_to_file_stream (void *pointer, GpImage *image, bool useFile)
bmfh.bfOffBits = (14 + 40 + colours * 4);
bmfh.bfSize = (bmfh.bfOffBits + bitmapLen);
#endif
- gdip_write_bmp_data (pointer, (byte *)&bmfh, sizeof (bmfh), useFile);
+ gdip_write_bmp_data (pointer, (BYTE*) &bmfh, sizeof (bmfh), useFile);
gdip_bitmap_fill_info_header (image, &bmi);
- gdip_write_bmp_data (pointer, (byte *)&bmi, sizeof (bmi), useFile);
+ gdip_write_bmp_data (pointer, (BYTE*) &bmi, sizeof (bmi), useFile);
if (colours) {
int idx;
palette_entries = activebmp->palette->Count;
- if (activebmp->pixel_format == Format4bppIndexed) {
+ if (activebmp->pixel_format == PixelFormat4bppIndexed) {
palette_entries = 16;
}
- entries = (unsigned char *) GdipAlloc (palette_entries*4);
+ entries = (BYTE*) GdipAlloc (palette_entries*4);
if (entries == NULL)
return OutOfMemory;
@@ -1247,21 +1241,21 @@ gdip_save_bmp_image_to_file_stream (void *pointer, GpImage *image, bool useFile)
}
scan0 = activebmp->scan0;
- if (activebmp->pixel_format == Format24bppRgb) {
+ if (activebmp->pixel_format == PixelFormat24bppRgb) {
int width = activebmp->width;
int height = activebmp->height;
int mystride;
int k;
- byte *current_line;
+ BYTE *current_line;