mshtml: Fixed a leak (valgrind).
[wine] / dlls / gdiplus / gdiplus_private.h
index aa03727..bdfb204 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "objbase.h"
 #include "ocidl.h"
+#include "wine/list.h"
 
 #include "gdiplus.h"
 
 #define INCH_HIMETRIC (2540)
 
 #define VERSION_MAGIC 0xdbc01001
+#define TENSION_CONST (0.3)
 
 COLORREF ARGB2COLORREF(ARGB color);
+HBITMAP ARGB2BMP(ARGB color);
 extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
     REAL startAngle, REAL sweepAngle);
 extern REAL gdiplus_atan2(REAL dy, REAL dx);
 extern GpStatus hresult_to_status(HRESULT res);
-extern REAL convert_unit(HDC hdc, GpUnit unit);
+extern REAL convert_unit(REAL logpixels, GpUnit unit);
+
+extern GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics);
+
+extern void calc_curve_bezier(CONST GpPointF *pts, REAL tension, REAL *x1,
+    REAL *y1, REAL *x2, REAL *y2);
+extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj,
+    REAL tension, REAL *x, REAL *y);
+
+extern void free_installed_fonts(void);
+
+extern BOOL lengthen_path(GpPath *path, INT len);
+
+extern GpStatus trace_path(GpGraphics *graphics, GpPath *path);
+
+typedef struct region_element region_element;
+extern void delete_element(region_element *element);
+
+extern GpStatus get_hatch_data(HatchStyle hatchstyle, const char **result);
 
 static inline INT roundr(REAL x)
 {
     return (INT) floorf(x + 0.5);
 }
 
+static inline INT ceilr(REAL x)
+{
+    return (INT) ceilf(x);
+}
+
 static inline REAL deg2rad(REAL degrees)
 {
     return M_PI * degrees / 180.0;
 }
 
+static inline ARGB color_over(ARGB bg, ARGB fg)
+{
+    BYTE b, g, r, a;
+    BYTE bg_alpha, fg_alpha;
+
+    fg_alpha = (fg>>24)&0xff;
+
+    if (fg_alpha == 0xff) return fg;
+
+    if (fg_alpha == 0) return bg;
+
+    bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff;
+
+    if (bg_alpha == 0) return fg;
+
+    a = bg_alpha + fg_alpha;
+    b = ((bg&0xff)*bg_alpha + (fg&0xff)*fg_alpha)/a;
+    g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*fg_alpha)/a;
+    r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*fg_alpha)/a;
+
+    return (a<<24)|(r<<16)|(g<<8)|b;
+}
+
+extern const char *debugstr_rectf(CONST RectF* rc);
+
+extern const char *debugstr_pointf(CONST PointF* pt);
+
+extern void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height,
+    BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride);
+
+extern GpStatus convert_pixels(UINT width, UINT height,
+    INT dst_stride, BYTE *dst_bits, PixelFormat dst_format,
+    INT src_stride, const BYTE *src_bits, PixelFormat src_format, ARGB *src_palette);
+
 struct GpPen{
     UINT style;
     GpUnit unit;
@@ -72,11 +132,14 @@ struct GpPen{
     INT numdashes;
     REAL offset;    /* dash offset */
     GpBrush *brush;
+    GpPenAlignment align;
 };
 
 struct GpGraphics{
     HDC hdc;
     HWND hwnd;
+    BOOL owndc;
+    GpImage *image;
     SmoothingMode smoothing;
     CompositingQuality compqual;
     InterpolationMode interpolation;
@@ -86,6 +149,17 @@ struct GpGraphics{
     GpUnit unit;    /* page unit */
     REAL scale;     /* page scale */
     GpMatrix * worldtrans; /* world transform */
+    BOOL busy;      /* hdc handle obtained by GdipGetDC */
+    GpRegion *clip;
+    UINT textcontrast; /* not used yet. get/set only */
+    struct list containers;
+    GraphicsContainer contid; /* last-issued container ID */
+    /* For giving the caller an HDC when we technically can't: */
+    HBITMAP temp_hbitmap;
+    int temp_hbitmap_width;
+    int temp_hbitmap_height;
+    BYTE *temp_bits;
+    HDC temp_hdc;
 };
 
 struct GpBrush{
@@ -94,9 +168,17 @@ struct GpBrush{
     LOGBRUSH lb;
 };
 
+struct GpHatch{
+    GpBrush brush;
+    HatchStyle hatchstyle;
+    ARGB forecol;
+    ARGB backcol;
+};
+
 struct GpSolidFill{
     GpBrush brush;
     ARGB color;
+    HBITMAP bmp;
 };
 
 struct GpPathGradient{
@@ -118,12 +200,22 @@ struct GpLineGradient{
     GpPointF endpoint;
     ARGB startcolor;
     ARGB endcolor;
+    RectF rect;
     GpWrapMode wrap;
     BOOL gamma;
+    REAL* blendfac;  /* blend factors */
+    REAL* blendpos;  /* blend positions */
+    INT blendcount;
+    ARGB* pblendcolor; /* preset blend colors */
+    REAL* pblendpos; /* preset blend positions */
+    INT pblendcount;
 };
 
 struct GpTexture{
     GpBrush brush;
+    GpMatrix *transform;
+    GpImage *image;
+    GpImageAttributes *imageattributes;
 };
 
 struct GpPath{
@@ -150,12 +242,23 @@ struct GpCustomLineCap{
     GpLineCap cap;  /* as far as I can tell, this value is ignored */
     REAL inset;     /* how much to adjust the end of the line */
     GpLineJoin join;
+    REAL scale;
+};
+
+struct GpAdustableArrowCap{
+    GpCustomLineCap cap;
 };
 
 struct GpImage{
     IPicture* picture;
     ImageType type;
+    GUID format;
     UINT flags;
+    UINT palette_flags;
+    UINT palette_count;
+    UINT palette_size;
+    ARGB *palette_entries;
+    REAL xres, yres;
 };
 
 struct GpMetafile{
@@ -172,29 +275,75 @@ struct GpBitmap{
     ImageLockMode lockmode;
     INT numlocks;
     BYTE *bitmapbits;   /* pointer to the buffer we passed in BitmapLockBits */
+    HBITMAP hbitmap;
+    HDC hdc;
+    BYTE *bits; /* actual image bits if this is a DIB */
+    INT stride; /* stride of bits if this is a DIB */
+    BYTE *own_bits; /* image bits that need to be freed with this object */
+};
+
+struct GpCachedBitmap{
+    GpImage *image;
+};
+
+struct color_key{
+    BOOL enabled;
+    ARGB low;
+    ARGB high;
+};
+
+struct color_matrix{
+    BOOL enabled;
+    ColorMatrixFlags flags;
+    ColorMatrix colormatrix;
+    ColorMatrix graymatrix;
+};
+
+struct color_remap_table{
+    BOOL enabled;
+    INT mapsize;
+    GDIPCONST ColorMap *colormap;
 };
 
 struct GpImageAttributes{
     WrapMode wrap;
+    ARGB outside_color;
+    BOOL clamp;
+    struct color_key colorkeys[ColorAdjustTypeCount];
+    struct color_matrix colormatrices[ColorAdjustTypeCount];
+    struct color_remap_table colorremaptables[ColorAdjustTypeCount];
+    BOOL gamma_enabled[ColorAdjustTypeCount];
+    REAL gamma[ColorAdjustTypeCount];
 };
 
 struct GpFont{
     LOGFONTW lfw;
     REAL emSize;
+    UINT height;
+    LONG line_spacing;
     Unit unit;
 };
 
 struct GpStringFormat{
     INT attr;
     LANGID lang;
+    LANGID digitlang;
     StringAlignment align;
     StringTrimming trimming;
     HotkeyPrefix hkprefix;
     StringAlignment vertalign;
+    StringDigitSubstitute digitsub;
+    INT tabcount;
+    REAL firsttab;
+    REAL *tabs;
+    CharacterRange *character_ranges;
+    INT range_count;
 };
 
 struct GpFontCollection{
-    GpFontFamily* FontFamilies;
+    GpFontFamily **FontFamilies;
+    INT count;
+    INT allocated;
 };
 
 struct GpFontFamily{
@@ -202,7 +351,16 @@ struct GpFontFamily{
     WCHAR FamilyName[LF_FACESIZE];
 };
 
-typedef struct region_element
+/* internal use */
+typedef enum RegionType
+{
+    RegionDataRect          = 0x10000000,
+    RegionDataPath          = 0x10000001,
+    RegionDataEmptyRect     = 0x10000002,
+    RegionDataInfiniteRect  = 0x10000003,
+} RegionType;
+
+struct region_element
 {
     DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
     union
@@ -225,7 +383,7 @@ typedef struct region_element
             struct region_element *right; /* what *left was combined with */
         } combine;
     } elementdata;
-} region_element;
+};
 
 struct GpRegion{
     struct