2007-06-11 11:51:15 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Google (Evan Stade)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_GP_PRIVATE_H_
|
|
|
|
#define __WINE_GP_PRIVATE_H_
|
|
|
|
|
2007-07-11 18:06:44 -07:00
|
|
|
#include <math.h>
|
2007-07-30 19:10:03 -07:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2007-06-11 11:51:15 -07:00
|
|
|
#include "windef.h"
|
2007-07-19 18:22:59 -07:00
|
|
|
#include "wingdi.h"
|
2007-07-30 19:10:03 -07:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
|
|
|
|
#include "objbase.h"
|
|
|
|
#include "ocidl.h"
|
2009-07-05 17:04:20 -05:00
|
|
|
#include "wine/list.h"
|
2007-07-30 19:10:03 -07:00
|
|
|
|
2007-06-11 11:51:15 -07:00
|
|
|
#include "gdiplus.h"
|
|
|
|
|
2007-07-16 19:45:16 -07:00
|
|
|
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
|
2007-07-11 18:06:56 -07:00
|
|
|
#define MAX_ARC_PTS (13)
|
2007-07-27 16:07:39 -07:00
|
|
|
#define MAX_DASHLEN (16) /* this is a limitation of gdi */
|
2007-07-30 19:10:03 -07:00
|
|
|
#define INCH_HIMETRIC (2540)
|
2007-06-11 11:51:15 -07:00
|
|
|
|
2008-07-24 19:01:21 -04:00
|
|
|
#define VERSION_MAGIC 0xdbc01001
|
2008-08-03 02:44:57 +04:00
|
|
|
#define TENSION_CONST (0.3)
|
2008-07-24 19:01:21 -04:00
|
|
|
|
2007-06-11 11:51:15 -07:00
|
|
|
COLORREF ARGB2COLORREF(ARGB color);
|
2009-05-20 11:24:18 -05:00
|
|
|
HBITMAP ARGB2BMP(ARGB color);
|
2007-07-11 18:06:56 -07:00
|
|
|
extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
|
|
|
|
REAL startAngle, REAL sweepAngle);
|
2007-08-03 00:53:23 +02:00
|
|
|
extern REAL gdiplus_atan2(REAL dy, REAL dx);
|
2007-08-07 18:42:00 -07:00
|
|
|
extern GpStatus hresult_to_status(HRESULT res);
|
2007-08-07 18:42:09 -07:00
|
|
|
extern REAL convert_unit(HDC hdc, GpUnit unit);
|
2007-06-11 11:51:15 -07:00
|
|
|
|
2008-08-03 02:44:57 +04:00
|
|
|
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);
|
|
|
|
|
2009-04-27 18:56:56 -05:00
|
|
|
extern void free_installed_fonts(void);
|
|
|
|
|
2008-08-05 20:56:30 +04:00
|
|
|
extern BOOL lengthen_path(GpPath *path, INT len);
|
|
|
|
|
2008-11-24 15:01:47 -06:00
|
|
|
extern GpStatus trace_path(GpGraphics *graphics, GpPath *path);
|
|
|
|
|
2008-08-27 02:03:27 +04:00
|
|
|
typedef struct region_element region_element;
|
2009-10-19 11:44:39 +02:00
|
|
|
extern void delete_element(region_element *element);
|
2008-08-27 02:03:27 +04:00
|
|
|
|
2007-07-11 18:06:44 -07:00
|
|
|
static inline INT roundr(REAL x)
|
|
|
|
{
|
|
|
|
return (INT) floorf(x + 0.5);
|
|
|
|
}
|
|
|
|
|
2009-08-25 13:39:18 -05:00
|
|
|
static inline INT ceilr(REAL x)
|
|
|
|
{
|
|
|
|
return (INT) ceilf(x);
|
|
|
|
}
|
|
|
|
|
2007-07-11 18:06:44 -07:00
|
|
|
static inline REAL deg2rad(REAL degrees)
|
|
|
|
{
|
|
|
|
return M_PI * degrees / 180.0;
|
|
|
|
}
|
|
|
|
|
2009-05-13 13:55:46 -05:00
|
|
|
extern const char *debugstr_rectf(CONST RectF* rc);
|
|
|
|
|
2009-12-18 15:45:02 -06:00
|
|
|
extern const char *debugstr_pointf(CONST PointF* pt);
|
|
|
|
|
2009-08-28 17:21:10 -05:00
|
|
|
extern void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height,
|
|
|
|
BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride);
|
|
|
|
|
2010-02-04 19:05:54 -06:00
|
|
|
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);
|
|
|
|
|
2007-06-11 11:51:15 -07:00
|
|
|
struct GpPen{
|
|
|
|
UINT style;
|
|
|
|
GpUnit unit;
|
|
|
|
REAL width;
|
2007-07-05 18:37:52 -07:00
|
|
|
GpLineCap endcap;
|
2007-07-16 19:44:50 -07:00
|
|
|
GpLineCap startcap;
|
|
|
|
GpDashCap dashcap;
|
2007-07-19 18:22:43 -07:00
|
|
|
GpCustomLineCap *customstart;
|
|
|
|
GpCustomLineCap *customend;
|
2007-07-12 19:42:47 -07:00
|
|
|
GpLineJoin join;
|
|
|
|
REAL miterlimit;
|
2007-07-16 19:45:16 -07:00
|
|
|
GpDashStyle dash;
|
2007-07-25 19:15:38 -07:00
|
|
|
REAL *dashes;
|
|
|
|
INT numdashes;
|
2007-08-08 19:42:03 -07:00
|
|
|
REAL offset; /* dash offset */
|
2007-07-19 18:22:59 -07:00
|
|
|
GpBrush *brush;
|
2008-07-31 09:08:32 +04:00
|
|
|
GpPenAlignment align;
|
2007-06-11 11:51:15 -07:00
|
|
|
};
|
|
|
|
|
2007-06-11 11:54:03 -07:00
|
|
|
struct GpGraphics{
|
|
|
|
HDC hdc;
|
|
|
|
HWND hwnd;
|
2009-04-24 13:29:56 -05:00
|
|
|
BOOL owndc;
|
2007-07-13 17:51:13 -07:00
|
|
|
SmoothingMode smoothing;
|
2007-07-13 17:51:25 -07:00
|
|
|
CompositingQuality compqual;
|
2007-07-13 17:51:29 -07:00
|
|
|
InterpolationMode interpolation;
|
2007-07-13 17:51:33 -07:00
|
|
|
PixelOffsetMode pixeloffset;
|
2007-08-13 18:34:27 -07:00
|
|
|
CompositingMode compmode;
|
2007-08-14 19:00:09 -07:00
|
|
|
TextRenderingHint texthint;
|
2007-07-23 20:24:41 -07:00
|
|
|
GpUnit unit; /* page unit */
|
2007-07-24 17:18:39 -07:00
|
|
|
REAL scale; /* page scale */
|
2007-07-24 17:18:47 -07:00
|
|
|
GpMatrix * worldtrans; /* world transform */
|
2008-08-24 14:45:18 +04:00
|
|
|
BOOL busy; /* hdc handle obtained by GdipGetDC */
|
2008-08-27 02:03:27 +04:00
|
|
|
GpRegion *clip;
|
2008-11-09 14:32:26 +03:00
|
|
|
UINT textcontrast; /* not used yet. get/set only */
|
2009-07-05 17:04:20 -05:00
|
|
|
struct list containers;
|
|
|
|
GraphicsContainer contid; /* last-issued container ID */
|
2007-06-11 11:54:03 -07:00
|
|
|
};
|
|
|
|
|
2007-06-14 16:09:07 -07:00
|
|
|
struct GpBrush{
|
|
|
|
HBRUSH gdibrush;
|
|
|
|
GpBrushType bt;
|
2007-07-19 18:22:59 -07:00
|
|
|
LOGBRUSH lb;
|
2007-06-14 16:09:07 -07:00
|
|
|
};
|
|
|
|
|
2009-01-10 18:45:11 -05:00
|
|
|
struct GpHatch{
|
|
|
|
GpBrush brush;
|
|
|
|
HatchStyle hatchstyle;
|
|
|
|
ARGB forecol;
|
|
|
|
ARGB backcol;
|
|
|
|
};
|
|
|
|
|
2007-06-14 16:09:07 -07:00
|
|
|
struct GpSolidFill{
|
|
|
|
GpBrush brush;
|
2007-07-23 20:24:24 -07:00
|
|
|
ARGB color;
|
2009-05-20 11:24:18 -05:00
|
|
|
HBITMAP bmp;
|
2007-06-14 16:09:07 -07:00
|
|
|
};
|
|
|
|
|
2007-08-01 17:56:02 -07:00
|
|
|
struct GpPathGradient{
|
|
|
|
GpBrush brush;
|
2007-08-02 17:51:49 -07:00
|
|
|
PathData pathdata;
|
2007-08-01 17:56:02 -07:00
|
|
|
ARGB centercolor;
|
2007-08-01 17:56:10 -07:00
|
|
|
GpWrapMode wrap;
|
2007-08-02 17:52:49 -07:00
|
|
|
BOOL gamma;
|
2007-08-02 17:52:59 -07:00
|
|
|
GpPointF center;
|
2007-08-02 17:53:04 -07:00
|
|
|
GpPointF focus;
|
2008-07-21 23:30:39 +04:00
|
|
|
REAL* blendfac; /* blend factors */
|
|
|
|
REAL* blendpos; /* blend positions */
|
|
|
|
INT blendcount;
|
2007-08-01 17:56:02 -07:00
|
|
|
};
|
|
|
|
|
2007-08-07 18:42:29 -07:00
|
|
|
struct GpLineGradient{
|
|
|
|
GpBrush brush;
|
|
|
|
GpPointF startpoint;
|
|
|
|
GpPointF endpoint;
|
|
|
|
ARGB startcolor;
|
|
|
|
ARGB endcolor;
|
2009-05-07 11:33:28 -05:00
|
|
|
RectF rect;
|
2007-08-07 18:42:29 -07:00
|
|
|
GpWrapMode wrap;
|
2007-08-07 18:42:40 -07:00
|
|
|
BOOL gamma;
|
2009-04-28 18:03:41 -05:00
|
|
|
REAL* blendfac; /* blend factors */
|
|
|
|
REAL* blendpos; /* blend positions */
|
|
|
|
INT blendcount;
|
2009-09-14 16:21:50 -05:00
|
|
|
ARGB* pblendcolor; /* preset blend colors */
|
|
|
|
REAL* pblendpos; /* preset blend positions */
|
|
|
|
INT pblendcount;
|
2007-08-07 18:42:29 -07:00
|
|
|
};
|
|
|
|
|
2007-08-09 18:25:14 -07:00
|
|
|
struct GpTexture{
|
|
|
|
GpBrush brush;
|
2008-09-25 08:54:24 +04:00
|
|
|
GpMatrix *transform;
|
2010-02-11 16:43:45 -06:00
|
|
|
GpImage *image;
|
2008-10-21 19:39:21 +04:00
|
|
|
WrapMode wrap; /* not used yet */
|
2007-08-09 18:25:14 -07:00
|
|
|
};
|
|
|
|
|
2007-06-21 16:15:17 -07:00
|
|
|
struct GpPath{
|
|
|
|
GpFillMode fill;
|
|
|
|
GpPathData pathdata;
|
|
|
|
BOOL newfigure; /* whether the next drawing action starts a new figure */
|
2007-07-06 16:14:07 -07:00
|
|
|
INT datalen; /* size of the arrays in pathdata */
|
2007-06-21 16:15:17 -07:00
|
|
|
};
|
|
|
|
|
2007-07-11 18:07:48 -07:00
|
|
|
struct GpMatrix{
|
|
|
|
REAL matrix[6];
|
|
|
|
};
|
|
|
|
|
2007-07-16 19:45:02 -07:00
|
|
|
struct GpPathIterator{
|
|
|
|
GpPathData pathdata;
|
|
|
|
INT subpath_pos; /* for NextSubpath methods */
|
|
|
|
INT marker_pos; /* for NextMarker methods */
|
|
|
|
INT pathtype_pos; /* for NextPathType methods */
|
|
|
|
};
|
|
|
|
|
2007-07-19 18:22:34 -07:00
|
|
|
struct GpCustomLineCap{
|
|
|
|
GpPathData pathdata;
|
|
|
|
BOOL fill; /* TRUE for fill, FALSE for stroke */
|
|
|
|
GpLineCap cap; /* as far as I can tell, this value is ignored */
|
|
|
|
REAL inset; /* how much to adjust the end of the line */
|
2008-07-26 12:48:01 +04:00
|
|
|
GpLineJoin join;
|
2008-07-26 12:48:16 +04:00
|
|
|
REAL scale;
|
2007-07-19 18:22:34 -07:00
|
|
|
};
|
|
|
|
|
2008-09-03 20:34:58 +04:00
|
|
|
struct GpAdustableArrowCap{
|
|
|
|
GpCustomLineCap cap;
|
|
|
|
};
|
|
|
|
|
2007-07-30 19:10:03 -07:00
|
|
|
struct GpImage{
|
|
|
|
IPicture* picture;
|
|
|
|
ImageType type;
|
2009-09-14 11:23:45 -05:00
|
|
|
GUID format;
|
2008-05-09 16:39:43 +04:00
|
|
|
UINT flags;
|
2009-12-11 16:51:46 -06:00
|
|
|
UINT palette_flags;
|
|
|
|
UINT palette_count;
|
|
|
|
UINT palette_size;
|
|
|
|
ARGB *palette_entries;
|
2009-12-26 20:46:55 -05:00
|
|
|
REAL xres, yres;
|
2007-07-30 19:10:03 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GpMetafile{
|
|
|
|
GpImage image;
|
2007-07-30 19:09:57 -07:00
|
|
|
GpRectF bounds;
|
|
|
|
GpUnit unit;
|
2007-07-30 19:10:03 -07:00
|
|
|
};
|
|
|
|
|
2007-07-31 19:15:52 -07:00
|
|
|
struct GpBitmap{
|
|
|
|
GpImage image;
|
2007-07-31 19:16:20 -07:00
|
|
|
INT width;
|
|
|
|
INT height;
|
2007-08-03 17:30:30 -07:00
|
|
|
PixelFormat format;
|
2007-08-07 18:41:55 -07:00
|
|
|
ImageLockMode lockmode;
|
|
|
|
INT numlocks;
|
|
|
|
BYTE *bitmapbits; /* pointer to the buffer we passed in BitmapLockBits */
|
2009-08-28 14:49:35 -05:00
|
|
|
HBITMAP hbitmap;
|
2009-08-28 15:05:38 -05:00
|
|
|
HDC hdc;
|
2009-08-28 16:53:57 -05:00
|
|
|
BYTE *bits; /* actual image bits if this is a DIB */
|
|
|
|
INT stride; /* stride of bits if this is a DIB */
|
2007-07-31 19:15:52 -07:00
|
|
|
};
|
|
|
|
|
2008-11-04 08:54:32 +03:00
|
|
|
struct GpCachedBitmap{
|
2008-11-21 16:57:48 -06:00
|
|
|
GpImage *image;
|
2008-11-04 08:54:32 +03:00
|
|
|
};
|
|
|
|
|
2009-07-24 17:57:38 -05:00
|
|
|
struct color_key{
|
|
|
|
BOOL enabled;
|
|
|
|
ARGB low;
|
|
|
|
ARGB high;
|
|
|
|
};
|
|
|
|
|
2009-12-18 17:42:18 -06:00
|
|
|
struct color_matrix{
|
|
|
|
BOOL enabled;
|
|
|
|
ColorMatrixFlags flags;
|
|
|
|
ColorMatrix colormatrix;
|
|
|
|
ColorMatrix graymatrix;
|
|
|
|
};
|
|
|
|
|
2007-07-30 19:09:54 -07:00
|
|
|
struct GpImageAttributes{
|
|
|
|
WrapMode wrap;
|
2009-07-24 17:57:38 -05:00
|
|
|
struct color_key colorkeys[ColorAdjustTypeCount];
|
2009-12-18 17:42:18 -06:00
|
|
|
struct color_matrix colormatrices[ColorAdjustTypeCount];
|
2010-01-30 17:09:06 -06:00
|
|
|
BOOL gamma_enabled[ColorAdjustTypeCount];
|
|
|
|
REAL gamma[ColorAdjustTypeCount];
|
2007-07-30 19:09:54 -07:00
|
|
|
};
|
|
|
|
|
2007-08-13 18:34:51 -07:00
|
|
|
struct GpFont{
|
|
|
|
LOGFONTW lfw;
|
2008-06-21 13:02:53 -04:00
|
|
|
REAL emSize;
|
2008-11-28 17:30:48 +01:00
|
|
|
UINT height;
|
|
|
|
LONG line_spacing;
|
2008-06-21 13:02:53 -04:00
|
|
|
Unit unit;
|
2007-08-13 18:34:51 -07:00
|
|
|
};
|
|
|
|
|
2007-08-14 18:59:48 -07:00
|
|
|
struct GpStringFormat{
|
|
|
|
INT attr;
|
|
|
|
LANGID lang;
|
2008-07-29 01:12:49 +04:00
|
|
|
LANGID digitlang;
|
2007-08-14 19:00:32 -07:00
|
|
|
StringAlignment align;
|
2007-08-14 19:00:40 -07:00
|
|
|
StringTrimming trimming;
|
2007-08-14 19:00:53 -07:00
|
|
|
HotkeyPrefix hkprefix;
|
2007-08-14 19:01:15 -07:00
|
|
|
StringAlignment vertalign;
|
2008-07-29 01:12:49 +04:00
|
|
|
StringDigitSubstitute digitsub;
|
2008-07-30 15:06:39 +04:00
|
|
|
INT tabcount;
|
|
|
|
REAL firsttab;
|
|
|
|
REAL *tabs;
|
2009-12-22 10:37:55 +01:00
|
|
|
CharacterRange *character_ranges;
|
|
|
|
INT range_count;
|
2007-08-14 18:59:48 -07:00
|
|
|
};
|
|
|
|
|
2008-06-21 13:02:47 -04:00
|
|
|
struct GpFontCollection{
|
2008-11-24 10:21:55 +01:00
|
|
|
GpFontFamily **FontFamilies;
|
|
|
|
INT count;
|
2009-04-27 18:56:56 -05:00
|
|
|
INT allocated;
|
2008-06-21 13:02:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GpFontFamily{
|
2008-07-03 14:26:50 -04:00
|
|
|
NEWTEXTMETRICW tmw;
|
2008-07-07 14:53:10 +02:00
|
|
|
WCHAR FamilyName[LF_FACESIZE];
|
2008-06-21 13:02:47 -04:00
|
|
|
};
|
|
|
|
|
2008-08-27 02:03:27 +04:00
|
|
|
/* internal use */
|
|
|
|
typedef enum RegionType
|
|
|
|
{
|
|
|
|
RegionDataRect = 0x10000000,
|
|
|
|
RegionDataPath = 0x10000001,
|
|
|
|
RegionDataEmptyRect = 0x10000002,
|
|
|
|
RegionDataInfiniteRect = 0x10000003,
|
|
|
|
} RegionType;
|
|
|
|
|
|
|
|
struct region_element
|
2008-07-24 19:01:21 -04:00
|
|
|
{
|
|
|
|
DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
|
|
|
|
union
|
|
|
|
{
|
|
|
|
GpRectF rect;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
GpPath* path;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
DWORD size;
|
|
|
|
DWORD magic;
|
|
|
|
DWORD count;
|
|
|
|
DWORD flags;
|
|
|
|
} pathheader;
|
|
|
|
} pathdata;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct region_element *left; /* the original region */
|
|
|
|
struct region_element *right; /* what *left was combined with */
|
|
|
|
} combine;
|
|
|
|
} elementdata;
|
2008-08-27 02:03:27 +04:00
|
|
|
};
|
2008-07-24 19:01:21 -04:00
|
|
|
|
|
|
|
struct GpRegion{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
DWORD size;
|
|
|
|
DWORD checksum;
|
|
|
|
DWORD magic;
|
|
|
|
DWORD num_children;
|
|
|
|
} header;
|
|
|
|
region_element node;
|
|
|
|
};
|
|
|
|
|
2007-06-11 11:51:15 -07:00
|
|
|
#endif
|