2007-06-11 20:51:15 +02: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-12 03:06:44 +02:00
|
|
|
#include <math.h>
|
2007-07-31 04:10:03 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2007-06-11 20:51:15 +02:00
|
|
|
#include "windef.h"
|
2007-07-20 03:22:59 +02:00
|
|
|
#include "wingdi.h"
|
2007-07-31 04:10:03 +02:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
|
|
|
|
#include "objbase.h"
|
|
|
|
#include "ocidl.h"
|
2012-06-25 13:30:34 +02:00
|
|
|
#include "wincodecsdk.h"
|
2018-01-30 23:40:58 +01:00
|
|
|
#include "wine/heap.h"
|
2009-07-06 00:04:20 +02:00
|
|
|
#include "wine/list.h"
|
2007-07-31 04:10:03 +02:00
|
|
|
|
2007-06-11 20:51:15 +02:00
|
|
|
#include "gdiplus.h"
|
|
|
|
|
2007-07-17 04:45:16 +02:00
|
|
|
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
|
2007-07-12 03:06:56 +02:00
|
|
|
#define MAX_ARC_PTS (13)
|
2007-07-28 01:07:39 +02:00
|
|
|
#define MAX_DASHLEN (16) /* this is a limitation of gdi */
|
2007-07-31 04:10:03 +02:00
|
|
|
#define INCH_HIMETRIC (2540)
|
2007-06-11 20:51:15 +02:00
|
|
|
|
2015-06-09 08:35:38 +02:00
|
|
|
#define VERSION_MAGIC 0xdbc01001
|
|
|
|
#define VERSION_MAGIC2 0xdbc01002
|
2017-07-18 18:35:28 +02:00
|
|
|
#define VALID_MAGIC(x) (((x) & 0xfffff000) == 0xdbc01000)
|
2008-08-03 00:44:57 +02:00
|
|
|
#define TENSION_CONST (0.3)
|
2008-07-25 01:01:21 +02:00
|
|
|
|
2015-03-12 10:17:40 +01:00
|
|
|
#define GIF_DISPOSE_UNSPECIFIED 0
|
|
|
|
#define GIF_DISPOSE_DO_NOT_DISPOSE 1
|
|
|
|
#define GIF_DISPOSE_RESTORE_TO_BKGND 2
|
|
|
|
#define GIF_DISPOSE_RESTORE_TO_PREV 3
|
|
|
|
|
2015-10-05 00:22:34 +02:00
|
|
|
|
2011-04-21 11:11:01 +02:00
|
|
|
COLORREF ARGB2COLORREF(ARGB color) DECLSPEC_HIDDEN;
|
|
|
|
HBITMAP ARGB2BMP(ARGB color) DECLSPEC_HIDDEN;
|
2007-07-12 03:06:56 +02:00
|
|
|
extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
|
2011-04-21 11:11:01 +02:00
|
|
|
REAL startAngle, REAL sweepAngle) DECLSPEC_HIDDEN;
|
|
|
|
extern REAL gdiplus_atan2(REAL dy, REAL dx) DECLSPEC_HIDDEN;
|
|
|
|
extern GpStatus hresult_to_status(HRESULT res) DECLSPEC_HIDDEN;
|
2012-07-16 07:56:30 +02:00
|
|
|
extern REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi) DECLSPEC_HIDDEN;
|
2012-07-16 07:57:32 +02:00
|
|
|
extern REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi) DECLSPEC_HIDDEN;
|
2012-08-09 05:55:19 +02:00
|
|
|
extern REAL units_scale(GpUnit from, GpUnit to, REAL dpi) DECLSPEC_HIDDEN;
|
2007-06-11 20:51:15 +02:00
|
|
|
|
2017-08-28 18:42:14 +02:00
|
|
|
#define WineCoordinateSpaceGdiDevice ((GpCoordinateSpace)4)
|
|
|
|
|
2017-08-30 19:32:17 +02:00
|
|
|
extern GpStatus gdi_transform_acquire(GpGraphics *graphics);
|
|
|
|
extern GpStatus gdi_transform_release(GpGraphics *graphics);
|
2016-08-16 23:00:26 +02:00
|
|
|
extern GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_space,
|
|
|
|
GpCoordinateSpace src_space, GpMatrix *matrix) DECLSPEC_HIDDEN;
|
2017-08-28 18:42:14 +02:00
|
|
|
extern GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space,
|
|
|
|
GpCoordinateSpace src_space, GpPointF *points, INT count) DECLSPEC_HIDDEN;
|
2016-08-16 23:00:26 +02:00
|
|
|
|
2011-04-21 11:11:01 +02:00
|
|
|
extern GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics) DECLSPEC_HIDDEN;
|
2017-07-10 11:30:08 +02:00
|
|
|
extern GpStatus encode_image_png(GpImage *image, IStream* stream, GDIPCONST EncoderParameters* params) DECLSPEC_HIDDEN;
|
2020-02-19 08:47:03 +01:00
|
|
|
extern GpStatus terminate_encoder_wic(GpImage *image) DECLSPEC_HIDDEN;
|
2010-08-08 23:18:40 +02:00
|
|
|
|
2011-04-02 00:09:23 +02:00
|
|
|
extern GpStatus METAFILE_GetGraphicsContext(GpMetafile* metafile, GpGraphics **result) DECLSPEC_HIDDEN;
|
2011-07-07 18:30:06 +02:00
|
|
|
extern GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc) DECLSPEC_HIDDEN;
|
|
|
|
extern GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) DECLSPEC_HIDDEN;
|
2016-06-24 19:51:41 +02:00
|
|
|
extern GpStatus METAFILE_GraphicsClear(GpMetafile* metafile, ARGB color) DECLSPEC_HIDDEN;
|
2013-11-20 23:50:51 +01:00
|
|
|
extern GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush,
|
|
|
|
GDIPCONST GpRectF* rects, INT count) DECLSPEC_HIDDEN;
|
2016-08-16 23:00:26 +02:00
|
|
|
extern GpStatus METAFILE_SetClipRect(GpMetafile* metafile,
|
|
|
|
REAL x, REAL y, REAL width, REAL height, CombineMode mode) DECLSPEC_HIDDEN;
|
2017-08-10 20:56:19 +02:00
|
|
|
extern GpStatus METAFILE_SetClipRegion(GpMetafile* metafile, GpRegion* region, CombineMode mode) DECLSPEC_HIDDEN;
|
2014-01-16 22:43:45 +01:00
|
|
|
extern GpStatus METAFILE_SetPageTransform(GpMetafile* metafile, GpUnit unit, REAL scale) DECLSPEC_HIDDEN;
|
2016-08-05 23:14:39 +02:00
|
|
|
extern GpStatus METAFILE_SetWorldTransform(GpMetafile* metafile, GDIPCONST GpMatrix* transform) DECLSPEC_HIDDEN;
|
2016-08-03 23:19:35 +02:00
|
|
|
extern GpStatus METAFILE_ScaleWorldTransform(GpMetafile* metafile, REAL sx, REAL sy, MatrixOrder order) DECLSPEC_HIDDEN;
|
2016-08-05 23:14:37 +02:00
|
|
|
extern GpStatus METAFILE_MultiplyWorldTransform(GpMetafile* metafile, GDIPCONST GpMatrix* matrix, MatrixOrder order) DECLSPEC_HIDDEN;
|
2016-08-05 23:14:38 +02:00
|
|
|
extern GpStatus METAFILE_RotateWorldTransform(GpMetafile* metafile, REAL angle, MatrixOrder order) DECLSPEC_HIDDEN;
|
2016-08-12 22:47:14 +02:00
|
|
|
extern GpStatus METAFILE_TranslateWorldTransform(GpMetafile* metafile, REAL dx, REAL dy, MatrixOrder order) DECLSPEC_HIDDEN;
|
2016-08-03 23:19:38 +02:00
|
|
|
extern GpStatus METAFILE_ResetWorldTransform(GpMetafile* metafile) DECLSPEC_HIDDEN;
|
2016-09-16 21:37:29 +02:00
|
|
|
extern GpStatus METAFILE_BeginContainer(GpMetafile* metafile, GDIPCONST GpRectF *dstrect,
|
|
|
|
GDIPCONST GpRectF *srcrect, GpUnit unit, DWORD StackIndex) DECLSPEC_HIDDEN;
|
2016-08-15 23:25:41 +02:00
|
|
|
extern GpStatus METAFILE_BeginContainerNoParams(GpMetafile* metafile, DWORD StackIndex) DECLSPEC_HIDDEN;
|
|
|
|
extern GpStatus METAFILE_EndContainer(GpMetafile* metafile, DWORD StackIndex) DECLSPEC_HIDDEN;
|
|
|
|
extern GpStatus METAFILE_SaveGraphics(GpMetafile* metafile, DWORD StackIndex) DECLSPEC_HIDDEN;
|
|
|
|
extern GpStatus METAFILE_RestoreGraphics(GpMetafile* metafile, DWORD StackIndex) DECLSPEC_HIDDEN;
|
2011-04-02 00:09:23 +02:00
|
|
|
extern GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) DECLSPEC_HIDDEN;
|
2017-07-10 11:30:08 +02:00
|
|
|
extern GpStatus METAFILE_DrawImagePointsRect(GpMetafile* metafile, GpImage *image,
|
|
|
|
GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth,
|
|
|
|
REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes* imageAttributes,
|
|
|
|
DrawImageAbort callback, VOID *callbackData) DECLSPEC_HIDDEN;
|
2017-07-11 10:58:58 +02:00
|
|
|
extern GpStatus METAFILE_AddSimpleProperty(GpMetafile *metafile, SHORT prop, SHORT val) DECLSPEC_HIDDEN;
|
2017-07-13 11:53:43 +02:00
|
|
|
extern GpStatus METAFILE_DrawPath(GpMetafile *metafile, GpPen *pen, GpPath *path) DECLSPEC_HIDDEN;
|
2017-07-13 11:54:00 +02:00
|
|
|
extern GpStatus METAFILE_FillPath(GpMetafile *metafile, GpBrush *brush, GpPath *path) DECLSPEC_HIDDEN;
|
2017-10-12 12:44:29 +02:00
|
|
|
extern void METAFILE_Free(GpMetafile *metafile) DECLSPEC_HIDDEN;
|
2011-04-02 00:09:23 +02:00
|
|
|
|
2013-09-23 00:36:04 +02:00
|
|
|
extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
|
2011-04-21 11:11:01 +02:00
|
|
|
REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN;
|
2008-08-03 00:44:57 +02:00
|
|
|
extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj,
|
2011-04-21 11:11:01 +02:00
|
|
|
REAL tension, REAL *x, REAL *y) DECLSPEC_HIDDEN;
|
2008-08-03 00:44:57 +02:00
|
|
|
|
2011-04-21 11:11:01 +02:00
|
|
|
extern void free_installed_fonts(void) DECLSPEC_HIDDEN;
|
2009-04-28 01:56:56 +02:00
|
|
|
|
2011-04-21 11:11:01 +02:00
|
|
|
extern BOOL lengthen_path(GpPath *path, INT len) DECLSPEC_HIDDEN;
|
2008-08-05 18:56:30 +02:00
|
|
|
|
2017-08-10 20:56:19 +02:00
|
|
|
extern DWORD write_region_data(const GpRegion *region, void *data) DECLSPEC_HIDDEN;
|
2017-07-18 18:59:48 +02:00
|
|
|
extern DWORD write_path_data(GpPath *path, void *data) DECLSPEC_HIDDEN;
|
|
|
|
|
2011-04-21 11:11:01 +02:00
|
|
|
extern GpStatus trace_path(GpGraphics *graphics, GpPath *path) DECLSPEC_HIDDEN;
|
2008-11-24 22:01:47 +01:00
|
|
|
|
2008-08-27 00:03:27 +02:00
|
|
|
typedef struct region_element region_element;
|
2011-04-21 11:11:01 +02:00
|
|
|
extern void delete_element(region_element *element) DECLSPEC_HIDDEN;
|
2008-08-27 00:03:27 +02:00
|
|
|
|
2017-09-15 17:39:59 +02:00
|
|
|
extern GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result) DECLSPEC_HIDDEN;
|
2011-01-21 20:44:04 +01:00
|
|
|
|
2012-08-21 04:02:06 +02:00
|
|
|
static inline INT gdip_round(REAL x)
|
2007-07-12 03:06:44 +02:00
|
|
|
{
|
|
|
|
return (INT) floorf(x + 0.5);
|
|
|
|
}
|
|
|
|
|
2009-08-25 20:39:18 +02:00
|
|
|
static inline INT ceilr(REAL x)
|
|
|
|
{
|
|
|
|
return (INT) ceilf(x);
|
|
|
|
}
|
|
|
|
|
2007-07-12 03:06:44 +02:00
|
|
|
static inline REAL deg2rad(REAL degrees)
|
|
|
|
{
|
|
|
|
return M_PI * degrees / 180.0;
|
|
|
|
}
|
|
|
|
|
2010-03-29 05:25:20 +02:00
|
|
|
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;
|
2010-04-17 18:31:15 +02:00
|
|
|
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;
|
2010-03-29 05:25:20 +02:00
|
|
|
|
|
|
|
return (a<<24)|(r<<16)|(g<<8)|b;
|
|
|
|
}
|
|
|
|
|
2015-04-03 21:26:35 +02:00
|
|
|
/* fg is premult, bg and return value are not */
|
|
|
|
static inline ARGB color_over_fgpremult(ARGB bg, ARGB fg)
|
|
|
|
{
|
|
|
|
BYTE b, g, r, a;
|
|
|
|
BYTE bg_alpha, fg_alpha;
|
|
|
|
|
|
|
|
fg_alpha = (fg>>24)&0xff;
|
|
|
|
|
|
|
|
if (fg_alpha == 0) return bg;
|
|
|
|
|
|
|
|
bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff;
|
|
|
|
|
|
|
|
a = bg_alpha + fg_alpha;
|
|
|
|
b = ((bg&0xff)*bg_alpha + (fg&0xff)*0xff)/a;
|
|
|
|
g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*0xff)/a;
|
|
|
|
r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*0xff)/a;
|
|
|
|
|
|
|
|
return (a<<24)|(r<<16)|(g<<8)|b;
|
|
|
|
}
|
|
|
|
|
2013-09-23 00:36:04 +02:00
|
|
|
extern const char *debugstr_rectf(const RectF* rc) DECLSPEC_HIDDEN;
|
2009-05-13 20:55:46 +02:00
|
|
|
|
2013-09-23 00:36:04 +02:00
|
|
|
extern const char *debugstr_pointf(const PointF* pt) DECLSPEC_HIDDEN;
|
2009-12-18 22:45:02 +01:00
|
|
|
|
2009-08-29 00:21:10 +02:00
|
|
|
extern void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height,
|
2011-04-21 11:11:01 +02:00
|
|
|
BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride) DECLSPEC_HIDDEN;
|
2009-08-29 00:21:10 +02:00
|
|
|
|
2011-03-10 14:09:56 +01:00
|
|
|
extern GpStatus convert_pixels(INT width, INT height,
|
2010-02-05 02:05:54 +01:00
|
|
|
INT dst_stride, BYTE *dst_bits, PixelFormat dst_format,
|
2012-07-17 08:00:21 +02:00
|
|
|
INT src_stride, const BYTE *src_bits, PixelFormat src_format, ColorPalette *palette) DECLSPEC_HIDDEN;
|
2010-02-05 02:05:54 +01:00
|
|
|
|
2016-06-13 23:42:28 +02:00
|
|
|
extern PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE data,
|
|
|
|
UINT width, UINT height, INT stride, ColorAdjustType type, PixelFormat fmt) DECLSPEC_HIDDEN;
|
|
|
|
|
2012-11-07 04:36:26 +01:00
|
|
|
struct GpMatrix{
|
|
|
|
REAL matrix[6];
|
|
|
|
};
|
|
|
|
|
2007-06-11 20:51:15 +02:00
|
|
|
struct GpPen{
|
|
|
|
UINT style;
|
|
|
|
GpUnit unit;
|
|
|
|
REAL width;
|
2007-07-06 03:37:52 +02:00
|
|
|
GpLineCap endcap;
|
2007-07-17 04:44:50 +02:00
|
|
|
GpLineCap startcap;
|
|
|
|
GpDashCap dashcap;
|
2007-07-20 03:22:43 +02:00
|
|
|
GpCustomLineCap *customstart;
|
|
|
|
GpCustomLineCap *customend;
|
2007-07-13 04:42:47 +02:00
|
|
|
GpLineJoin join;
|
|
|
|
REAL miterlimit;
|
2007-07-17 04:45:16 +02:00
|
|
|
GpDashStyle dash;
|
2007-07-26 04:15:38 +02:00
|
|
|
REAL *dashes;
|
|
|
|
INT numdashes;
|
2007-08-09 04:42:03 +02:00
|
|
|
REAL offset; /* dash offset */
|
2007-07-20 03:22:59 +02:00
|
|
|
GpBrush *brush;
|
2008-07-31 07:08:32 +02:00
|
|
|
GpPenAlignment align;
|
2016-01-31 11:55:31 +01:00
|
|
|
GpMatrix transform;
|
2007-06-11 20:51:15 +02:00
|
|
|
};
|
|
|
|
|
2007-06-11 20:54:03 +02:00
|
|
|
struct GpGraphics{
|
|
|
|
HDC hdc;
|
|
|
|
HWND hwnd;
|
2009-04-24 20:29:56 +02:00
|
|
|
BOOL owndc;
|
2012-12-05 20:15:25 +01:00
|
|
|
BOOL alpha_hdc;
|
2010-03-29 03:05:04 +02:00
|
|
|
GpImage *image;
|
2013-03-02 21:28:01 +01:00
|
|
|
ImageType image_type;
|
2007-07-14 02:51:13 +02:00
|
|
|
SmoothingMode smoothing;
|
2007-07-14 02:51:25 +02:00
|
|
|
CompositingQuality compqual;
|
2007-07-14 02:51:29 +02:00
|
|
|
InterpolationMode interpolation;
|
2007-07-14 02:51:33 +02:00
|
|
|
PixelOffsetMode pixeloffset;
|
2007-08-14 03:34:27 +02:00
|
|
|
CompositingMode compmode;
|
2007-08-15 04:00:09 +02:00
|
|
|
TextRenderingHint texthint;
|
2007-07-24 05:24:41 +02:00
|
|
|
GpUnit unit; /* page unit */
|
2007-07-25 02:18:39 +02:00
|
|
|
REAL scale; /* page scale */
|
2012-07-24 10:18:48 +02:00
|
|
|
REAL xres, yres;
|
2012-11-07 04:36:26 +01:00
|
|
|
GpMatrix worldtrans; /* world transform */
|
2008-08-24 12:45:18 +02:00
|
|
|
BOOL busy; /* hdc handle obtained by GdipGetDC */
|
2013-07-19 04:34:42 +02:00
|
|
|
GpRegion *clip; /* in device coords */
|
2008-11-09 12:32:26 +01:00
|
|
|
UINT textcontrast; /* not used yet. get/set only */
|
2009-07-06 00:04:20 +02:00
|
|
|
struct list containers;
|
|
|
|
GraphicsContainer contid; /* last-issued container ID */
|
2012-04-23 20:12:05 +02:00
|
|
|
INT origin_x, origin_y;
|
2017-08-30 19:32:17 +02:00
|
|
|
INT gdi_transform_acquire_count, gdi_transform_save;
|
|
|
|
GpMatrix gdi_transform;
|
2017-10-04 21:54:18 +02:00
|
|
|
HRGN gdi_clip;
|
2010-08-16 23:31:18 +02:00
|
|
|
/* 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;
|
2007-06-11 20:54:03 +02:00
|
|
|
};
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
struct GpBrush{
|
|
|
|
GpBrushType bt;
|
|
|
|
};
|
|
|
|
|
2009-01-11 00:45:11 +01:00
|
|
|
struct GpHatch{
|
|
|
|
GpBrush brush;
|
2017-09-15 17:39:59 +02:00
|
|
|
GpHatchStyle hatchstyle;
|
2009-01-11 00:45:11 +01:00
|
|
|
ARGB forecol;
|
|
|
|
ARGB backcol;
|
|
|
|
};
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
struct GpSolidFill{
|
|
|
|
GpBrush brush;
|
2007-07-24 05:24:24 +02:00
|
|
|
ARGB color;
|
2007-06-15 01:09:07 +02:00
|
|
|
};
|
|
|
|
|
2007-08-02 02:56:02 +02:00
|
|
|
struct GpPathGradient{
|
|
|
|
GpBrush brush;
|
2012-02-20 18:54:38 +01:00
|
|
|
GpPath* path;
|
2007-08-02 02:56:02 +02:00
|
|
|
ARGB centercolor;
|
2007-08-02 02:56:10 +02:00
|
|
|
GpWrapMode wrap;
|
2007-08-03 02:52:49 +02:00
|
|
|
BOOL gamma;
|
2007-08-03 02:52:59 +02:00
|
|
|
GpPointF center;
|
2007-08-03 02:53:04 +02:00
|
|
|
GpPointF focus;
|
2008-07-21 21:30:39 +02:00
|
|
|
REAL* blendfac; /* blend factors */
|
|
|
|
REAL* blendpos; /* blend positions */
|
|
|
|
INT blendcount;
|
2012-02-29 22:23:38 +01:00
|
|
|
ARGB *surroundcolors;
|
|
|
|
INT surroundcolorcount;
|
2012-03-31 19:38:17 +02:00
|
|
|
ARGB* pblendcolor; /* preset blend colors */
|
|
|
|
REAL* pblendpos; /* preset blend positions */
|
|
|
|
INT pblendcount;
|
2012-11-08 04:11:59 +01:00
|
|
|
GpMatrix transform;
|
2007-08-02 02:56:02 +02:00
|
|
|
};
|
|
|
|
|
2007-08-08 03:42:29 +02:00
|
|
|
struct GpLineGradient{
|
|
|
|
GpBrush brush;
|
|
|
|
ARGB startcolor;
|
|
|
|
ARGB endcolor;
|
2009-05-07 18:33:28 +02:00
|
|
|
RectF rect;
|
2007-08-08 03:42:29 +02:00
|
|
|
GpWrapMode wrap;
|
2007-08-08 03:42:40 +02:00
|
|
|
BOOL gamma;
|
2009-04-29 01:03:41 +02:00
|
|
|
REAL* blendfac; /* blend factors */
|
|
|
|
REAL* blendpos; /* blend positions */
|
|
|
|
INT blendcount;
|
2009-09-14 23:21:50 +02:00
|
|
|
ARGB* pblendcolor; /* preset blend colors */
|
|
|
|
REAL* pblendpos; /* preset blend positions */
|
|
|
|
INT pblendcount;
|
2017-08-16 20:28:59 +02:00
|
|
|
GpMatrix transform;
|
2007-08-08 03:42:29 +02:00
|
|
|
};
|
|
|
|
|
2007-08-10 03:25:14 +02:00
|
|
|
struct GpTexture{
|
|
|
|
GpBrush brush;
|
2012-11-08 04:11:59 +01:00
|
|
|
GpMatrix transform;
|
2010-02-11 23:43:45 +01:00
|
|
|
GpImage *image;
|
2011-02-14 22:35:47 +01:00
|
|
|
GpImageAttributes *imageattributes;
|
2011-03-10 21:42:19 +01:00
|
|
|
BYTE *bitmap_bits; /* image bits converted to ARGB and run through imageattributes */
|
2007-08-10 03:25:14 +02:00
|
|
|
};
|
|
|
|
|
2007-06-22 01:15:17 +02:00
|
|
|
struct GpPath{
|
|
|
|
GpFillMode fill;
|
|
|
|
GpPathData pathdata;
|
|
|
|
BOOL newfigure; /* whether the next drawing action starts a new figure */
|
2007-07-07 01:14:07 +02:00
|
|
|
INT datalen; /* size of the arrays in pathdata */
|
2007-06-22 01:15:17 +02:00
|
|
|
};
|
|
|
|
|
2007-07-17 04:45:02 +02: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-20 03:22:34 +02:00
|
|
|
struct GpCustomLineCap{
|
2017-02-03 14:42:06 +01:00
|
|
|
CustomLineCapType type;
|
2007-07-20 03:22:34 +02:00
|
|
|
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 10:48:01 +02:00
|
|
|
GpLineJoin join;
|
2008-07-26 10:48:16 +02:00
|
|
|
REAL scale;
|
2007-07-20 03:22:34 +02:00
|
|
|
};
|
|
|
|
|
2016-06-03 17:11:53 +02:00
|
|
|
struct GpAdjustableArrowCap{
|
2008-09-03 18:34:58 +02:00
|
|
|
GpCustomLineCap cap;
|
2018-05-14 06:59:35 +02:00
|
|
|
REAL middle_inset;
|
|
|
|
REAL height;
|
|
|
|
REAL width;
|
2008-09-03 18:34:58 +02:00
|
|
|
};
|
|
|
|
|
2007-07-31 04:10:03 +02:00
|
|
|
struct GpImage{
|
2015-03-12 10:17:03 +01:00
|
|
|
IWICBitmapDecoder *decoder;
|
2020-02-19 08:47:03 +01:00
|
|
|
IWICBitmapEncoder *encoder;
|
2007-07-31 04:10:03 +02:00
|
|
|
ImageType type;
|
2009-09-14 18:23:45 +02:00
|
|
|
GUID format;
|
2008-05-09 14:39:43 +02:00
|
|
|
UINT flags;
|
2012-05-16 16:33:48 +02:00
|
|
|
UINT frame_count, current_frame;
|
2012-07-17 07:59:43 +02:00
|
|
|
ColorPalette *palette;
|
2009-12-27 02:46:55 +01:00
|
|
|
REAL xres, yres;
|
2017-02-14 10:24:36 +01:00
|
|
|
LONG busy;
|
2007-07-31 04:10:03 +02:00
|
|
|
};
|
|
|
|
|
2017-10-12 12:44:29 +02:00
|
|
|
#define EmfPlusObjectTableSize 64
|
|
|
|
|
|
|
|
typedef enum EmfPlusObjectType
|
|
|
|
{
|
|
|
|
ObjectTypeInvalid,
|
|
|
|
ObjectTypeBrush,
|
|
|
|
ObjectTypePen,
|
|
|
|
ObjectTypePath,
|
|
|
|
ObjectTypeRegion,
|
|
|
|
ObjectTypeImage,
|
|
|
|
ObjectTypeFont,
|
|
|
|
ObjectTypeStringFormat,
|
|
|
|
ObjectTypeImageAttributes,
|
|
|
|
ObjectTypeCustomLineCap,
|
|
|
|
ObjectTypeMax = ObjectTypeCustomLineCap,
|
|
|
|
} EmfPlusObjectType;
|
|
|
|
|
|
|
|
/* Deserialized EmfPlusObject record. */
|
|
|
|
struct emfplus_object {
|
|
|
|
EmfPlusObjectType type;
|
|
|
|
union {
|
2017-10-13 13:10:26 +02:00
|
|
|
GpBrush *brush;
|
2017-10-19 23:45:38 +02:00
|
|
|
GpPen *pen;
|
2017-10-16 09:12:23 +02:00
|
|
|
GpPath *path;
|
2017-10-19 23:45:40 +02:00
|
|
|
GpRegion *region;
|
2017-10-16 09:12:21 +02:00
|
|
|
GpImage *image;
|
2017-10-17 14:49:12 +02:00
|
|
|
GpFont *font;
|
2017-10-12 12:44:29 +02:00
|
|
|
GpImageAttributes *image_attributes;
|
|
|
|
void *object;
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
2007-07-31 04:10:03 +02:00
|
|
|
struct GpMetafile{
|
|
|
|
GpImage image;
|
2007-07-31 04:09:57 +02:00
|
|
|
GpRectF bounds;
|
|
|
|
GpUnit unit;
|
2011-04-02 00:09:23 +02:00
|
|
|
MetafileType metafile_type;
|
2011-07-07 23:25:25 +02:00
|
|
|
HENHMETAFILE hemf;
|
2012-10-31 21:37:16 +01:00
|
|
|
int preserve_hemf; /* if true, hemf belongs to the app and should not be deleted */
|
2011-07-07 23:25:25 +02:00
|
|
|
|
|
|
|
/* recording */
|
2011-04-02 00:09:23 +02:00
|
|
|
HDC record_dc;
|
|
|
|
GpGraphics *record_graphics;
|
|
|
|
BYTE *comment_data;
|
|
|
|
DWORD comment_data_size;
|
|
|
|
DWORD comment_data_length;
|
2016-04-06 21:36:58 +02:00
|
|
|
IStream *record_stream;
|
2016-06-24 19:51:43 +02:00
|
|
|
BOOL auto_frame; /* If true, determine the frame automatically */
|
|
|
|
GpPointF auto_frame_min, auto_frame_max;
|
2017-07-10 11:30:24 +02:00
|
|
|
DWORD next_object_id;
|
2011-07-07 23:25:25 +02:00
|
|
|
|
|
|
|
/* playback */
|
|
|
|
GpGraphics *playback_graphics;
|
|
|
|
HDC playback_dc;
|
|
|
|
GpPointF playback_points[3];
|
2013-11-22 23:19:13 +01:00
|
|
|
GpRectF src_rect;
|
2011-07-07 23:25:25 +02:00
|
|
|
HANDLETABLE *handle_table;
|
|
|
|
int handle_count;
|
2016-10-07 23:03:44 +02:00
|
|
|
XFORM gdiworldtransform;
|
2013-11-22 23:19:13 +01:00
|
|
|
GpMatrix *world_transform;
|
|
|
|
GpUnit page_unit;
|
|
|
|
REAL page_scale;
|
2016-06-24 19:51:40 +02:00
|
|
|
GpRegion *base_clip; /* clip region in device space for all metafile output */
|
2016-08-16 23:00:26 +02:00
|
|
|
GpRegion *clip; /* clip region within the metafile */
|
2016-08-15 23:25:41 +02:00
|
|
|
struct list containers;
|
2017-10-12 12:44:29 +02:00
|
|
|
struct emfplus_object objtable[EmfPlusObjectTableSize];
|
2007-07-31 04:10:03 +02:00
|
|
|
};
|
|
|
|
|
2007-08-01 04:15:52 +02:00
|
|
|
struct GpBitmap{
|
|
|
|
GpImage image;
|
2007-08-01 04:16:20 +02:00
|
|
|
INT width;
|
|
|
|
INT height;
|
2007-08-04 02:30:30 +02:00
|
|
|
PixelFormat format;
|
2007-08-08 03:41:55 +02:00
|
|
|
ImageLockMode lockmode;
|
|
|
|
BYTE *bitmapbits; /* pointer to the buffer we passed in BitmapLockBits */
|
2009-08-28 21:49:35 +02:00
|
|
|
HBITMAP hbitmap;
|
2009-08-28 22:05:38 +02:00
|
|
|
HDC hdc;
|
2009-08-28 23:53:57 +02:00
|
|
|
BYTE *bits; /* actual image bits if this is a DIB */
|
|
|
|
INT stride; /* stride of bits if this is a DIB */
|
2010-08-08 23:18:40 +02:00
|
|
|
BYTE *own_bits; /* image bits that need to be freed with this object */
|
2011-02-24 23:32:54 +01:00
|
|
|
INT lockx, locky; /* X and Y coordinates of the rect when a bitmap is locked for writing. */
|
2012-06-25 13:30:34 +02:00
|
|
|
IWICMetadataReader *metadata_reader; /* NULL if there is no metadata */
|
2012-09-21 12:58:20 +02:00
|
|
|
UINT prop_count;
|
|
|
|
PropertyItem *prop_item; /* cached image properties */
|
2007-08-01 04:15:52 +02:00
|
|
|
};
|
|
|
|
|
2008-11-04 06:54:32 +01:00
|
|
|
struct GpCachedBitmap{
|
2008-11-21 23:57:48 +01:00
|
|
|
GpImage *image;
|
2008-11-04 06:54:32 +01:00
|
|
|
};
|
|
|
|
|
2009-07-25 00:57:38 +02:00
|
|
|
struct color_key{
|
|
|
|
BOOL enabled;
|
|
|
|
ARGB low;
|
|
|
|
ARGB high;
|
|
|
|
};
|
|
|
|
|
2009-12-19 00:42:18 +01:00
|
|
|
struct color_matrix{
|
|
|
|
BOOL enabled;
|
|
|
|
ColorMatrixFlags flags;
|
|
|
|
ColorMatrix colormatrix;
|
|
|
|
ColorMatrix graymatrix;
|
|
|
|
};
|
|
|
|
|
2010-03-04 02:06:33 +01:00
|
|
|
struct color_remap_table{
|
|
|
|
BOOL enabled;
|
|
|
|
INT mapsize;
|
2012-03-21 21:29:25 +01:00
|
|
|
ColorMap *colormap;
|
2010-03-04 02:06:33 +01:00
|
|
|
};
|
|
|
|
|
2017-10-24 12:56:38 +02:00
|
|
|
enum imageattr_noop{
|
|
|
|
IMAGEATTR_NOOP_UNDEFINED,
|
|
|
|
IMAGEATTR_NOOP_SET,
|
|
|
|
IMAGEATTR_NOOP_CLEAR,
|
|
|
|
};
|
|
|
|
|
2007-07-31 04:09:54 +02:00
|
|
|
struct GpImageAttributes{
|
|
|
|
WrapMode wrap;
|
2010-05-08 19:53:07 +02:00
|
|
|
ARGB outside_color;
|
|
|
|
BOOL clamp;
|
2009-07-25 00:57:38 +02:00
|
|
|
struct color_key colorkeys[ColorAdjustTypeCount];
|
2009-12-19 00:42:18 +01:00
|
|
|
struct color_matrix colormatrices[ColorAdjustTypeCount];
|
2010-03-04 02:06:33 +01:00
|
|
|
struct color_remap_table colorremaptables[ColorAdjustTypeCount];
|
2010-01-31 00:09:06 +01:00
|
|
|
BOOL gamma_enabled[ColorAdjustTypeCount];
|
|
|
|
REAL gamma[ColorAdjustTypeCount];
|
2017-10-24 12:56:38 +02:00
|
|
|
enum imageattr_noop noop[ColorAdjustTypeCount];
|
2007-07-31 04:09:54 +02:00
|
|
|
};
|
|
|
|
|
2007-08-14 03:34:51 +02:00
|
|
|
struct GpFont{
|
2012-05-08 12:29:41 +02:00
|
|
|
GpFontFamily *family;
|
2012-05-11 12:20:31 +02:00
|
|
|
OUTLINETEXTMETRICW otm;
|
|
|
|
REAL emSize; /* in font units */
|
2008-06-21 19:02:53 +02:00
|
|
|
Unit unit;
|
2007-08-14 03:34:51 +02:00
|
|
|
};
|
|
|
|
|
2017-04-28 00:20:31 +02:00
|
|
|
extern const struct GpStringFormat default_drawstring_format DECLSPEC_HIDDEN;
|
|
|
|
|
2007-08-15 03:59:48 +02:00
|
|
|
struct GpStringFormat{
|
|
|
|
INT attr;
|
|
|
|
LANGID lang;
|
2008-07-28 23:12:49 +02:00
|
|
|
LANGID digitlang;
|
2007-08-15 04:00:32 +02:00
|
|
|
StringAlignment align;
|
2007-08-15 04:00:40 +02:00
|
|
|
StringTrimming trimming;
|
2007-08-15 04:00:53 +02:00
|
|
|
HotkeyPrefix hkprefix;
|
2017-04-28 00:20:32 +02:00
|
|
|
StringAlignment line_align;
|
2008-07-28 23:12:49 +02:00
|
|
|
StringDigitSubstitute digitsub;
|
2008-07-30 13:06:39 +02:00
|
|
|
INT tabcount;
|
|
|
|
REAL firsttab;
|
|
|
|
REAL *tabs;
|
2009-12-22 10:37:55 +01:00
|
|
|
CharacterRange *character_ranges;
|
|
|
|
INT range_count;
|
2012-09-03 10:57:17 +02:00
|
|
|
BOOL generic_typographic;
|
2007-08-15 03:59:48 +02:00
|
|
|
};
|
|
|
|
|
2017-04-28 00:20:31 +02:00
|
|
|
extern void init_generic_string_formats(void) DECLSPEC_HIDDEN;
|
|
|
|
extern void free_generic_string_formats(void) DECLSPEC_HIDDEN;
|
|
|
|
|
2008-06-21 19:02:47 +02:00
|
|
|
struct GpFontCollection{
|
2008-11-24 10:21:55 +01:00
|
|
|
GpFontFamily **FontFamilies;
|
|
|
|
INT count;
|
2009-04-28 01:56:56 +02:00
|
|
|
INT allocated;
|
2008-06-21 19:02:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GpFontFamily{
|
2008-07-07 14:53:10 +02:00
|
|
|
WCHAR FamilyName[LF_FACESIZE];
|
2012-05-11 12:21:00 +02:00
|
|
|
UINT16 em_height, ascent, descent, line_spacing; /* in font units */
|
|
|
|
int dpi;
|
2008-06-21 19:02:47 +02:00
|
|
|
};
|
|
|
|
|
2008-08-27 00:03:27 +02:00
|
|
|
/* internal use */
|
|
|
|
typedef enum RegionType
|
|
|
|
{
|
|
|
|
RegionDataRect = 0x10000000,
|
|
|
|
RegionDataPath = 0x10000001,
|
|
|
|
RegionDataEmptyRect = 0x10000002,
|
|
|
|
RegionDataInfiniteRect = 0x10000003,
|
|
|
|
} RegionType;
|
|
|
|
|
|
|
|
struct region_element
|
2008-07-25 01:01:21 +02:00
|
|
|
{
|
|
|
|
DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
|
|
|
|
union
|
|
|
|
{
|
|
|
|
GpRectF rect;
|
2013-11-12 10:16:28 +01:00
|
|
|
GpPath *path;
|
2008-07-25 01:01:21 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct region_element *left; /* the original region */
|
|
|
|
struct region_element *right; /* what *left was combined with */
|
|
|
|
} combine;
|
|
|
|
} elementdata;
|
2008-08-27 00:03:27 +02:00
|
|
|
};
|
2008-07-25 01:01:21 +02:00
|
|
|
|
|
|
|
struct GpRegion{
|
2013-11-12 10:16:28 +01:00
|
|
|
DWORD num_children;
|
2008-07-25 01:01:21 +02:00
|
|
|
region_element node;
|
|
|
|
};
|
|
|
|
|
2017-10-19 23:45:40 +02:00
|
|
|
struct memory_buffer
|
|
|
|
{
|
|
|
|
const BYTE *buffer;
|
|
|
|
INT size, pos;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void init_memory_buffer(struct memory_buffer *mbuf, const BYTE *buffer, INT size)
|
|
|
|
{
|
|
|
|
mbuf->buffer = buffer;
|
|
|
|
mbuf->size = size;
|
|
|
|
mbuf->pos = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const void *buffer_read(struct memory_buffer *mbuf, INT size)
|
|
|
|
{
|
|
|
|
if (mbuf->size - mbuf->pos >= size)
|
|
|
|
{
|
|
|
|
const void *data = mbuf->buffer + mbuf->pos;
|
|
|
|
mbuf->pos += size;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-02-17 11:06:43 +01:00
|
|
|
typedef GpStatus (*gdip_format_string_callback)(HDC hdc,
|
|
|
|
GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font,
|
|
|
|
GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format,
|
2012-03-21 18:50:11 +01:00
|
|
|
INT lineno, const RectF *bounds, INT *underlined_indexes,
|
|
|
|
INT underlined_index_count, void *user_data);
|
2011-02-17 11:06:43 +01:00
|
|
|
|
|
|
|
GpStatus gdip_format_string(HDC hdc,
|
|
|
|
GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font,
|
2013-03-15 05:38:21 +01:00
|
|
|
GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip,
|
2011-04-21 11:11:01 +02:00
|
|
|
gdip_format_string_callback callback, void *user_data) DECLSPEC_HIDDEN;
|
2011-02-17 11:06:43 +01:00
|
|
|
|
2012-05-12 08:23:12 +02:00
|
|
|
void get_log_fontW(const GpFont *, GpGraphics *, LOGFONTW *) DECLSPEC_HIDDEN;
|
|
|
|
|
2017-02-14 10:24:36 +01:00
|
|
|
static inline BOOL image_lock(GpImage *image, BOOL *unlock)
|
|
|
|
{
|
|
|
|
LONG tid = GetCurrentThreadId(), owner_tid;
|
|
|
|
owner_tid = InterlockedCompareExchange(&image->busy, tid, 0);
|
|
|
|
*unlock = !owner_tid;
|
|
|
|
return !owner_tid || owner_tid==tid;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void image_unlock(GpImage *image, BOOL unlock)
|
|
|
|
{
|
|
|
|
if (unlock) image->busy = 0;
|
|
|
|
}
|
|
|
|
|
2007-06-11 20:51:15 +02:00
|
|
|
#endif
|