ReactOS 0.4.15-dev-7674-gc0b4db1
gdiplus_private.h File Reference
#include <math.h>
#include <stdarg.h>
#include "windef.h"
#include "wingdi.h"
#include "winbase.h"
#include "winuser.h"
#include "objbase.h"
#include "ocidl.h"
#include "wincodecsdk.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "gdiplus.h"
Include dependency graph for gdiplus_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GpMatrix
 
struct  GpPen
 
struct  GpGraphics
 
struct  GpBrush
 
struct  GpHatch
 
struct  GpSolidFill
 
struct  GpPathGradient
 
struct  GpLineGradient
 
struct  GpTexture
 
struct  GpPath
 
struct  GpPathIterator
 
struct  GpCustomLineCap
 
struct  GpAdjustableArrowCap
 
struct  GpImage
 
struct  emfplus_object
 
struct  GpMetafile
 
struct  GpBitmap
 
struct  GpCachedBitmap
 
struct  color_key
 
struct  color_matrix
 
struct  color_remap_table
 
struct  GpImageAttributes
 
struct  GpFont
 
struct  GpStringFormat
 
struct  GpFontCollection
 
struct  GpFontFamily
 
struct  region_element
 
struct  GpRegion
 
struct  memory_buffer
 

Macros

#define GP_DEFAULT_PENSTYLE   (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
 
#define MAX_ARC_PTS   (13)
 
#define MAX_DASHLEN   (16) /* this is a limitation of gdi */
 
#define INCH_HIMETRIC   (2540)
 
#define VERSION_MAGIC   0xdbc01001
 
#define VERSION_MAGIC2   0xdbc01002
 
#define VALID_MAGIC(x)   (((x) & 0xfffff000) == 0xdbc01000)
 
#define TENSION_CONST   (0.3)
 
#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
 
#define WineCoordinateSpaceGdiDevice   ((GpCoordinateSpace)4)
 
#define EmfPlusObjectTableSize   64
 

Typedefs

typedef struct region_element region_element
 
typedef enum EmfPlusObjectType EmfPlusObjectType
 
typedef enum RegionType RegionType
 
typedef GpStatus(* gdip_format_string_callback) (HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data)
 

Enumerations

enum  EmfPlusObjectType {
  ObjectTypeInvalid , ObjectTypeBrush , ObjectTypePen , ObjectTypePath ,
  ObjectTypeRegion , ObjectTypeImage , ObjectTypeFont , ObjectTypeStringFormat ,
  ObjectTypeImageAttributes , ObjectTypeCustomLineCap , ObjectTypeMax = ObjectTypeCustomLineCap
}
 
enum  imageattr_noop { IMAGEATTR_NOOP_UNDEFINED , IMAGEATTR_NOOP_SET , IMAGEATTR_NOOP_CLEAR }
 
enum  RegionType { RegionDataRect = 0x10000000 , RegionDataPath = 0x10000001 , RegionDataEmptyRect = 0x10000002 , RegionDataInfiniteRect = 0x10000003 }
 

Functions

COLORREF ARGB2COLORREF (ARGB color) DECLSPEC_HIDDEN
 
HBITMAP ARGB2BMP (ARGB color) DECLSPEC_HIDDEN
 
INT arc2polybezier (GpPointF *points, REAL x1, REAL y1, REAL x2, REAL y2, REAL startAngle, REAL sweepAngle) DECLSPEC_HIDDEN
 
REAL gdiplus_atan2 (REAL dy, REAL dx) DECLSPEC_HIDDEN
 
GpStatus hresult_to_status (HRESULT res) DECLSPEC_HIDDEN
 
REAL units_to_pixels (REAL units, GpUnit unit, REAL dpi) DECLSPEC_HIDDEN
 
REAL pixels_to_units (REAL pixels, GpUnit unit, REAL dpi) DECLSPEC_HIDDEN
 
REAL units_scale (GpUnit from, GpUnit to, REAL dpi) DECLSPEC_HIDDEN
 
GpStatus gdi_transform_acquire (GpGraphics *graphics)
 
GpStatus gdi_transform_release (GpGraphics *graphics)
 
GpStatus get_graphics_transform (GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpMatrix *matrix) DECLSPEC_HIDDEN
 
GpStatus gdip_transform_points (GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count) DECLSPEC_HIDDEN
 
GpStatus graphics_from_image (GpImage *image, GpGraphics **graphics) DECLSPEC_HIDDEN
 
GpStatus encode_image_png (GpImage *image, IStream *stream, GDIPCONST EncoderParameters *params) DECLSPEC_HIDDEN
 
GpStatus METAFILE_GetGraphicsContext (GpMetafile *metafile, GpGraphics **result) DECLSPEC_HIDDEN
 
GpStatus METAFILE_GetDC (GpMetafile *metafile, HDC *hdc) DECLSPEC_HIDDEN
 
GpStatus METAFILE_ReleaseDC (GpMetafile *metafile, HDC hdc) DECLSPEC_HIDDEN
 
GpStatus METAFILE_GraphicsClear (GpMetafile *metafile, ARGB color) DECLSPEC_HIDDEN
 
GpStatus METAFILE_FillRectangles (GpMetafile *metafile, GpBrush *brush, GDIPCONST GpRectF *rects, INT count) DECLSPEC_HIDDEN
 
GpStatus METAFILE_SetClipRect (GpMetafile *metafile, REAL x, REAL y, REAL width, REAL height, CombineMode mode) DECLSPEC_HIDDEN
 
GpStatus METAFILE_SetClipRegion (GpMetafile *metafile, GpRegion *region, CombineMode mode) DECLSPEC_HIDDEN
 
GpStatus METAFILE_SetPageTransform (GpMetafile *metafile, GpUnit unit, REAL scale) DECLSPEC_HIDDEN
 
GpStatus METAFILE_SetWorldTransform (GpMetafile *metafile, GDIPCONST GpMatrix *transform) DECLSPEC_HIDDEN
 
GpStatus METAFILE_ScaleWorldTransform (GpMetafile *metafile, REAL sx, REAL sy, MatrixOrder order) DECLSPEC_HIDDEN
 
GpStatus METAFILE_MultiplyWorldTransform (GpMetafile *metafile, GDIPCONST GpMatrix *matrix, MatrixOrder order) DECLSPEC_HIDDEN
 
GpStatus METAFILE_RotateWorldTransform (GpMetafile *metafile, REAL angle, MatrixOrder order) DECLSPEC_HIDDEN
 
GpStatus METAFILE_TranslateWorldTransform (GpMetafile *metafile, REAL dx, REAL dy, MatrixOrder order) DECLSPEC_HIDDEN
 
GpStatus METAFILE_ResetWorldTransform (GpMetafile *metafile) DECLSPEC_HIDDEN
 
GpStatus METAFILE_BeginContainer (GpMetafile *metafile, GDIPCONST GpRectF *dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, DWORD StackIndex) DECLSPEC_HIDDEN
 
GpStatus METAFILE_BeginContainerNoParams (GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
 
GpStatus METAFILE_EndContainer (GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
 
GpStatus METAFILE_SaveGraphics (GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
 
GpStatus METAFILE_RestoreGraphics (GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
 
GpStatus METAFILE_GraphicsDeleted (GpMetafile *metafile) DECLSPEC_HIDDEN
 
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
 
GpStatus METAFILE_AddSimpleProperty (GpMetafile *metafile, SHORT prop, SHORT val) DECLSPEC_HIDDEN
 
GpStatus METAFILE_DrawPath (GpMetafile *metafile, GpPen *pen, GpPath *path) DECLSPEC_HIDDEN
 
GpStatus METAFILE_FillPath (GpMetafile *metafile, GpBrush *brush, GpPath *path) DECLSPEC_HIDDEN
 
void METAFILE_Free (GpMetafile *metafile) DECLSPEC_HIDDEN
 
void calc_curve_bezier (const GpPointF *pts, REAL tension, REAL *x1, REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN
 
void calc_curve_bezier_endp (REAL xend, REAL yend, REAL xadj, REAL yadj, REAL tension, REAL *x, REAL *y) DECLSPEC_HIDDEN
 
void free_installed_fonts (void) DECLSPEC_HIDDEN
 
BOOL lengthen_path (GpPath *path, INT len) DECLSPEC_HIDDEN
 
DWORD write_region_data (const GpRegion *region, void *data) DECLSPEC_HIDDEN
 
DWORD write_path_data (GpPath *path, void *data) DECLSPEC_HIDDEN
 
GpStatus trace_path (GpGraphics *graphics, GpPath *path) DECLSPEC_HIDDEN
 
void delete_element (region_element *element) DECLSPEC_HIDDEN
 
GpStatus get_hatch_data (GpHatchStyle hatchstyle, const char **result) DECLSPEC_HIDDEN
 
static INT gdip_round (REAL x)
 
static INT ceilr (REAL x)
 
static REAL deg2rad (REAL degrees)
 
static ARGB color_over (ARGB bg, ARGB fg)
 
static ARGB color_over_fgpremult (ARGB bg, ARGB fg)
 
const chardebugstr_rectf (const RectF *rc) DECLSPEC_HIDDEN
 
const chardebugstr_pointf (const PointF *pt) DECLSPEC_HIDDEN
 
void convert_32bppARGB_to_32bppPARGB (UINT width, UINT height, BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride) DECLSPEC_HIDDEN
 
GpStatus convert_pixels (INT width, INT height, INT dst_stride, BYTE *dst_bits, PixelFormat dst_format, INT src_stride, const BYTE *src_bits, PixelFormat src_format, ColorPalette *palette) DECLSPEC_HIDDEN
 
PixelFormat apply_image_attributes (const GpImageAttributes *attributes, LPBYTE data, UINT width, UINT height, INT stride, ColorAdjustType type, PixelFormat fmt) DECLSPEC_HIDDEN
 
void init_generic_string_formats (void) DECLSPEC_HIDDEN
 
void free_generic_string_formats (void) DECLSPEC_HIDDEN
 
static void init_memory_buffer (struct memory_buffer *mbuf, const BYTE *buffer, INT size)
 
static const voidbuffer_read (struct memory_buffer *mbuf, INT size)
 
GpStatus gdip_format_string (HDC hdc, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data) DECLSPEC_HIDDEN
 
void get_log_fontW (const GpFont *, GpGraphics *, LOGFONTW *) DECLSPEC_HIDDEN
 
static BOOL image_lock (GpImage *image, BOOL *unlock)
 
static void image_unlock (GpImage *image, BOOL unlock)
 

Variables

const struct GpStringFormat default_drawstring_format DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ EmfPlusObjectTableSize

#define EmfPlusObjectTableSize   64

Definition at line 358 of file gdiplus_private.h.

◆ GIF_DISPOSE_DO_NOT_DISPOSE

#define GIF_DISPOSE_DO_NOT_DISPOSE   1

Definition at line 49 of file gdiplus_private.h.

◆ GIF_DISPOSE_RESTORE_TO_BKGND

#define GIF_DISPOSE_RESTORE_TO_BKGND   2

Definition at line 50 of file gdiplus_private.h.

◆ GIF_DISPOSE_RESTORE_TO_PREV

#define GIF_DISPOSE_RESTORE_TO_PREV   3

Definition at line 51 of file gdiplus_private.h.

◆ GIF_DISPOSE_UNSPECIFIED

#define GIF_DISPOSE_UNSPECIFIED   0

Definition at line 48 of file gdiplus_private.h.

◆ GP_DEFAULT_PENSTYLE

#define GP_DEFAULT_PENSTYLE   (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)

Definition at line 38 of file gdiplus_private.h.

◆ INCH_HIMETRIC

#define INCH_HIMETRIC   (2540)

Definition at line 41 of file gdiplus_private.h.

◆ MAX_ARC_PTS

#define MAX_ARC_PTS   (13)

Definition at line 39 of file gdiplus_private.h.

◆ MAX_DASHLEN

#define MAX_DASHLEN   (16) /* this is a limitation of gdi */

Definition at line 40 of file gdiplus_private.h.

◆ TENSION_CONST

#define TENSION_CONST   (0.3)

Definition at line 46 of file gdiplus_private.h.

◆ VALID_MAGIC

#define VALID_MAGIC (   x)    (((x) & 0xfffff000) == 0xdbc01000)

Definition at line 45 of file gdiplus_private.h.

◆ VERSION_MAGIC

#define VERSION_MAGIC   0xdbc01001

Definition at line 43 of file gdiplus_private.h.

◆ VERSION_MAGIC2

#define VERSION_MAGIC2   0xdbc01002

Definition at line 44 of file gdiplus_private.h.

◆ WineCoordinateSpaceGdiDevice

#define WineCoordinateSpaceGdiDevice   ((GpCoordinateSpace)4)

Definition at line 64 of file gdiplus_private.h.

Typedef Documentation

◆ EmfPlusObjectType

◆ gdip_format_string_callback

typedef GpStatus(* gdip_format_string_callback) (HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data)

Definition at line 579 of file gdiplus_private.h.

◆ region_element

Definition at line 122 of file gdiplus_private.h.

◆ RegionType

Enumeration Type Documentation

◆ EmfPlusObjectType

Enumerator
ObjectTypeInvalid 
ObjectTypeBrush 
ObjectTypePen 
ObjectTypePath 
ObjectTypeRegion 
ObjectTypeImage 
ObjectTypeFont 
ObjectTypeStringFormat 
ObjectTypeImageAttributes 
ObjectTypeCustomLineCap 
ObjectTypeMax 

Definition at line 360 of file gdiplus_private.h.

361{
EmfPlusObjectType
@ ObjectTypeStringFormat
@ ObjectTypeImage
@ ObjectTypeInvalid
@ ObjectTypeImageAttributes
@ ObjectTypePen
@ ObjectTypeFont
@ ObjectTypeCustomLineCap
@ ObjectTypeRegion
@ ObjectTypeMax
@ ObjectTypeBrush
@ ObjectTypePath

◆ imageattr_noop

Enumerator
IMAGEATTR_NOOP_UNDEFINED 
IMAGEATTR_NOOP_SET 
IMAGEATTR_NOOP_CLEAR 

Definition at line 467 of file gdiplus_private.h.

467 {
471};
@ IMAGEATTR_NOOP_UNDEFINED
@ IMAGEATTR_NOOP_CLEAR
@ IMAGEATTR_NOOP_SET

◆ RegionType

Enumerator
RegionDataRect 
RegionDataPath 
RegionDataEmptyRect 
RegionDataInfiniteRect 

Definition at line 527 of file gdiplus_private.h.

528{
529 RegionDataRect = 0x10000000,
530 RegionDataPath = 0x10000001,
531 RegionDataEmptyRect = 0x10000002,
532 RegionDataInfiniteRect = 0x10000003,
533} RegionType;
RegionType
@ RegionDataEmptyRect
@ RegionDataRect
@ RegionDataInfiniteRect
@ RegionDataPath

Function Documentation

◆ apply_image_attributes()

PixelFormat apply_image_attributes ( const GpImageAttributes attributes,
LPBYTE  data,
UINT  width,
UINT  height,
INT  stride,
ColorAdjustType  type,
PixelFormat  fmt 
)

Definition at line 710 of file graphics.c.

712{
713 UINT x, y;
714 INT i;
715
716 if ((attributes->noop[type] == IMAGEATTR_NOOP_UNDEFINED &&
718 (attributes->noop[type] == IMAGEATTR_NOOP_SET))
719 return fmt;
720
721 if (attributes->colorkeys[type].enabled ||
722 attributes->colorkeys[ColorAdjustTypeDefault].enabled)
723 {
724 const struct color_key *key;
725 BYTE min_blue, min_green, min_red;
726 BYTE max_blue, max_green, max_red;
727
728 if (!data || fmt != PixelFormat32bppARGB)
730
731 if (attributes->colorkeys[type].enabled)
732 key = &attributes->colorkeys[type];
733 else
734 key = &attributes->colorkeys[ColorAdjustTypeDefault];
735
736 min_blue = key->low&0xff;
737 min_green = (key->low>>8)&0xff;
738 min_red = (key->low>>16)&0xff;
739
740 max_blue = key->high&0xff;
741 max_green = (key->high>>8)&0xff;
742 max_red = (key->high>>16)&0xff;
743
744 for (x=0; x<width; x++)
745 for (y=0; y<height; y++)
746 {
747 ARGB *src_color;
748 BYTE blue, green, red;
749 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
750 blue = *src_color&0xff;
751 green = (*src_color>>8)&0xff;
752 red = (*src_color>>16)&0xff;
753 if (blue >= min_blue && green >= min_green && red >= min_red &&
754 blue <= max_blue && green <= max_green && red <= max_red)
755 *src_color = 0x00000000;
756 }
757 }
758
759 if (attributes->colorremaptables[type].enabled ||
760 attributes->colorremaptables[ColorAdjustTypeDefault].enabled)
761 {
762 const struct color_remap_table *table;
763
764 if (!data || fmt != PixelFormat32bppARGB)
766
767 if (attributes->colorremaptables[type].enabled)
768 table = &attributes->colorremaptables[type];
769 else
771
772 for (x=0; x<width; x++)
773 for (y=0; y<height; y++)
774 {
775 ARGB *src_color;
776 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
777 for (i=0; i<table->mapsize; i++)
778 {
779 if (*src_color == table->colormap[i].oldColor.Argb)
780 {
781 *src_color = table->colormap[i].newColor.Argb;
782 break;
783 }
784 }
785 }
786 }
787
788 if (attributes->colormatrices[type].enabled ||
789 attributes->colormatrices[ColorAdjustTypeDefault].enabled)
790 {
791 const struct color_matrix *colormatrices;
792 int color_matrix[5][5];
793 int gray_matrix[5][5];
795
796 if (!data || fmt != PixelFormat32bppARGB)
798
799 if (attributes->colormatrices[type].enabled)
800 colormatrices = &attributes->colormatrices[type];
801 else
802 colormatrices = &attributes->colormatrices[ColorAdjustTypeDefault];
803
805
806 if (colormatrices->flags == ColorMatrixFlagsAltGray)
807 identity = (round_color_matrix(&colormatrices->graymatrix, gray_matrix) && identity);
808
809 if (!identity)
810 {
811 for (x=0; x<width; x++)
812 {
813 for (y=0; y<height; y++)
814 {
815 ARGB *src_color;
816 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
817
818 if (colormatrices->flags == ColorMatrixFlagsDefault ||
819 !color_is_gray(*src_color))
820 {
821 *src_color = transform_color(*src_color, color_matrix);
822 }
823 else if (colormatrices->flags == ColorMatrixFlagsAltGray)
824 {
825 *src_color = transform_color(*src_color, gray_matrix);
826 }
827 }
828 }
829 }
830 }
831
832 if (attributes->gamma_enabled[type] ||
834 {
835 REAL gamma;
836
837 if (!data || fmt != PixelFormat32bppARGB)
839
840 if (attributes->gamma_enabled[type])
841 gamma = attributes->gamma[type];
842 else
843 gamma = attributes->gamma[ColorAdjustTypeDefault];
844
845 for (x=0; x<width; x++)
846 for (y=0; y<height; y++)
847 {
848 ARGB *src_color;
849 BYTE blue, green, red;
850 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
851
852 blue = *src_color&0xff;
853 green = (*src_color>>8)&0xff;
854 red = (*src_color>>16)&0xff;
855
856 /* FIXME: We should probably use a table for this. */
857 blue = floorf(powf(blue / 255.0, gamma) * 255.0);
858 green = floorf(powf(green / 255.0, gamma) * 255.0);
859 red = floorf(powf(red / 255.0, gamma) * 255.0);
860
861 *src_color = (*src_color & 0xff000000) | (red << 16) | (green << 8) | blue;
862 }
863 }
864
865 return fmt;
866}
float REAL
Definition: types.h:41
static ARGB transform_color(ARGB color, int matrix[5][5])
Definition: graphics.c:670
static BOOL color_is_gray(ARGB color)
Definition: graphics.c:698
static BOOL round_color_matrix(const ColorMatrix *matrix, int values[5][5])
Definition: graphics.c:653
unsigned int BOOL
Definition: ntddk_ex.h:94
@ ColorAdjustTypeDefault
@ ColorMatrixFlagsAltGray
@ ColorMatrixFlagsDefault
DWORD ARGB
#define PixelFormat32bppARGB
GLclampf green
Definition: gl.h:1740
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLclampf GLclampf blue
Definition: gl.h:1740
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizei stride
Definition: glext.h:5848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_ float __cdecl powf(_In_ float b, _In_ float e)
Definition: math.h:232
#define red
Definition: linetest.c:67
#define floorf(x)
Definition: mymath.h:65
unsigned int UINT
Definition: ndis.h:50
struct color_key colorkeys[ColorAdjustTypeCount]
REAL gamma[ColorAdjustTypeCount]
struct color_matrix colormatrices[ColorAdjustTypeCount]
enum imageattr_noop noop[ColorAdjustTypeCount]
BOOL gamma_enabled[ColorAdjustTypeCount]
struct color_remap_table colorremaptables[ColorAdjustTypeCount]
ColorMatrix graymatrix
ColorMatrixFlags flags
ColorMatrix colormatrix
Definition: dsound.c:943
Definition: copy.c:22
int32_t INT
Definition: typedefs.h:58
unsigned char BYTE
Definition: xxhash.c:193

Referenced by brush_fill_pixels(), GdipDrawImagePointsRect(), and GdipGetImageAttributesAdjustedPalette().

◆ arc2polybezier()

INT arc2polybezier ( GpPointF points,
REAL  x1,
REAL  y1,
REAL  x2,
REAL  y2,
REAL  startAngle,
REAL  sweepAngle 
)

Definition at line 223 of file gdiplus.c.

225{
226 INT i;
227 REAL end_angle, start_angle, endAngle;
228
229 endAngle = startAngle + sweepAngle;
230 unstretch_angle(&startAngle, x2 / 2.0, y2 / 2.0);
231 unstretch_angle(&endAngle, x2 / 2.0, y2 / 2.0);
232
233 /* start_angle and end_angle are the iterative variables */
234 start_angle = startAngle;
235
236 for(i = 0; i < MAX_ARC_PTS - 1; i += 3){
237 /* check if we've overshot the end angle */
238 if( sweepAngle > 0.0 )
239 {
240 if (start_angle >= endAngle) break;
241 end_angle = min(start_angle + M_PI_2, endAngle);
242 }
243 else
244 {
245 if (start_angle <= endAngle) break;
246 end_angle = max(start_angle - M_PI_2, endAngle);
247 }
248
249 if (points)
250 add_arc_part(&points[i], x1, y1, x2, y2, start_angle, end_angle, i == 0);
251
252 start_angle += M_PI_2 * (sweepAngle < 0.0 ? -1.0 : 1.0);
253 }
254
255 if (i == 0) return 0;
256 else return i+1;
257}
static void unstretch_angle(REAL *angle, REAL rad_x, REAL rad_y)
Definition: gdiplus.c:205
static void add_arc_part(GpPointF *pt, REAL x1, REAL y1, REAL x2, REAL y2, REAL start, REAL end, BOOL write_first)
Definition: gdiplus.c:162
#define MAX_ARC_PTS
GLsizei const GLfloat * points
Definition: glext.h:8112
#define M_PI_2
Definition: port.h:185
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711

Referenced by GdipAddPathArc(), GdipAddPathEllipse(), and GdipAddPathPie().

◆ ARGB2BMP()

HBITMAP ARGB2BMP ( ARGB  color)

Definition at line 272 of file gdiplus.c.

273{
274 BITMAPINFO bi;
276 RGBQUAD *bits;
277 int alpha;
278
279 if ((color & 0xff000000) == 0xff000000) return 0;
280
281 bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
282 bi.bmiHeader.biWidth = 1;
283 bi.bmiHeader.biHeight = 1;
284 bi.bmiHeader.biPlanes = 1;
285 bi.bmiHeader.biBitCount = 32;
287 bi.bmiHeader.biSizeImage = 0;
290 bi.bmiHeader.biClrUsed = 0;
292
293 result = CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void*)&bits, NULL, 0);
294
295 bits[0].rgbReserved = alpha = (color>>24)&0xff;
296 bits[0].rgbRed = ((color>>16)&0xff)*alpha/255;
297 bits[0].rgbGreen = ((color>>8)&0xff)*alpha/255;
298 bits[0].rgbBlue = (color&0xff)*alpha/255;
299
300 return result;
301}
#define NULL
Definition: types.h:112
#define BI_RGB
Definition: precomp.h:47
ULONG RGBQUAD
Definition: precomp.h:50
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
GLuint color
Definition: glext.h:6243
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLuint64EXT * result
Definition: glext.h:11304
#define bits
Definition: infblock.c:15
static HBITMAP
Definition: button.c:44
ULONG biClrImportant
Definition: precomp.h:43
USHORT biBitCount
Definition: precomp.h:37
LONG biYPelsPerMeter
Definition: precomp.h:41
ULONG biCompression
Definition: precomp.h:38
LONG biXPelsPerMeter
Definition: precomp.h:40
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define DIB_RGB_COLORS
Definition: wingdi.h:367

Referenced by brush_fill_path().

◆ ARGB2COLORREF()

COLORREF ARGB2COLORREF ( ARGB  color)

Definition at line 259 of file gdiplus.c.

260{
261 /*
262 Packing of these color structures:
263 COLORREF: 00bbggrr
264 ARGB: aarrggbb
265 FIXME:doesn't handle alpha channel
266 */
267 return ((color & 0x0000ff) << 16) +
268 (color & 0x00ff00) +
269 ((color & 0xff0000) >> 16);
270}

Referenced by create_gdi_logbrush(), and get_gdi_brush_color().

◆ buffer_read()

static const void * buffer_read ( struct memory_buffer mbuf,
INT  size 
)
inlinestatic

Definition at line 568 of file gdiplus_private.h.

569{
570 if (mbuf->size - mbuf->pos >= size)
571 {
572 const void *data = mbuf->buffer + mbuf->pos;
573 mbuf->pos += size;
574 return data;
575 }
576 return NULL;
577}
GLsizeiptr size
Definition: glext.h:5919
const BYTE * buffer

Referenced by GdipCreateRegionRgnData(), metafile_deserialize_region(), metafile_read_region_node(), and read_element().

◆ calc_curve_bezier()

void calc_curve_bezier ( const GpPointF pts,
REAL  tension,
REAL x1,
REAL y1,
REAL x2,
REAL y2 
)

Definition at line 379 of file gdiplus.c.

381{
382 REAL xdiff, ydiff;
383
384 /* calculate tangent */
385 xdiff = pts[2].X - pts[0].X;
386 ydiff = pts[2].Y - pts[0].Y;
387
388 /* apply tangent to get control points */
389 *x1 = pts[1].X - tension * xdiff;
390 *y1 = pts[1].Y - tension * ydiff;
391 *x2 = pts[1].X + tension * xdiff;
392 *y2 = pts[1].Y + tension * ydiff;
393}
REAL Y
Definition: gdiplustypes.h:649
REAL X
Definition: gdiplustypes.h:648

Referenced by GdipAddPathClosedCurve2(), and GdipAddPathCurve2().

◆ calc_curve_bezier_endp()

void calc_curve_bezier_endp ( REAL  xend,
REAL  yend,
REAL  xadj,
REAL  yadj,
REAL  tension,
REAL x,
REAL y 
)

Definition at line 396 of file gdiplus.c.

398{
399 /* tangent at endpoints is the line from the endpoint to the adjacent point */
400 *x = gdip_round(tension * (xadj - xend) + xend);
401 *y = gdip_round(tension * (yadj - yend) + yend);
402}
static INT gdip_round(REAL x)

Referenced by GdipAddPathCurve2().

◆ ceilr()

static INT ceilr ( REAL  x)
inlinestatic

Definition at line 132 of file gdiplus_private.h.

133{
134 return (INT) ceilf(x);
135}
#define ceilf(x)
Definition: mymath.h:62

Referenced by GdipIsVisibleRegionRect().

◆ color_over()

static ARGB color_over ( ARGB  bg,
ARGB  fg 
)
inlinestatic

Definition at line 142 of file gdiplus_private.h.

143{
144 BYTE b, g, r, a;
145 BYTE bg_alpha, fg_alpha;
146
147 fg_alpha = (fg>>24)&0xff;
148
149 if (fg_alpha == 0xff) return fg;
150
151 if (fg_alpha == 0) return bg;
152
153 bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff;
154
155 if (bg_alpha == 0) return fg;
156
157 a = bg_alpha + fg_alpha;
158 b = ((bg&0xff)*bg_alpha + (fg&0xff)*fg_alpha)/a;
159 g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*fg_alpha)/a;
160 r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*fg_alpha)/a;
161
162 return (a<<24)|(r<<16)|(g<<8)|b;
163}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79

Referenced by alpha_blend_bmp_pixels().

◆ color_over_fgpremult()

static ARGB color_over_fgpremult ( ARGB  bg,
ARGB  fg 
)
inlinestatic

Definition at line 166 of file gdiplus_private.h.

167{
168 BYTE b, g, r, a;
169 BYTE bg_alpha, fg_alpha;
170
171 fg_alpha = (fg>>24)&0xff;
172
173 if (fg_alpha == 0) return bg;
174
175 bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff;
176
177 a = bg_alpha + fg_alpha;
178 b = ((bg&0xff)*bg_alpha + (fg&0xff)*0xff)/a;
179 g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*0xff)/a;
180 r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*0xff)/a;
181
182 return (a<<24)|(r<<16)|(g<<8)|b;
183}

Referenced by alpha_blend_bmp_pixels().

◆ convert_32bppARGB_to_32bppPARGB()

void convert_32bppARGB_to_32bppPARGB ( UINT  width,
UINT  height,
BYTE dst_bits,
INT  dst_stride,
const BYTE src_bits,
INT  src_stride 
)

Definition at line 435 of file gdiplus.c.

437{
438 INT x, y;
439 for (y=0; y<height; y++)
440 {
441 const BYTE *src=src_bits+y*src_stride;
442 BYTE *dst=dst_bits+y*dst_stride;
443 for (x=0; x<width; x++)
444 {
445 BYTE alpha=src[3];
446 *dst++ = (*src++ * alpha + 127) / 255;
447 *dst++ = (*src++ * alpha + 127) / 255;
448 *dst++ = (*src++ * alpha + 127) / 255;
449 *dst++ = *src++;
450 }
451 }
452}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by alpha_blend_hdc_pixels(), and convert_pixels().

◆ convert_pixels()

GpStatus convert_pixels ( INT  width,
INT  height,
INT  dst_stride,
BYTE dst_bits,
PixelFormat  dst_format,
INT  src_stride,
const BYTE src_bits,
PixelFormat  src_format,
ColorPalette palette 
)

Definition at line 562 of file image.c.

566{
567 INT x, y;
568
569 if (src_format == dst_format ||
570 (dst_format == PixelFormat32bppRGB && PIXELFORMATBPP(src_format) == 32))
571 {
572 UINT widthbytes = PIXELFORMATBPP(src_format) * width / 8;
573 for (y=0; y<height; y++)
574 memcpy(dst_bits+dst_stride*y, src_bits+src_stride*y, widthbytes);
575 return Ok;
576 }
577
578#define convert_indexed_to_rgb(getpixel_function, setpixel_function) do { \
579 for (y=0; y<height; y++) \
580 for (x=0; x<width; x++) { \
581 BYTE index; \
582 ARGB argb; \
583 BYTE *color = (BYTE *)&argb; \
584 getpixel_function(&index, src_bits+src_stride*y, x); \
585 argb = (palette && index < palette->Count) ? palette->Entries[index] : 0; \
586 setpixel_function(color[2], color[1], color[0], color[3], dst_bits+dst_stride*y, x); \
587 } \
588 return Ok; \
589} while (0);
590
591#define convert_rgb_to_rgb(getpixel_function, setpixel_function) do { \
592 for (y=0; y<height; y++) \
593 for (x=0; x<width; x++) { \
594 BYTE r, g, b, a; \
595 getpixel_function(&r, &g, &b, &a, src_bits+src_stride*y, x); \
596 setpixel_function(r, g, b, a, dst_bits+dst_stride*y, x); \
597 } \
598 return Ok; \
599} while (0);
600
601#define convert_rgb_to_indexed(getpixel_function, setpixel_function) do { \
602 for (y=0; y<height; y++) \
603 for (x=0; x<width; x++) { \
604 BYTE r, g, b, a; \
605 getpixel_function(&r, &g, &b, &a, src_bits+src_stride*y, x); \
606 setpixel_function(r, g, b, a, dst_bits+dst_stride*y, x, palette); \
607 } \
608 return Ok; \
609} while (0);
610
611 switch (src_format)
612 {
614 switch (dst_format)
615 {
636 default:
637 break;
638 }
639 break;
641 switch (dst_format)
642 {
663 default:
664 break;
665 }
666 break;
668 switch (dst_format)
669 {
690 default:
691 break;
692 }
693 break;
695 switch (dst_format)
696 {
719 default:
720 break;
721 }
722 break;
724 switch (dst_format)
725 {
748 default:
749 break;
750 }
751 break;
753 switch (dst_format)
754 {
777 default:
778 break;
779 }
780 break;
782 switch (dst_format)
783 {
806 default:
807 break;
808 }
809 break;
811 switch (dst_format)
812 {
835 default:
836 break;
837 }
838 break;
840 switch (dst_format)
841 {
864 default:
865 break;
866 }
867 break;
869 switch (dst_format)
870 {
886 convert_32bppARGB_to_32bppPARGB(width, height, dst_bits, dst_stride, src_bits, src_stride);
887 return Ok;
892 default:
893 break;
894 }
895 break;
897 switch (dst_format)
898 {
921 default:
922 break;
923 }
924 break;
926 switch (dst_format)
927 {
950 default:
951 break;
952 }
953 break;
955 switch (dst_format)
956 {
979 default:
980 break;
981 }
982 break;
984 switch (dst_format)
985 {
1010 default:
1011 break;
1012 }
1013 break;
1014 default:
1015 break;
1016 }
1017
1018#undef convert_indexed_to_rgb
1019#undef convert_rgb_to_rgb
1020
1021 return NotImplemented;
1022}
static void setpixel_16bppARGB1555(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:430
static void setpixel_48bppRGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:468
static void setpixel_32bppPARGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:459
#define PIXELFORMATBPP(x)
Definition: image.c:45
static void getpixel_16bppARGB1555(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:202
static void getpixel_64bppPARGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:274
static void getpixel_16bppRGB565(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:192
static void getpixel_4bppIndexed(BYTE *index, const BYTE *row, UINT x)
Definition: image.c:162
static void setpixel_16bppRGB555(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:414
#define convert_rgb_to_indexed(getpixel_function, setpixel_function)
static void setpixel_32bppRGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:447
static void getpixel_1bppIndexed(BYTE *index, const BYTE *row, UINT x)
Definition: image.c:157
static void getpixel_32bppRGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:224
static void getpixel_8bppIndexed(BYTE *index, const BYTE *row, UINT x)
Definition: image.c:170
#define convert_indexed_to_rgb(getpixel_function, setpixel_function)
static void getpixel_64bppARGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:265
static void getpixel_48bppRGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:256
static void setpixel_16bppGrayScale(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:408
static void getpixel_16bppGrayScale(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:175
static void setpixel_64bppARGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:476
static void getpixel_24bppRGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:215
#define convert_rgb_to_rgb(getpixel_function, setpixel_function)
static void setpixel_32bppARGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:453
static void setpixel_16bppRGB565(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:422
static void getpixel_16bppRGB555(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:182
static void setpixel_1bppIndexed(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x, ColorPalette *palette)
Definition: image.c:393
static void getpixel_32bppARGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:233
static void setpixel_8bppIndexed(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x, ColorPalette *palette)
Definition: image.c:386
static void setpixel_24bppRGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:439
static void getpixel_32bppPARGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:242
void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height, BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride)
Definition: gdiplus.c:435
#define PixelFormat32bppPARGB
#define PixelFormat64bppARGB
#define PixelFormat32bppRGB
#define PixelFormat4bppIndexed
#define PixelFormat64bppPARGB
#define PixelFormat16bppRGB555
#define PixelFormat16bppARGB1555
#define PixelFormat16bppGrayScale
#define PixelFormat8bppIndexed
#define PixelFormat24bppRGB
#define PixelFormat16bppRGB565
#define PixelFormat1bppIndexed
#define PixelFormat48bppRGB
@ Ok
Definition: gdiplustypes.h:26
@ NotImplemented
Definition: gdiplustypes.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const char * dst_format
Definition: dib.c:1133

Referenced by GdipBitmapLockBits(), GdipBitmapUnlockBits(), GdipCloneBitmapArea(), GdipCreateHBITMAPFromBitmap(), and GdipDrawImagePointsRect().

◆ debugstr_pointf()

const char * debugstr_pointf ( const PointF pt)

Definition at line 482 of file gdiplus.c.

483{
484 if (!pt) return "(null)";
485 return wine_dbg_sprintf("(%0.2f,%0.2f)", pt->X, pt->Y);
486}
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
#define pt(x, y)
Definition: drawing.c:79

Referenced by GdipCreateLineBrush(), GdipDrawImagePointsRect(), GdipEnumerateMetafileSrcRectDestPoints(), and GdipSetPathGradientCenterPoint().

◆ debugstr_rectf()

const char * debugstr_rectf ( const RectF rc)

Definition at line 476 of file gdiplus.c.

477{
478 if (!rc) return "(null)";
479 return wine_dbg_sprintf("(%0.2f,%0.2f,%0.2f,%0.2f)", rc->X, rc->Y, rc->Width, rc->Height);
480}
REAL Height
Definition: gdiplustypes.h:664
REAL X
Definition: gdiplustypes.h:661
REAL Width
Definition: gdiplustypes.h:663
REAL Y
Definition: gdiplustypes.h:662

Referenced by GdipBeginContainer(), GdipCombineRegionRect(), GdipDrawString(), GdipEnumerateMetafileSrcRectDestPoints(), GdipGetRegionBounds(), GdipMeasureCharacterRanges(), and GdipMeasureString().

◆ deg2rad()

static REAL deg2rad ( REAL  degrees)
inlinestatic

Definition at line 137 of file gdiplus_private.h.

138{
139 return M_PI * degrees / 180.0;
140}
#define M_PI
Definition: macros.h:263

Referenced by GdipCreateLineBrushFromRectWithAngle(), GdipRotateMatrix(), and unstretch_angle().

◆ delete_element()

void delete_element ( region_element element)

Definition at line 455 of file gdiplus.c.

456{
457 switch(element->type)
458 {
459 case RegionDataRect:
460 break;
461 case RegionDataPath:
462 GdipDeletePath(element->elementdata.path);
463 break;
466 break;
467 default:
468 delete_element(element->elementdata.combine.left);
469 delete_element(element->elementdata.combine.right);
470 heap_free(element->elementdata.combine.left);
471 heap_free(element->elementdata.combine.right);
472 break;
473 }
474}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
void delete_element(region_element *element)
Definition: gdiplus.c:455

Referenced by clone_element(), delete_element(), GdipCombineRegionPath(), GdipCombineRegionRect(), GdipCombineRegionRegion(), GdipDeleteRegion(), GdipGetClip(), GdipSetEmpty(), and GdipSetInfinite().

◆ encode_image_png()

GpStatus encode_image_png ( GpImage image,
IStream stream,
GDIPCONST EncoderParameters params 
)

Definition at line 4650 of file image.c.

4652{
4653 return encode_image_wic(image, stream, &GUID_ContainerFormatPng, params);
4654}
static GpStatus encode_image_wic(GpImage *image, IStream *stream, REFGUID container, GDIPCONST EncoderParameters *params)
Definition: image.c:4503
GLenum const GLfloat * params
Definition: glext.h:5645
Definition: parse.h:23

Referenced by METAFILE_CreateCompressedImageStream().

◆ free_generic_string_formats()

void free_generic_string_formats ( void  )

Definition at line 67 of file stringformat.c.

68{
71
74}
static GpStringFormat generic_default_format
Definition: stringformat.c:53
static GpStringFormat generic_typographic_format
Definition: stringformat.c:54
CharacterRange * character_ranges

Referenced by DllMain().

◆ free_installed_fonts()

void free_installed_fonts ( void  )

Definition at line 1608 of file font.c.

1609{
1615}
GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
Definition: font.c:869
static GpFontCollection installedFontCollection
Definition: font.c:121
GpFontFamily ** FontFamilies

Referenced by DllMain(), and GdipNewInstalledFontCollection().

◆ gdi_transform_acquire()

GpStatus gdi_transform_acquire ( GpGraphics graphics)

Definition at line 6842 of file graphics.c.

6843{
6844 if (graphics->gdi_transform_acquire_count == 0 && graphics->hdc)
6845 {
6846 graphics->gdi_transform_save = SaveDC(graphics->hdc);
6847 SetGraphicsMode(graphics->hdc, GM_COMPATIBLE);
6848 SetMapMode(graphics->hdc, MM_TEXT);
6849 SetWindowOrgEx(graphics->hdc, 0, 0, NULL);
6850 SetViewportOrgEx(graphics->hdc, 0, 0, NULL);
6851 }
6852 graphics->gdi_transform_acquire_count++;
6853 return Ok;
6854}
INT gdi_transform_acquire_count
INT gdi_transform_save
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define GM_COMPATIBLE
Definition: wingdi.h:864
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
Definition: dc.c:1226
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
#define MM_TEXT
Definition: wingdi.h:873
int WINAPI SaveDC(_In_ HDC)

Referenced by GDI32_GdipDrawDriverString(), GDI32_GdipDrawPath(), GDI32_GdipFillPath(), GdipDrawImagePointsRect(), GdipDrawString(), GdipMeasureCharacterRanges(), GdipMeasureString(), get_path_hrgn(), SOFTWARE_GdipDrawDriverString(), SOFTWARE_GdipDrawThinPath(), and SOFTWARE_GdipFillRegion().

◆ gdi_transform_release()

GpStatus gdi_transform_release ( GpGraphics graphics)

Definition at line 6856 of file graphics.c.

6857{
6858 if (graphics->gdi_transform_acquire_count <= 0)
6859 {
6860 ERR("called without matching gdi_transform_acquire\n");
6861 return GenericError;
6862 }
6863 if (graphics->gdi_transform_acquire_count == 1 && graphics->hdc)
6864 {
6865 RestoreDC(graphics->hdc, graphics->gdi_transform_save);
6866 }
6867 graphics->gdi_transform_acquire_count--;
6868 return Ok;
6869}
#define ERR(fmt,...)
Definition: debug.h:110
@ GenericError
Definition: gdiplustypes.h:27
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)

Referenced by GDI32_GdipDrawDriverString(), GDI32_GdipDrawPath(), GDI32_GdipFillPath(), GdipDrawImagePointsRect(), GdipDrawString(), GdipMeasureCharacterRanges(), GdipMeasureString(), get_path_hrgn(), SOFTWARE_GdipDrawDriverString(), SOFTWARE_GdipDrawThinPath(), and SOFTWARE_GdipFillRegion().

◆ gdip_format_string()

GpStatus gdip_format_string ( HDC  hdc,
GDIPCONST WCHAR string,
INT  length,
GDIPCONST GpFont font,
GDIPCONST RectF rect,
GDIPCONST GpStringFormat format,
int  ignore_empty_clip,
gdip_format_string_callback  callback,
void user_data 
)

Definition at line 5201 of file graphics.c.

5205{
5206 WCHAR* stringdup;
5207 int sum = 0, height = 0, fit, fitcpy, i, j, lret, nwidth,
5208 nheight, lineend, lineno = 0;
5209 RectF bounds;
5210 StringAlignment halign;
5211 GpStatus stat = Ok;
5212 SIZE size;
5213 HotkeyPrefix hkprefix;
5214 INT *hotkeyprefix_offsets=NULL;
5215 INT hotkeyprefix_count=0;
5216 INT hotkeyprefix_pos=0, hotkeyprefix_end_pos=0;
5217 BOOL seen_prefix = FALSE;
5218
5219 if(length == -1) length = lstrlenW(string);
5220
5221 stringdup = heap_alloc_zero((length + 1) * sizeof(WCHAR));
5222 if(!stringdup) return OutOfMemory;
5223
5224 if (!format)
5226
5227 nwidth = rect->Width;
5228 nheight = rect->Height;
5229 if (ignore_empty_clip)
5230 {
5231 if (!nwidth) nwidth = INT_MAX;
5232 if (!nheight) nheight = INT_MAX;
5233 }
5234
5235 hkprefix = format->hkprefix;
5236
5237 if (hkprefix == HotkeyPrefixShow)
5238 {
5239 for (i=0; i<length; i++)
5240 {
5241 if (string[i] == '&')
5242 hotkeyprefix_count++;
5243 }
5244 }
5245
5246 if (hotkeyprefix_count)
5247 hotkeyprefix_offsets = heap_alloc_zero(sizeof(INT) * hotkeyprefix_count);
5248
5249 hotkeyprefix_count = 0;
5250
5251 for(i = 0, j = 0; i < length; i++){
5252 /* FIXME: This makes the indexes passed to callback inaccurate. */
5253 if(!isprintW(string[i]) && (string[i] != '\n'))
5254 continue;
5255
5256 /* FIXME: tabs should be handled using tabstops from stringformat */
5257 if (string[i] == '\t')
5258 continue;
5259
5260 if (seen_prefix && hkprefix == HotkeyPrefixShow && string[i] != '&')
5261 hotkeyprefix_offsets[hotkeyprefix_count++] = j;
5262 else if (!seen_prefix && hkprefix != HotkeyPrefixNone && string[i] == '&')
5263 {
5264 seen_prefix = TRUE;
5265 continue;
5266 }
5267
5268 seen_prefix = FALSE;
5269
5270 stringdup[j] = string[i];
5271 j++;
5272 }
5273
5274 length = j;
5275
5276 halign = format->align;
5277
5278 while(sum < length){
5279 GetTextExtentExPointW(hdc, stringdup + sum, length - sum,
5280 nwidth, &fit, NULL, &size);
5281 fitcpy = fit;
5282
5283 if(fit == 0)
5284 break;
5285
5286 for(lret = 0; lret < fit; lret++)
5287 if(*(stringdup + sum + lret) == '\n')
5288 break;
5289
5290 /* Line break code (may look strange, but it imitates windows). */
5291 if(lret < fit)
5292 lineend = fit = lret; /* this is not an off-by-one error */
5293 else if(fit < (length - sum)){
5294 if(*(stringdup + sum + fit) == ' ')
5295 while(*(stringdup + sum + fit) == ' ')
5296 fit++;
5297 else
5298 while(*(stringdup + sum + fit - 1) != ' '){
5299 fit--;
5300
5301 if(*(stringdup + sum + fit) == '\t')
5302 break;
5303
5304 if(fit == 0){
5305 fit = fitcpy;
5306 break;
5307 }
5308 }
5309 lineend = fit;
5310 while(*(stringdup + sum + lineend - 1) == ' ' ||
5311 *(stringdup + sum + lineend - 1) == '\t')
5312 lineend--;
5313 }
5314 else
5315 lineend = fit;
5316
5317 GetTextExtentExPointW(hdc, stringdup + sum, lineend,
5318 nwidth, &j, NULL, &size);
5319
5320 bounds.Width = size.cx;
5321
5322 if(height + size.cy > nheight)
5323 {
5325 break;
5326 bounds.Height = nheight - (height + size.cy);
5327 }
5328 else
5329 bounds.Height = size.cy;
5330
5331 bounds.Y = rect->Y + height;
5332
5333 switch (halign)
5334 {
5336 default:
5337 bounds.X = rect->X;
5338 break;
5340 bounds.X = rect->X + (rect->Width/2) - (bounds.Width/2);
5341 break;
5342 case StringAlignmentFar:
5343 bounds.X = rect->X + rect->Width - bounds.Width;
5344 break;
5345 }
5346
5347 for (hotkeyprefix_end_pos=hotkeyprefix_pos; hotkeyprefix_end_pos<hotkeyprefix_count; hotkeyprefix_end_pos++)
5348 if (hotkeyprefix_offsets[hotkeyprefix_end_pos] >= sum + lineend)
5349 break;
5350
5351 stat = callback(hdc, stringdup, sum, lineend,
5352 font, rect, format, lineno, &bounds,
5353 &hotkeyprefix_offsets[hotkeyprefix_pos],
5354 hotkeyprefix_end_pos-hotkeyprefix_pos, user_data);
5355
5356 if (stat != Ok)
5357 break;
5358
5359 sum += fit + (lret < fitcpy ? 1 : 0);
5360 height += size.cy;
5361 lineno++;
5362
5363 hotkeyprefix_pos = hotkeyprefix_end_pos;
5364
5365 if(height > nheight)
5366 break;
5367
5368 /* Stop if this was a linewrap (but not if it was a linebreak). */
5369 if ((lret == fitcpy) && (format->attr & StringFormatFlagsNoWrap))
5370 break;
5371 }
5372
5373 heap_free(stringdup);
5374 heap_free(hotkeyprefix_offsets);
5375
5376 return stat;
5377}
#define stat
Definition: acwin.h:99
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define lstrlenW
Definition: compat.h:750
const GpStringFormat default_drawstring_format
Definition: stringformat.c:35
StringAlignment
Definition: gdiplusenums.h:264
@ StringAlignmentCenter
Definition: gdiplusenums.h:266
@ StringAlignmentNear
Definition: gdiplusenums.h:265
@ StringAlignmentFar
Definition: gdiplusenums.h:267
HotkeyPrefix
Definition: gdiplusenums.h:312
@ HotkeyPrefixShow
Definition: gdiplusenums.h:314
@ HotkeyPrefixNone
Definition: gdiplusenums.h:313
@ StringFormatFlagsLineLimit
Definition: gdiplusenums.h:287
@ StringFormatFlagsNoWrap
Definition: gdiplusenums.h:286
Status
Definition: gdiplustypes.h:25
@ OutOfMemory
Definition: gdiplustypes.h:29
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define INT_MAX
Definition: limits.h:40
HDC hdc
Definition: main.c:9
static IPrintDialogCallback callback
Definition: printdlg.c:326
Definition: mk_font.cpp:20
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
#define isprintW
Definition: unicode.h:62
& rect
Definition: startmenu.cpp:1413
Definition: stat.h:55
BOOL WINAPI GetTextExtentExPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpszString, _In_ int cchString, _In_ int nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by GdipAddPathString(), GdipDrawString(), GdipMeasureCharacterRanges(), and GdipMeasureString().

◆ gdip_round()

◆ gdip_transform_points()

GpStatus gdip_transform_points ( GpGraphics graphics,
GpCoordinateSpace  dst_space,
GpCoordinateSpace  src_space,
GpPointF points,
INT  count 
)

Definition at line 6948 of file graphics.c.

6950{
6952 GpStatus stat;
6953
6954 stat = get_graphics_transform(graphics, dst_space, src_space, &matrix);
6955 if (stat != Ok) return stat;
6956
6958}
GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpMatrix *matrix)
Definition: graphics.c:6871
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
Definition: matrix.c:363
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLenum matrix
Definition: glext.h:9407

Referenced by brush_fill_pixels(), draw_cap(), draw_poly(), GDI32_GdipDrawDriverString(), GdipDrawImagePointsRect(), GdipDrawString(), GdipMeasureCharacterRanges(), GdipMeasureDriverString(), GdipMeasureString(), GdipTransformPoints(), get_font_hfont(), get_graphics_bounds(), prepare_dc(), SOFTWARE_GdipDrawDriverString(), and SOFTWARE_GdipDrawPath().

◆ gdiplus_atan2()

REAL gdiplus_atan2 ( REAL  dy,
REAL  dx 
)

Definition at line 304 of file gdiplus.c.

305{
306 if((dx == 0.0) && (dy != 0.0))
307 return dy > 0.0 ? M_PI_2 : -M_PI_2;
308
309 return atan2(dy, dx);
310}
valarray< _Tp > atan2(const valarray< _Tp > &__x, const valarray< _Tp > &__y)
Definition: _valarray.h:928
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

Referenced by draw_cap(), GdipGetLogFontW(), get_font_hfont(), shorten_line_percent(), and unstretch_angle().

◆ get_graphics_transform()

GpStatus get_graphics_transform ( GpGraphics graphics,
GpCoordinateSpace  dst_space,
GpCoordinateSpace  src_space,
GpMatrix matrix 
)

Definition at line 6871 of file graphics.c.

6873{
6874 GpStatus stat = Ok;
6875 REAL scale_x, scale_y;
6876
6877 GdipSetMatrixElements(matrix, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
6878
6879 if (dst_space != src_space)
6880 {
6881 scale_x = units_to_pixels(1.0, graphics->unit, graphics->xres);
6882 scale_y = units_to_pixels(1.0, graphics->unit, graphics->yres);
6883
6884 if(graphics->unit != UnitDisplay)
6885 {
6886 scale_x *= graphics->scale;
6887 scale_y *= graphics->scale;
6888 }
6889
6890 if (dst_space < src_space)
6891 {
6892 /* transform towards world space */
6893 switch ((int)src_space)
6894 {
6896 {
6897 GpMatrix gdixform;
6898 gdixform = graphics->gdi_transform;
6899 stat = GdipInvertMatrix(&gdixform);
6900 if (stat != Ok)
6901 break;
6903 if (dst_space == CoordinateSpaceDevice)
6904 break;
6905 /* else fall-through */
6906 }
6908 GdipScaleMatrix(matrix, 1.0/scale_x, 1.0/scale_y, MatrixOrderAppend);
6909 if (dst_space == CoordinateSpacePage)
6910 break;
6911 /* else fall-through */
6913 {
6914 GpMatrix inverted_transform = graphics->worldtrans;
6915 stat = GdipInvertMatrix(&inverted_transform);
6916 if (stat == Ok)
6917 GdipMultiplyMatrix(matrix, &inverted_transform, MatrixOrderAppend);
6918 break;
6919 }
6920 }
6921 }
6922 else
6923 {
6924 /* transform towards device space */
6925 switch ((int)src_space)
6926 {
6929 if (dst_space == CoordinateSpacePage)
6930 break;
6931 /* else fall-through */
6933 GdipScaleMatrix(matrix, scale_x, scale_y, MatrixOrderAppend);
6934 if (dst_space == CoordinateSpaceDevice)
6935 break;
6936 /* else fall-through */
6938 {
6940 break;
6941 }
6942 }
6943 }
6944 }
6945 return stat;
6946}
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:289
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, GpMatrixOrder order)
Definition: matrix.c:240
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: matrix.c:316
GpStatus WINGDIPAPI GdipInvertMatrix(GpMatrix *matrix)
Definition: matrix.c:185
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
Definition: gdiplus.c:327
#define WineCoordinateSpaceGdiDevice
@ MatrixOrderAppend
Definition: gdiplusenums.h:189
@ UnitDisplay
Definition: gdiplusenums.h:28
@ CoordinateSpaceDevice
Definition: gdiplusenums.h:369
@ CoordinateSpaceWorld
Definition: gdiplusenums.h:367
@ CoordinateSpacePage
Definition: gdiplusenums.h:368
GpMatrix worldtrans
GpMatrix gdi_transform

Referenced by brush_fill_pixels(), gdip_transform_points(), GdipGetClip(), GdipGetVisibleClipBounds(), GdipIsOutlineVisiblePathPoint(), GdipSetClipHrgn(), GdipSetClipPath(), GdipSetClipRect(), GdipSetClipRegion(), get_clip_hrgn(), metafile_set_clip_region(), SOFTWARE_GdipDrawPath(), SOFTWARE_GdipDrawThinPath(), and SOFTWARE_GdipFillRegion().

◆ get_hatch_data()

GpStatus get_hatch_data ( GpHatchStyle  hatchstyle,
const char **  result 
)

Definition at line 262 of file brush.c.

263{
264 if (hatchstyle < ARRAY_SIZE(HatchBrushes))
265 {
266 *result = HatchBrushes[hatchstyle];
267 return Ok;
268 }
269 else
270 return NotImplemented;
271}
#define ARRAY_SIZE(A)
Definition: main.h:33
static const char HatchBrushes[][8]
Definition: brush.c:229

Referenced by brush_fill_pixels(), and create_hatch_bitmap().

◆ get_log_fontW()

void get_log_fontW ( const GpFont font,
GpGraphics graphics,
LOGFONTW lf 
)

Definition at line 2305 of file graphics.c.

2306{
2307 REAL height;
2308
2309 if (font->unit == UnitPixel)
2310 {
2311 height = units_to_pixels(font->emSize, graphics->unit, graphics->yres);
2312 }
2313 else
2314 {
2315 if (graphics->unit == UnitDisplay || graphics->unit == UnitPixel)
2316 height = units_to_pixels(font->emSize, font->unit, graphics->xres);
2317 else
2318 height = units_to_pixels(font->emSize, font->unit, graphics->yres);
2319 }
2320
2321 lf->lfHeight = -(height + 0.5);
2322 lf->lfWidth = 0;
2323 lf->lfEscapement = 0;
2324 lf->lfOrientation = 0;
2325 lf->lfWeight = font->otm.otmTextMetrics.tmWeight;
2326 lf->lfItalic = font->otm.otmTextMetrics.tmItalic ? 1 : 0;
2327 lf->lfUnderline = font->otm.otmTextMetrics.tmUnderlined ? 1 : 0;
2328 lf->lfStrikeOut = font->otm.otmTextMetrics.tmStruckOut ? 1 : 0;
2329 lf->lfCharSet = font->otm.otmTextMetrics.tmCharSet;
2333 lf->lfPitchAndFamily = 0;
2334 strcpyW(lf->lfFaceName, font->family->FamilyName);
2335}
@ UnitPixel
Definition: gdiplusenums.h:29
#define strcpyW(d, s)
Definition: unicode.h:29
BYTE lfOutPrecision
Definition: dimm.idl:68
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfClipPrecision
Definition: dimm.idl:69
LONG lfEscapement
Definition: dimm.idl:61
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfQuality
Definition: dimm.idl:70
BYTE lfPitchAndFamily
Definition: dimm.idl:71
#define DEFAULT_QUALITY
Definition: wingdi.h:436
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426

Referenced by GdipAddPathString(), and get_font_hfont().

◆ graphics_from_image()

GpStatus graphics_from_image ( GpImage image,
GpGraphics **  graphics 
)

Definition at line 2484 of file graphics.c.

2485{
2486 GpStatus retval;
2487
2488 *graphics = heap_alloc_zero(sizeof(GpGraphics));
2489 if(!*graphics) return OutOfMemory;
2490
2491 GdipSetMatrixElements(&(*graphics)->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
2492 GdipSetMatrixElements(&(*graphics)->gdi_transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
2493
2494 if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){
2495 heap_free(*graphics);
2496 return retval;
2497 }
2498
2499 (*graphics)->hdc = NULL;
2500 (*graphics)->hwnd = NULL;
2501 (*graphics)->owndc = FALSE;
2502 (*graphics)->image = image;
2503 /* We have to store the image type here because the image may be freed
2504 * before GdipDeleteGraphics is called, and metafiles need special treatment. */
2505 (*graphics)->image_type = image->type;
2506 (*graphics)->smoothing = SmoothingModeDefault;
2507 (*graphics)->compqual = CompositingQualityDefault;
2508 (*graphics)->interpolation = InterpolationModeBilinear;
2509 (*graphics)->pixeloffset = PixelOffsetModeDefault;
2510 (*graphics)->compmode = CompositingModeSourceOver;
2511 (*graphics)->unit = UnitDisplay;
2512 (*graphics)->scale = 1.0;
2513 (*graphics)->xres = image->xres;
2514 (*graphics)->yres = image->yres;
2515 (*graphics)->busy = FALSE;
2516 (*graphics)->textcontrast = 4;
2517 list_init(&(*graphics)->containers);
2518#ifdef __REACTOS__
2519 (*graphics)->contid = GDIP_GET_NEW_CONTID_FOR(*graphics);
2520#else
2521 (*graphics)->contid = 0;
2522#endif
2523
2524 TRACE("<-- %p\n", *graphics);
2525
2526 return Ok;
2527}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define GDIP_GET_NEW_CONTID_FOR(pGpGraphics)
Definition: graphics.c:59
GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
Definition: region.c:390
@ SmoothingModeDefault
Definition: gdiplusenums.h:123
@ CompositingModeSourceOver
Definition: gdiplusenums.h:249
@ PixelOffsetModeDefault
Definition: gdiplusenums.h:162
@ CompositingQualityDefault
Definition: gdiplusenums.h:133
@ InterpolationModeBilinear
Definition: gdiplusenums.h:146
GLeglImageOES image
Definition: gl.h:2204
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by GdipGetImageGraphicsContext(), and METAFILE_GetGraphicsContext().

◆ hresult_to_status()

◆ image_lock()

static BOOL image_lock ( GpImage image,
BOOL unlock 
)
inlinestatic

Definition at line 592 of file gdiplus_private.h.

593{
594 LONG tid = GetCurrentThreadId(), owner_tid;
595 owner_tid = InterlockedCompareExchange(&image->busy, tid, 0);
596 *unlock = !owner_tid;
597 return !owner_tid || owner_tid==tid;
598}
#define InterlockedCompareExchange
Definition: interlocked.h:104
static TfClientId tid
long LONG
Definition: pedump.c:60
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459

Referenced by GdipBitmapLockBits(), GdipBitmapUnlockBits(), GdipCreateHBITMAPFromBitmap(), GdipImageRotateFlip(), and GdipImageSelectActiveFrame().

◆ image_unlock()

static void image_unlock ( GpImage image,
BOOL  unlock 
)
inlinestatic

Definition at line 600 of file gdiplus_private.h.

601{
602 if (unlock) image->busy = 0;
603}

Referenced by GdipBitmapLockBits(), GdipBitmapUnlockBits(), GdipCreateHBITMAPFromBitmap(), GdipImageRotateFlip(), and GdipImageSelectActiveFrame().

◆ init_generic_string_formats()

◆ init_memory_buffer()

static void init_memory_buffer ( struct memory_buffer mbuf,
const BYTE buffer,
INT  size 
)
inlinestatic

Definition at line 561 of file gdiplus_private.h.

562{
563 mbuf->buffer = buffer;
564 mbuf->size = size;
565 mbuf->pos = 0;
566}
GLuint buffer
Definition: glext.h:5915

Referenced by GdipCreateRegionRgnData(), and metafile_deserialize_region().

◆ lengthen_path()

BOOL lengthen_path ( GpPath path,
INT  len 
)

Definition at line 405 of file gdiplus.c.

406{
407 /* initial allocation */
408 if(path->datalen == 0){
409 path->datalen = len * 2;
410
411 path->pathdata.Points = heap_alloc_zero(path->datalen * sizeof(PointF));
412 if(!path->pathdata.Points) return FALSE;
413
414 path->pathdata.Types = heap_alloc_zero(path->datalen);
415 if(!path->pathdata.Types){
416 heap_free(path->pathdata.Points);
417 return FALSE;
418 }
419 }
420 /* reallocation, double size of arrays */
421 else if(path->datalen - path->pathdata.Count < len){
422 while(path->datalen - path->pathdata.Count < len)
423 path->datalen *= 2;
424
425 path->pathdata.Points = heap_realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
426 if(!path->pathdata.Points) return FALSE;
427
428 path->pathdata.Types = heap_realloc(path->pathdata.Types, path->datalen);
429 if(!path->pathdata.Types) return FALSE;
430 }
431
432 return TRUE;
433}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
GLenum GLsizei len
Definition: glext.h:6722

Referenced by format_string_callback(), GdipAddPathArc(), GdipAddPathBezier(), GdipAddPathBeziers(), GdipAddPathEllipse(), GdipAddPathLine(), GdipAddPathLine2(), GdipAddPathPath(), GdipAddPathPie(), GdipAddPathPolygon(), GdipFlattenPath(), GdipPathIterNextMarkerPath(), GdipPathIterNextSubpathPath(), GdipWidenPath(), and read_element().

◆ METAFILE_AddSimpleProperty()

GpStatus METAFILE_AddSimpleProperty ( GpMetafile metafile,
SHORT  prop,
SHORT  val 
)

Definition at line 4269 of file metafile.c.

4270{
4272 GpStatus stat;
4273
4274 if (metafile->metafile_type != MetafileTypeEmfPlusOnly && metafile->metafile_type != MetafileTypeEmfPlusDual)
4275 return Ok;
4276
4277 stat = METAFILE_AllocateRecord(metafile, sizeof(*record), (void**)&record);
4278 if (stat != Ok) return stat;
4279
4280 record->Type = prop;
4281 record->Flags = val;
4282
4284 return Ok;
4285}
static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void **result)
Definition: metafile.c:618
static void METAFILE_WriteRecords(GpMetafile *metafile)
Definition: metafile.c:670
@ MetafileTypeEmfPlusOnly
Definition: gdiplusenums.h:220
@ MetafileTypeEmfPlusDual
Definition: gdiplusenums.h:221
GLuint GLfloat * val
Definition: glext.h:7180
static const unsigned char metafile[]
Definition: olepicture.c:138

Referenced by GdipSetCompositingMode(), GdipSetCompositingQuality(), GdipSetInterpolationMode(), GdipSetPixelOffsetMode(), GdipSetSmoothingMode(), and GdipSetTextRenderingHint().

◆ METAFILE_BeginContainer()

GpStatus METAFILE_BeginContainer ( GpMetafile metafile,
GDIPCONST GpRectF dstrect,
GDIPCONST GpRectF srcrect,
GpUnit  unit,
DWORD  StackIndex 
)

Definition at line 1376 of file metafile.c.

1378{
1379 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1380 {
1382 GpStatus stat;
1383
1384 stat = METAFILE_AllocateRecord(metafile, sizeof(*record), (void**)&record);
1385 if (stat != Ok)
1386 return stat;
1387
1389 record->Header.Flags = unit & 0xff;
1390 record->DestRect = *dstrect;
1391 record->SrcRect = *srcrect;
1392 record->StackIndex = StackIndex;
1393
1395 }
1396
1397 return Ok;
1398}
@ EmfPlusRecordTypeBeginContainer
Definition: gdiplusenums.h:698
png_const_structrp png_const_inforp int * unit
Definition: png.h:2159

Referenced by GdipBeginContainer().

◆ METAFILE_BeginContainerNoParams()

GpStatus METAFILE_BeginContainerNoParams ( GpMetafile metafile,
DWORD  StackIndex 
)

Definition at line 1400 of file metafile.c.

1401{
1402 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1403 {
1405 GpStatus stat;
1406
1408 sizeof(EmfPlusContainerRecord),
1409 (void**)&record);
1410 if (stat != Ok)
1411 return stat;
1412
1414 record->Header.Flags = 0;
1415 record->StackIndex = StackIndex;
1416
1418 }
1419
1420 return Ok;
1421}
@ EmfPlusRecordTypeBeginContainerNoParams
Definition: gdiplusenums.h:699

Referenced by begin_container().

◆ METAFILE_DrawImagePointsRect()

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 
)

Definition at line 4190 of file metafile.c.

4194{
4195 EmfPlusDrawImagePoints *draw_image_record;
4196 DWORD image_id, attributes_id;
4197 GpStatus stat;
4198
4199 if (count != 3) return InvalidParameter;
4200
4201 if (metafile->metafile_type == MetafileTypeEmf)
4202 {
4203 FIXME("MetafileTypeEmf metafiles not supported\n");
4204 return NotImplemented;
4205 }
4206 else
4207 FIXME("semi-stub\n");
4208
4209 if (!imageAttributes)
4210 {
4212 }
4213 else if (image->type == ImageTypeBitmap)
4214 {
4215 INT width = ((GpBitmap*)image)->width;
4216 INT height = ((GpBitmap*)image)->height;
4217 GpGraphics *graphics;
4219
4222 if (stat != Ok) return stat;
4223
4225 if (stat != Ok)
4226 {
4228 return stat;
4229 }
4230
4231 stat = GdipDrawImageRectRectI(graphics, image, 0, 0, width, height,
4232 0, 0, width, height, UnitPixel, imageAttributes, NULL, NULL);
4233 GdipDeleteGraphics(graphics);
4234 if (stat != Ok)
4235 {
4237 return stat;
4238 }
4239
4242 }
4243 else
4244 {
4245 FIXME("imageAttributes not supported (image type %d)\n", image->type);
4246 return NotImplemented;
4247 }
4248 if (stat != Ok) return stat;
4249
4250 stat = METAFILE_AddImageAttributesObject(metafile, imageAttributes, &attributes_id);
4251 if (stat != Ok) return stat;
4252
4253 stat = METAFILE_AllocateRecord(metafile, sizeof(EmfPlusDrawImagePoints), (void**)&draw_image_record);
4254 if (stat != Ok) return stat;
4255 draw_image_record->Header.Type = EmfPlusRecordTypeDrawImagePoints;
4256 draw_image_record->Header.Flags = image_id;
4257 draw_image_record->ImageAttributesID = attributes_id;
4258 draw_image_record->SrcUnit = UnitPixel;
4259 draw_image_record->SrcRect.X = units_to_pixels(srcx, srcUnit, metafile->image.xres);
4260 draw_image_record->SrcRect.Y = units_to_pixels(srcy, srcUnit, metafile->image.yres);
4261 draw_image_record->SrcRect.Width = units_to_pixels(srcwidth, srcUnit, metafile->image.xres);
4262 draw_image_record->SrcRect.Height = units_to_pixels(srcheight, srcUnit, metafile->image.yres);
4263 draw_image_record->count = 3;
4264 memcpy(draw_image_record->PointData.pointsF, points, 3 * sizeof(*points));
4266 return Ok;
4267}
#define FIXME(fmt,...)
Definition: debug.h:111
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
GpStatus WINGDIPAPI GdipDrawImageRectRectI(GpGraphics *graphics, GpImage *image, INT dstx, INT dsty, INT dstwidth, INT dstheight, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, VOID *callbackData)
Definition: graphics.c:3517
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2249
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2155
static GpStatus METAFILE_AddImageObject(GpMetafile *metafile, GpImage *image, DWORD *id)
Definition: metafile.c:4080
static GpStatus METAFILE_AddImageAttributesObject(GpMetafile *metafile, const GpImageAttributes *attrs, DWORD *id)
Definition: metafile.c:4158
unsigned long DWORD
Definition: ntddk_ex.h:95
@ ImageTypeBitmap
Definition: gdiplusenums.h:195
@ EmfPlusRecordTypeDrawImagePoints
Definition: gdiplusenums.h:686
@ MetafileTypeEmf
Definition: gdiplusenums.h:219
EmfPlusRectF SrcRect
Definition: metafile.c:432
union EmfPlusDrawImagePoints::@422 PointData
EmfPlusPointF pointsF[3]
Definition: metafile.c:438
EmfPlusRecordHeader Header
Definition: metafile.c:429
float Width
Definition: metafile.c:263
float Height
Definition: metafile.c:264
Definition: uimain.c:89

Referenced by GdipDrawImagePointsRect().

◆ METAFILE_DrawPath()

GpStatus METAFILE_DrawPath ( GpMetafile metafile,
GpPen pen,
GpPath path 
)

Definition at line 4476 of file metafile.c.

4477{
4478 EmfPlusDrawPath *draw_path_record;
4479 DWORD path_id;
4480 DWORD pen_id;
4481 GpStatus stat;
4482
4483 if (metafile->metafile_type == MetafileTypeEmf)
4484 {
4485 FIXME("stub!\n");
4486 return NotImplemented;
4487 }
4488
4489 stat = METAFILE_AddPenObject(metafile, pen, &pen_id);
4490 if (stat != Ok) return stat;
4491
4493 if (stat != Ok) return stat;
4494
4495 stat = METAFILE_AllocateRecord(metafile, sizeof(EmfPlusDrawPath), (void**)&draw_path_record);
4496 if (stat != Ok) return stat;
4497 draw_path_record->Header.Type = EmfPlusRecordTypeDrawPath;
4498 draw_path_record->Header.Flags = path_id;
4499 draw_path_record->PenId = pen_id;
4500
4502 return Ok;
4503}
static GpStatus METAFILE_AddPenObject(GpMetafile *metafile, GpPen *pen, DWORD *id)
Definition: metafile.c:4310
static GpStatus METAFILE_AddPathObject(GpMetafile *metafile, GpPath *path, DWORD *id)
Definition: metafile.c:4287
@ EmfPlusRecordTypeDrawPath
Definition: gdiplusenums.h:680
EmfPlusRecordHeader Header
Definition: metafile.c:444

Referenced by GdipDrawPath().

◆ METAFILE_EndContainer()

GpStatus METAFILE_EndContainer ( GpMetafile metafile,
DWORD  StackIndex 
)

Definition at line 1423 of file metafile.c.

1424{
1425 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1426 {
1428 GpStatus stat;
1429
1431 sizeof(EmfPlusContainerRecord),
1432 (void**)&record);
1433 if (stat != Ok)
1434 return stat;
1435
1437 record->Header.Flags = 0;
1438 record->StackIndex = StackIndex;
1439
1441 }
1442
1443 return Ok;
1444}
@ EmfPlusRecordTypeEndContainer
Definition: gdiplusenums.h:700

Referenced by end_container().

◆ METAFILE_FillPath()

GpStatus METAFILE_FillPath ( GpMetafile metafile,
GpBrush brush,
GpPath path 
)

Definition at line 4505 of file metafile.c.

4506{
4507 EmfPlusFillPath *fill_path_record;
4508 DWORD brush_id = -1, path_id;
4509 BOOL inline_color;
4510 GpStatus stat;
4511
4512 if (metafile->metafile_type == MetafileTypeEmf)
4513 {
4514 FIXME("stub!\n");
4515 return NotImplemented;
4516 }
4517
4518 inline_color = brush->bt == BrushTypeSolidColor;
4519 if (!inline_color)
4520 {
4521 stat = METAFILE_AddBrushObject(metafile, brush, &brush_id);
4522 if (stat != Ok) return stat;
4523 }
4524
4526 if (stat != Ok) return stat;
4527
4529 sizeof(EmfPlusFillPath), (void**)&fill_path_record);
4530 if (stat != Ok) return stat;
4531 fill_path_record->Header.Type = EmfPlusRecordTypeFillPath;
4532 if (inline_color)
4533 {
4534 fill_path_record->Header.Flags = 0x8000 | path_id;
4535 fill_path_record->data.Color = ((GpSolidFill *)brush)->color;
4536 }
4537 else
4538 {
4539 fill_path_record->Header.Flags = path_id;
4540 fill_path_record->data.BrushId = brush_id;
4541 }
4542
4544 return Ok;
4545}
static GpStatus METAFILE_AddBrushObject(GpMetafile *metafile, GpBrush *brush, DWORD *id)
Definition: metafile.c:1027
@ EmfPlusRecordTypeFillPath
Definition: gdiplusenums.h:679
@ BrushTypeSolidColor
Definition: gdiplusenums.h:38
EmfPlusRecordHeader Header
Definition: metafile.c:495
EmfPlusARGB Color
Definition: metafile.c:499
union EmfPlusFillPath::@427 data
GpBrushType bt

Referenced by GdipFillPath().

◆ METAFILE_FillRectangles()

GpStatus METAFILE_FillRectangles ( GpMetafile metafile,
GpBrush brush,
GDIPCONST GpRectF rects,
INT  count 
)

Definition at line 1051 of file metafile.c.

1053{
1054 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1055 {
1057 GpStatus stat;
1058 BOOL integer_rects = TRUE;
1059 int i;
1060 DWORD brushid;
1061 int flags = 0;
1062
1063 if (brush->bt == BrushTypeSolidColor)
1064 {
1065 flags |= 0x8000;
1066 brushid = ((GpSolidFill*)brush)->color;
1067 }
1068 else
1069 {
1070 stat = METAFILE_AddBrushObject(metafile, brush, &brushid);
1071 if (stat != Ok)
1072 return stat;
1073 }
1074
1075 for (i=0; i<count; i++)
1076 {
1077 if (!is_integer_rect(&rects[i]))
1078 {
1079 integer_rects = FALSE;
1080 break;
1081 }
1082 }
1083
1084 if (integer_rects)
1085 flags |= 0x4000;
1086
1088 sizeof(EmfPlusFillRects) + count * (integer_rects ? sizeof(EmfPlusRect) : sizeof(GpRectF)),
1089 (void**)&record);
1090 if (stat != Ok)
1091 return stat;
1092
1093 record->Header.Type = EmfPlusRecordTypeFillRects;
1094 record->Header.Flags = flags;
1095 record->BrushID = brushid;
1096 record->Count = count;
1097
1098 if (integer_rects)
1099 {
1100 EmfPlusRect *record_rects = (EmfPlusRect*)(record+1);
1101 for (i=0; i<count; i++)
1102 {
1103 record_rects[i].X = (SHORT)rects[i].X;
1104 record_rects[i].Y = (SHORT)rects[i].Y;
1105 record_rects[i].Width = (SHORT)rects[i].Width;
1106 record_rects[i].Height = (SHORT)rects[i].Height;
1107 }
1108 }
1109 else
1110 memcpy(record+1, rects, sizeof(GpRectF) * count);
1111
1113 }
1114
1115 if (metafile->auto_frame)
1116 {
1117 GpPointF corners[4];
1118 int i;
1119
1120 for (i=0; i<count; i++)
1121 {
1122 corners[0].X = rects[i].X;
1123 corners[0].Y = rects[i].Y;
1124 corners[1].X = rects[i].X + rects[i].Width;
1125 corners[1].Y = rects[i].Y;
1126 corners[2].X = rects[i].X;
1127 corners[2].Y = rects[i].Y + rects[i].Height;
1128 corners[3].X = rects[i].X + rects[i].Width;
1129 corners[3].Y = rects[i].Y + rects[i].Height;
1130
1132 CoordinateSpaceWorld, corners, 4);
1133
1134 METAFILE_AdjustFrame(metafile, corners, 4);
1135 }
1136 }
1137
1138 return Ok;
1139}
#define Y(I)
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6960
static BOOL is_integer_rect(const GpRectF *rect)
Definition: metafile.c:970
static void METAFILE_AdjustFrame(GpMetafile *metafile, const GpPointF *points, UINT num_points)
Definition: metafile.c:884
@ EmfPlusRecordTypeFillRects
Definition: gdiplusenums.h:669
GLbitfield flags
Definition: glext.h:7161
short SHORT
Definition: pedump.c:59
SHORT Y
Definition: metafile.c:95
SHORT X
Definition: metafile.c:94
SHORT Height
Definition: metafile.c:97
SHORT Width
Definition: metafile.c:96
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88

Referenced by GdipFillRectangles().

◆ METAFILE_Free()

void METAFILE_Free ( GpMetafile metafile)

Definition at line 590 of file metafile.c.

591{
592 unsigned int i;
593
594 heap_free(metafile->comment_data);
596 if (!metafile->preserve_hemf)
598 if (metafile->record_graphics)
599 {
600 WARN("metafile closed while recording\n");
601 /* not sure what to do here; for now just prevent the graphics from functioning or using this object */
602 metafile->record_graphics->image = NULL;
603 metafile->record_graphics->busy = TRUE;
604 }
605
606 if (metafile->record_stream)
607 IStream_Release(metafile->record_stream);
608
609 for (i = 0; i < ARRAY_SIZE(metafile->objtable); i++)
611}
#define WARN(fmt,...)
Definition: debug.h:112
static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id)
Definition: metafile.c:552
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)

Referenced by free_image_data().

◆ METAFILE_GetDC()

GpStatus METAFILE_GetDC ( GpMetafile metafile,
HDC hdc 
)

Definition at line 927 of file metafile.c.

928{
929 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
930 {
933
935 if (stat != Ok)
936 return stat;
937
939 record->Flags = 0;
940
942 }
943
944 *hdc = metafile->record_dc;
945
946 return Ok;
947}
@ EmfPlusRecordTypeGetDC
Definition: gdiplusenums.h:663

Referenced by GdipGetDC().

◆ METAFILE_GetGraphicsContext()

GpStatus METAFILE_GetGraphicsContext ( GpMetafile metafile,
GpGraphics **  result 
)

Definition at line 908 of file metafile.c.

909{
911
912 if (!metafile->record_dc || metafile->record_graphics)
913 return InvalidParameter;
914
915 stat = graphics_from_image((GpImage*)metafile, &metafile->record_graphics);
916
917 if (stat == Ok)
918 {
919 *result = metafile->record_graphics;
920 metafile->record_graphics->xres = 96.0;
921 metafile->record_graphics->yres = 96.0;
922 }
923
924 return stat;
925}
GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics) DECLSPEC_HIDDEN
Definition: graphics.c:2484

Referenced by GdipGetImageGraphicsContext().

◆ METAFILE_GraphicsClear()

GpStatus METAFILE_GraphicsClear ( GpMetafile metafile,
ARGB  color 
)

Definition at line 949 of file metafile.c.

950{
951 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
952 {
955
957 if (stat != Ok)
958 return stat;
959
960 record->Header.Type = EmfPlusRecordTypeClear;
961 record->Header.Flags = 0;
962 record->Color = color;
963
965 }
966
967 return Ok;
968}
@ EmfPlusRecordTypeClear
Definition: gdiplusenums.h:668

Referenced by GdipGraphicsClear().

◆ METAFILE_GraphicsDeleted()

GpStatus METAFILE_GraphicsDeleted ( GpMetafile metafile)

Definition at line 1500 of file metafile.c.

1501{
1502 GpStatus stat;
1503
1505 metafile->record_graphics = NULL;
1506
1507 metafile->hemf = CloseEnhMetaFile(metafile->record_dc);
1508 metafile->record_dc = NULL;
1509
1510 heap_free(metafile->comment_data);
1511 metafile->comment_data = NULL;
1512 metafile->comment_data_size = 0;
1513
1514 if (stat == Ok)
1515 {
1517
1519 if (stat == Ok && metafile->auto_frame &&
1520 metafile->auto_frame_max.X >= metafile->auto_frame_min.X)
1521 {
1522 RECTL bounds_rc, gdi_bounds_rc;
1523 REAL x_scale = 2540.0 / header.DpiX;
1524 REAL y_scale = 2540.0 / header.DpiY;
1525 BYTE* buffer;
1527
1528 bounds_rc.left = floorf(metafile->auto_frame_min.X * x_scale);
1529 bounds_rc.top = floorf(metafile->auto_frame_min.Y * y_scale);
1530 bounds_rc.right = ceilf(metafile->auto_frame_max.X * x_scale);
1531 bounds_rc.bottom = ceilf(metafile->auto_frame_max.Y * y_scale);
1532
1533 gdi_bounds_rc = header.u.EmfHeader.rclBounds;
1534 if (gdi_bounds_rc.right > gdi_bounds_rc.left && gdi_bounds_rc.bottom > gdi_bounds_rc.top)
1535 {
1536 bounds_rc.left = min(bounds_rc.left, gdi_bounds_rc.left);
1537 bounds_rc.top = min(bounds_rc.top, gdi_bounds_rc.top);
1538 bounds_rc.right = max(bounds_rc.right, gdi_bounds_rc.right);
1539 bounds_rc.bottom = max(bounds_rc.bottom, gdi_bounds_rc.bottom);
1540 }
1541
1544 if (buffer)
1545 {
1546 HENHMETAFILE new_hemf;
1547
1549
1550 ((ENHMETAHEADER*)buffer)->rclFrame = bounds_rc;
1551
1553
1554 if (new_hemf)
1555 {
1557 metafile->hemf = new_hemf;
1558 }
1559 else
1560 stat = OutOfMemory;
1561
1563 }
1564 else
1565 stat = OutOfMemory;
1566
1567 if (stat == Ok)
1569 }
1570 if (stat == Ok)
1571 {
1572 metafile->bounds.X = header.X;
1573 metafile->bounds.Y = header.Y;
1574 metafile->bounds.Width = header.Width;
1575 metafile->bounds.Height = header.Height;
1576 }
1577 }
1578
1579 if (stat == Ok && metafile->record_stream)
1580 {
1581 BYTE *buffer;
1583
1585
1587 if (buffer)
1588 {
1589 HRESULT hr;
1590
1592
1593 hr = IStream_Write(metafile->record_stream, buffer, buffer_size, NULL);
1594
1595 if (FAILED(hr))
1597
1599 }
1600 else
1601 stat = OutOfMemory;
1602 }
1603
1604 if (metafile->record_stream)
1605 {
1606 IStream_Release(metafile->record_stream);
1607 metafile->record_stream = NULL;
1608 }
1609
1610 return stat;
1611}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static GpStatus METAFILE_WriteEndOfFile(GpMetafile *metafile)
Definition: metafile.c:714
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hemf, MetafileHeader *header)
Definition: metafile.c:3688
GpStatus hresult_to_status(HRESULT res)
Definition: gdiplus.c:312
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
HENHMETAFILE WINAPI SetEnhMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *pb)

Referenced by GdipDeleteGraphics().

◆ METAFILE_MultiplyWorldTransform()

GpStatus METAFILE_MultiplyWorldTransform ( GpMetafile metafile,
GDIPCONST GpMatrix matrix,
MatrixOrder  order 
)

Definition at line 1284 of file metafile.c.

1285{
1286 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1287 {
1289 GpStatus stat;
1290
1293 (void**)&record);
1294 if (stat != Ok)
1295 return stat;
1296
1298 record->Header.Flags = (order == MatrixOrderAppend ? 0x2000 : 0);
1299 memcpy(record->MatrixData, matrix->matrix, sizeof(record->MatrixData));
1300
1302 }
1303
1304 return Ok;
1305}
@ EmfPlusRecordTypeMultiplyWorldTransform
Definition: gdiplusenums.h:703
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194

Referenced by GdipMultiplyWorldTransform().

◆ METAFILE_ReleaseDC()

GpStatus METAFILE_ReleaseDC ( GpMetafile metafile,
HDC  hdc 
)

Definition at line 1492 of file metafile.c.

1493{
1494 if (hdc != metafile->record_dc)
1495 return InvalidParameter;
1496
1497 return Ok;
1498}

Referenced by GdipReleaseDC().

◆ METAFILE_ResetWorldTransform()

GpStatus METAFILE_ResetWorldTransform ( GpMetafile metafile)

Definition at line 1354 of file metafile.c.

1355{
1356 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1357 {
1359 GpStatus stat;
1360
1362 sizeof(EmfPlusRecordHeader),
1363 (void**)&record);
1364 if (stat != Ok)
1365 return stat;
1366
1368 record->Flags = 0;
1369
1371 }
1372
1373 return Ok;
1374}
@ EmfPlusRecordTypeResetWorldTransform
Definition: gdiplusenums.h:702

Referenced by GdipResetWorldTransform().

◆ METAFILE_RestoreGraphics()

GpStatus METAFILE_RestoreGraphics ( GpMetafile metafile,
DWORD  StackIndex 
)

Definition at line 1469 of file metafile.c.

1470{
1471 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1472 {
1474 GpStatus stat;
1475
1477 sizeof(EmfPlusContainerRecord),
1478 (void**)&record);
1479 if (stat != Ok)
1480 return stat;
1481
1482 record->Header.Type = EmfPlusRecordTypeRestore;
1483 record->Header.Flags = 0;
1484 record->StackIndex = StackIndex;
1485
1487 }
1488
1489 return Ok;
1490}
@ EmfPlusRecordTypeRestore
Definition: gdiplusenums.h:697

Referenced by end_container().

◆ METAFILE_RotateWorldTransform()

GpStatus METAFILE_RotateWorldTransform ( GpMetafile metafile,
REAL  angle,
MatrixOrder  order 
)

Definition at line 1307 of file metafile.c.

1308{
1309 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1310 {
1312 GpStatus stat;
1313
1316 (void**)&record);
1317 if (stat != Ok)
1318 return stat;
1319
1321 record->Header.Flags = (order == MatrixOrderAppend ? 0x2000 : 0);
1322 record->Angle = angle;
1323
1325 }
1326
1327 return Ok;
1328}
@ EmfPlusRecordTypeRotateWorldTransform
Definition: gdiplusenums.h:706
GLfloat angle
Definition: glext.h:10853

Referenced by GdipRotateWorldTransform().

◆ METAFILE_SaveGraphics()

GpStatus METAFILE_SaveGraphics ( GpMetafile metafile,
DWORD  StackIndex 
)

Definition at line 1446 of file metafile.c.

1447{
1448 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1449 {
1451 GpStatus stat;
1452
1454 sizeof(EmfPlusContainerRecord),
1455 (void**)&record);
1456 if (stat != Ok)
1457 return stat;
1458
1459 record->Header.Type = EmfPlusRecordTypeSave;
1460 record->Header.Flags = 0;
1461 record->StackIndex = StackIndex;
1462
1464 }
1465
1466 return Ok;
1467}
@ EmfPlusRecordTypeSave
Definition: gdiplusenums.h:696

Referenced by begin_container().

◆ METAFILE_ScaleWorldTransform()

GpStatus METAFILE_ScaleWorldTransform ( GpMetafile metafile,
REAL  sx,
REAL  sy,
MatrixOrder  order 
)

Definition at line 1260 of file metafile.c.

1261{
1262 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1263 {
1265 GpStatus stat;
1266
1269 (void**)&record);
1270 if (stat != Ok)
1271 return stat;
1272
1274 record->Header.Flags = (order == MatrixOrderAppend ? 0x2000 : 0);
1275 record->Sx = sx;
1276 record->Sy = sy;
1277
1279 }
1280
1281 return Ok;
1282}
@ EmfPlusRecordTypeScaleWorldTransform
Definition: gdiplusenums.h:705

Referenced by GdipScaleWorldTransform().

◆ METAFILE_SetClipRect()

GpStatus METAFILE_SetClipRect ( GpMetafile metafile,
REAL  x,
REAL  y,
REAL  width,
REAL  height,
CombineMode  mode 
)

Definition at line 1141 of file metafile.c.

1142{
1143 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1144 {
1146 GpStatus stat;
1147
1149 sizeof(EmfPlusSetClipRect),
1150 (void**)&record);
1151 if (stat != Ok)
1152 return stat;
1153
1154 record->Header.Type = EmfPlusRecordTypeSetClipRect;
1155 record->Header.Flags = (mode & 0xf) << 8;
1156 record->ClipRect.X = x;
1157 record->ClipRect.Y = y;
1158 record->ClipRect.Width = width;
1159 record->ClipRect.Height = height;
1160
1162 }
1163
1164 return Ok;
1165}
@ EmfPlusRecordTypeSetClipRect
Definition: gdiplusenums.h:709
GLenum mode
Definition: glext.h:6217

Referenced by GdipSetClipRect().

◆ METAFILE_SetClipRegion()

GpStatus METAFILE_SetClipRegion ( GpMetafile metafile,
GpRegion region,
CombineMode  mode 
)

Definition at line 1189 of file metafile.c.

1190{
1192 DWORD region_id;
1193 GpStatus stat;
1194
1195 if (metafile->metafile_type == MetafileTypeEmf)
1196 {
1197 FIXME("stub!\n");
1198 return NotImplemented;
1199 }
1200
1201 stat = METAFILE_AddRegionObject(metafile, region, &region_id);
1202 if (stat != Ok) return stat;
1203
1204 stat = METAFILE_AllocateRecord(metafile, sizeof(*record), (void**)&record);
1205 if (stat != Ok) return stat;
1206
1208 record->Flags = region_id | mode << 8;
1209
1211 return Ok;
1212}
static GpStatus METAFILE_AddRegionObject(GpMetafile *metafile, GpRegion *region, DWORD *id)
Definition: metafile.c:1167
@ EmfPlusRecordTypeSetClipRegion
Definition: gdiplusenums.h:711

Referenced by GdipSetClipRegion().

◆ METAFILE_SetPageTransform()

GpStatus METAFILE_SetPageTransform ( GpMetafile metafile,
GpUnit  unit,
REAL  scale 
)

Definition at line 1214 of file metafile.c.

1215{
1216 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1217 {
1219 GpStatus stat;
1220
1223 (void**)&record);
1224 if (stat != Ok)
1225 return stat;
1226
1228 record->Header.Flags = unit;
1229 record->PageScale = scale;
1230
1232 }
1233
1234 return Ok;
1235}
@ EmfPlusRecordTypeSetPageTransform
Definition: gdiplusenums.h:707
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032

Referenced by GdipSetPageScale(), and GdipSetPageUnit().

◆ METAFILE_SetWorldTransform()

GpStatus METAFILE_SetWorldTransform ( GpMetafile metafile,
GDIPCONST GpMatrix transform 
)

Definition at line 1237 of file metafile.c.

1238{
1239 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1240 {
1242 GpStatus stat;
1243
1246 (void**)&record);
1247 if (stat != Ok)
1248 return stat;
1249
1251 record->Header.Flags = 0;
1252 memcpy(record->MatrixData, transform->matrix, sizeof(record->MatrixData));
1253
1255 }
1256
1257 return Ok;
1258}
@ EmfPlusRecordTypeSetWorldTransform
Definition: gdiplusenums.h:701
GLuint GLenum GLenum transform
Definition: glext.h:9407

Referenced by GdipSetWorldTransform().

◆ METAFILE_TranslateWorldTransform()

GpStatus METAFILE_TranslateWorldTransform ( GpMetafile metafile,
REAL  dx,
REAL  dy,
MatrixOrder  order 
)

Definition at line 1330 of file metafile.c.

1331{
1332 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1333 {
1335 GpStatus stat;
1336
1339 (void**)&record);
1340 if (stat != Ok)
1341 return stat;
1342
1344 record->Header.Flags = (order == MatrixOrderAppend ? 0x2000 : 0);
1345 record->dx = dx;
1346 record->dy = dy;
1347
1349 }
1350
1351 return Ok;
1352}
@ EmfPlusRecordTypeTranslateWorldTransform
Definition: gdiplusenums.h:704

Referenced by GdipTranslateWorldTransform().

◆ pixels_to_units()

REAL pixels_to_units ( REAL  pixels,
GpUnit  unit,
REAL  dpi 
)

Definition at line 350 of file gdiplus.c.

351{
352 switch (unit)
353 {
354 case UnitPixel:
355 case UnitWorld:
356 case UnitDisplay:
357 return pixels;
358 case UnitPoint:
359 return pixels * point_per_inch / dpi;
360 case UnitInch:
361 return pixels / dpi;
362 case UnitDocument:
363 return pixels * 300.0 / dpi;
364 case UnitMillimeter:
365 return pixels * mm_per_inch / dpi;
366 default:
367 FIXME("Unhandled unit type: %d\n", unit);
368 return 0;
369 }
370}
static const REAL mm_per_inch
Definition: gdiplus.c:38
static const REAL point_per_inch
Definition: gdiplus.c:39
@ UnitDocument
Definition: gdiplusenums.h:32
@ UnitInch
Definition: gdiplusenums.h:31
@ UnitMillimeter
Definition: gdiplusenums.h:33
@ UnitWorld
Definition: gdiplusenums.h:27
@ UnitPoint
Definition: gdiplusenums.h:30
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
#define dpi
Definition: sysparams.c:23

Referenced by GdipGetFontHeight(), and units_scale().

◆ trace_path()

GpStatus trace_path ( GpGraphics graphics,
GpPath path 
)

Definition at line 2087 of file graphics.c.

2088{
2090
2091 BeginPath(graphics->hdc);
2092 result = draw_poly(graphics, NULL, path->pathdata.Points,
2093 path->pathdata.Types, path->pathdata.Count, FALSE);
2094 EndPath(graphics->hdc);
2095 return result;
2096}
static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *pt, GDIPCONST BYTE *types, INT count, BOOL caps)
Definition: graphics.c:1960
BOOL WINAPI EndPath(_In_ HDC)
BOOL WINAPI BeginPath(_In_ HDC hdc)

Referenced by get_path_hrgn().

◆ units_scale()

REAL units_scale ( GpUnit  from,
GpUnit  to,
REAL  dpi 
)

Definition at line 372 of file gdiplus.c.

373{
375 return pixels_to_units(pixels, to, dpi);
376}
REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi)
Definition: gdiplus.c:350
CardRegion * from
Definition: spigame.cpp:19

Referenced by GdipDrawImagePointRect(), GdipDrawString(), GdipMeasureCharacterRanges(), GdipMeasureString(), get_font_hfont(), and test_GdipMeasureString().

◆ units_to_pixels()

REAL units_to_pixels ( REAL  units,
GpUnit  unit,
REAL  dpi 
)

◆ write_path_data()

DWORD write_path_data ( GpPath path,
void data 
)

Definition at line 2491 of file graphicspath.c.

2492{
2493 struct path_header *header = data;
2494 BOOL integer_path = is_integer_path(path);
2495 DWORD i, size;
2496 BYTE *types;
2497
2498 size = sizeof(struct path_header) + path->pathdata.Count;
2499 if (integer_path)
2500 size += sizeof(short[2]) * path->pathdata.Count;
2501 else
2502 size += sizeof(float[2]) * path->pathdata.Count;
2503 size = (size + 3) & ~3;
2504
2505 if (!data) return size;
2506
2507 header->version = VERSION_MAGIC2;
2508 header->count = path->pathdata.Count;
2509 header->flags = integer_path ? FLAGS_INTPATH : 0;
2510
2511 if (integer_path)
2512 {
2513 short *points = (short*)(header + 1);
2514 for (i = 0; i < path->pathdata.Count; i++)
2515 {
2516 points[2*i] = path->pathdata.Points[i].X;
2517 points[2*i + 1] = path->pathdata.Points[i].Y;
2518 }
2519 types = (BYTE*)(points + 2*i);
2520 }
2521 else
2522 {
2523 float *points = (float*)(header + 1);
2524 for (i = 0; i < path->pathdata.Count; i++)
2525 {
2526 points[2*i] = path->pathdata.Points[i].X;
2527 points[2*i + 1] = path->pathdata.Points[i].Y;
2528 }
2529 types = (BYTE*)(points + 2*i);
2530 }
2531
2532 for (i=0; i<path->pathdata.Count; i++)
2533 types[i] = path->pathdata.Types[i];
2534 memset(types + i, 0, ((path->pathdata.Count + 3) & ~3) - path->pathdata.Count);
2535 return size;
2536}
#define FLAGS_INTPATH
static BOOL is_integer_path(const GpPath *path)
#define VERSION_MAGIC2
int Count
Definition: noreturn.cpp:7
#define memset(x, y, z)
Definition: compat.h:39
Definition: cmds.c:130

Referenced by get_element_size(), METAFILE_AddPathObject(), and write_element().

◆ write_region_data()

DWORD write_region_data ( const GpRegion region,
void data 
)

Definition at line 696 of file region.c.

697{
698 struct region_header *header = data;
699 INT filled = 0;
700 DWORD size;
701
702 size = sizeof(struct region_header) + get_element_size(&region->node);
703 if (!data) return size;
704
705 header->magic = VERSION_MAGIC2;
706 header->num_children = region->num_children;
707 filled += 2;
708 /* With few exceptions, everything written is DWORD aligned,
709 * so use that as our base */
710 write_element(&region->node, (DWORD*)data, &filled);
711 return size;
712}
static void write_element(const region_element *element, DWORD *buffer, INT *filled)
Definition: region.c:662
static INT get_element_size(const region_element *element)
Definition: region.c:106
region_element node
DWORD num_children

Referenced by GdipGetRegionData(), GdipGetRegionDataSize(), and METAFILE_AddRegionObject().

Variable Documentation

◆ DECLSPEC_HIDDEN

Definition at line 289 of file d3dcompiler_private.h.