ReactOS 0.4.17-dev-923-g4c9a150
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/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  CGpEffect
 
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
 
struct  gdip_font_link_section
 
struct  gdip_font_link_info
 
struct  gdip_format_string_info
 

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 PIXELFORMATBPP(x)   ((x) ? ((x) >> 8) & 255 : 24)
 
#define WineCoordinateSpaceGdiDevice   ((GpCoordinateSpace)4)
 
#define EmfPlusObjectTableSize   64
 

Typedefs

typedef struct region_element region_element
 
typedef enum EffectType EffectType
 
typedef struct CGpEffect CGpEffect
 
typedef enum EmfPlusObjectType EmfPlusObjectType
 
typedef enum RegionType RegionType
 
typedef GpStatus(* gdip_format_string_callback) (struct gdip_format_string_info *info)
 

Enumerations

enum  EffectType {
  NoneEffect , BlurEffect , SharpenEffect , TintEffect ,
  RedEyeCorrectionEffect , ColorMatrixEffect , ColorLUTEffect , BrightnessContrastEffect ,
  HueSaturationLightnessEffect , ColorBalanceEffect , LevelsEffect , ColorCurveEffect
}
 
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)
 
HBITMAP ARGB2BMP (ARGB color)
 
INT arc2polybezier (GpPointF *points, REAL x1, REAL y1, REAL x2, REAL y2, REAL startAngle, REAL sweepAngle)
 
REAL gdiplus_atan2 (REAL dy, REAL dx)
 
GpStatus hresult_to_status (HRESULT res)
 
REAL units_to_pixels (REAL units, GpUnit unit, REAL dpi, BOOL printer_display)
 
REAL pixels_to_units (REAL pixels, GpUnit unit, REAL dpi, BOOL printer_display)
 
REAL units_scale (GpUnit from, GpUnit to, REAL dpi, BOOL printer_display)
 
GpStatus gdi_dc_acquire (GpGraphics *graphics, HDC *hdc)
 
void gdi_dc_release (GpGraphics *graphics, HDC hdc)
 
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)
 
GpStatus gdip_transform_points (GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
 
void transform_properties (GpGraphics *, GDIPCONST GpMatrix *, BOOL, REAL *, REAL *, REAL *)
 
GpStatus graphics_from_image (GpImage *image, GpGraphics **graphics)
 
GpStatus encode_image_png (GpImage *image, IStream *stream, GDIPCONST EncoderParameters *params)
 
GpStatus terminate_encoder_wic (GpImage *image)
 
GpStatus METAFILE_GetGraphicsContext (GpMetafile *metafile, GpGraphics **result)
 
GpStatus METAFILE_GetDC (GpMetafile *metafile, HDC *hdc)
 
GpStatus METAFILE_ReleaseDC (GpMetafile *metafile, HDC hdc)
 
GpStatus METAFILE_GraphicsClear (GpMetafile *metafile, ARGB color)
 
GpStatus METAFILE_FillRectangles (GpMetafile *metafile, GpBrush *brush, GDIPCONST GpRectF *rects, INT count)
 
GpStatus METAFILE_SetClipRect (GpMetafile *metafile, REAL x, REAL y, REAL width, REAL height, CombineMode mode)
 
GpStatus METAFILE_SetClipRegion (GpMetafile *metafile, GpRegion *region, CombineMode mode)
 
GpStatus METAFILE_SetPageTransform (GpMetafile *metafile, GpUnit unit, REAL scale)
 
GpStatus METAFILE_SetWorldTransform (GpMetafile *metafile, GDIPCONST GpMatrix *transform)
 
GpStatus METAFILE_ScaleWorldTransform (GpMetafile *metafile, REAL sx, REAL sy, MatrixOrder order)
 
GpStatus METAFILE_MultiplyWorldTransform (GpMetafile *metafile, GDIPCONST GpMatrix *matrix, MatrixOrder order)
 
GpStatus METAFILE_RotateWorldTransform (GpMetafile *metafile, REAL angle, MatrixOrder order)
 
GpStatus METAFILE_TranslateWorldTransform (GpMetafile *metafile, REAL dx, REAL dy, MatrixOrder order)
 
GpStatus METAFILE_ResetWorldTransform (GpMetafile *metafile)
 
GpStatus METAFILE_BeginContainer (GpMetafile *metafile, GDIPCONST GpRectF *dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, DWORD StackIndex)
 
GpStatus METAFILE_BeginContainerNoParams (GpMetafile *metafile, DWORD StackIndex)
 
GpStatus METAFILE_EndContainer (GpMetafile *metafile, DWORD StackIndex)
 
GpStatus METAFILE_SaveGraphics (GpMetafile *metafile, DWORD StackIndex)
 
GpStatus METAFILE_RestoreGraphics (GpMetafile *metafile, DWORD StackIndex)
 
GpStatus METAFILE_GraphicsDeleted (GpMetafile *metafile)
 
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)
 
GpStatus METAFILE_AddSimpleProperty (GpMetafile *metafile, SHORT prop, SHORT val)
 
GpStatus METAFILE_DrawPath (GpMetafile *metafile, GpPen *pen, GpPath *path)
 
GpStatus METAFILE_FillPath (GpMetafile *metafile, GpBrush *brush, GpPath *path)
 
GpStatus METAFILE_DrawDriverString (GpMetafile *metafile, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix)
 
GpStatus METAFILE_FillRegion (GpMetafile *metafile, GpBrush *brush, GpRegion *region)
 
void METAFILE_Free (GpMetafile *metafile)
 
GpStatus METAFILE_DrawEllipse (GpMetafile *metafile, GpPen *pen, GpRectF *rect)
 
GpStatus METAFILE_FillEllipse (GpMetafile *metafile, GpBrush *brush, GpRectF *rect)
 
GpStatus METAFILE_DrawRectangles (GpMetafile *metafile, GpPen *pen, const GpRectF *rects, INT count)
 
GpStatus METAFILE_FillPie (GpMetafile *metafile, GpBrush *brush, const GpRectF *rect, REAL startAngle, REAL sweepAngle)
 
GpStatus METAFILE_DrawArc (GpMetafile *metafile, GpPen *pen, const GpRectF *rect, REAL startAngle, REAL sweepAngle)
 
GpStatus METAFILE_OffsetClip (GpMetafile *metafile, REAL dx, REAL dy)
 
GpStatus METAFILE_ResetClip (GpMetafile *metafile)
 
GpStatus METAFILE_SetClipPath (GpMetafile *metafile, GpPath *path, CombineMode mode)
 
GpStatus METAFILE_SetRenderingOrigin (GpMetafile *metafile, INT x, INT y)
 
void calc_curve_bezier (const GpPointF *pts, REAL tension, REAL *x1, REAL *y1, REAL *x2, REAL *y2)
 
void calc_curve_bezier_endp (REAL xend, REAL yend, REAL xadj, REAL yadj, REAL tension, REAL *x, REAL *y)
 
void get_font_hfont (GpGraphics *graphics, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, HFONT *hfont, LOGFONTW *lfw_return, GDIPCONST GpMatrix *matrix)
 
void free_installed_fonts (void)
 
BOOL lengthen_path (GpPath *path, INT len)
 
GpStatus widen_flat_path_anchors (GpPath *flat_path, GpPen *pen, REAL pen_width, GpPath **anchors)
 
DWORD write_region_data (const GpRegion *region, void *data)
 
DWORD write_path_data (GpPath *path, void *data)
 
GpStatus trace_path (GpGraphics *graphics, GpPath *path)
 
void delete_element (region_element *element)
 
GpStatus get_hatch_data (GpHatchStyle hatchstyle, const unsigned char **result)
 
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 char * debugstr_rectf (const RectF *rc)
 
const char * debugstr_pointf (const PointF *pt)
 
const char * debugstr_matrix (const GpMatrix *matrix)
 
void convert_32bppARGB_to_32bppPARGB (UINT width, UINT height, BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride)
 
GpStatus convert_pixels (INT width, INT height, INT dst_stride, BYTE *dst_bits, PixelFormat dst_format, ColorPalette *dst_palette, INT src_stride, const BYTE *src_bits, PixelFormat src_format, ColorPalette *src_palette)
 
PixelFormat apply_image_attributes (const GpImageAttributes *attributes, LPBYTE data, UINT width, UINT height, INT stride, ColorAdjustType type, PixelFormat fmt)
 
void init_generic_string_formats (void)
 
void free_generic_string_formats (void)
 
static void init_memory_buffer (struct memory_buffer *mbuf, const BYTE *buffer, INT size)
 
static const void * buffer_read (struct memory_buffer *mbuf, INT size)
 
GpStatus gdip_format_string (GpGraphics *graphics, 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)
 
void get_log_fontW (const GpFont *, GpGraphics *, LOGFONTW *)
 
static BOOL image_lock (GpImage *image)
 
static void image_unlock (GpImage *image)
 
static BOOL has_gdi_dc (GpGraphics *graphics)
 
static void set_rect (GpRectF *rect, REAL x, REAL y, REAL width, REAL height)
 

Variables

const struct GpStringFormat default_drawstring_format
 

Macro Definition Documentation

◆ EmfPlusObjectTableSize

#define EmfPlusObjectTableSize   64

Definition at line 413 of file gdiplus_private.h.

◆ GIF_DISPOSE_DO_NOT_DISPOSE

#define GIF_DISPOSE_DO_NOT_DISPOSE   1

Definition at line 48 of file gdiplus_private.h.

◆ GIF_DISPOSE_RESTORE_TO_BKGND

#define GIF_DISPOSE_RESTORE_TO_BKGND   2

Definition at line 49 of file gdiplus_private.h.

◆ GIF_DISPOSE_RESTORE_TO_PREV

#define GIF_DISPOSE_RESTORE_TO_PREV   3

Definition at line 50 of file gdiplus_private.h.

◆ GIF_DISPOSE_UNSPECIFIED

#define GIF_DISPOSE_UNSPECIFIED   0

Definition at line 47 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 37 of file gdiplus_private.h.

◆ INCH_HIMETRIC

#define INCH_HIMETRIC   (2540)

Definition at line 40 of file gdiplus_private.h.

◆ MAX_ARC_PTS

#define MAX_ARC_PTS   (13)

Definition at line 38 of file gdiplus_private.h.

◆ MAX_DASHLEN

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

Definition at line 39 of file gdiplus_private.h.

◆ PIXELFORMATBPP

#define PIXELFORMATBPP (   x)    ((x) ? ((x) >> 8) & 255 : 24)

Definition at line 52 of file gdiplus_private.h.

◆ TENSION_CONST

#define TENSION_CONST   (0.3)

Definition at line 45 of file gdiplus_private.h.

◆ VALID_MAGIC

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

Definition at line 44 of file gdiplus_private.h.

◆ VERSION_MAGIC

#define VERSION_MAGIC   0xdbc01001

Definition at line 42 of file gdiplus_private.h.

◆ VERSION_MAGIC2

#define VERSION_MAGIC2   0xdbc01002

Definition at line 43 of file gdiplus_private.h.

◆ WineCoordinateSpaceGdiDevice

#define WineCoordinateSpaceGdiDevice   ((GpCoordinateSpace)4)

Definition at line 65 of file gdiplus_private.h.

Typedef Documentation

◆ CGpEffect

◆ EffectType

◆ EmfPlusObjectType

◆ gdip_format_string_callback

typedef GpStatus(* gdip_format_string_callback) (struct gdip_format_string_info *info)

Definition at line 666 of file gdiplus_private.h.

◆ region_element

Definition at line 149 of file gdiplus_private.h.

◆ RegionType

Enumeration Type Documentation

◆ EffectType

Enumerator
NoneEffect 
BlurEffect 
SharpenEffect 
TintEffect 
RedEyeCorrectionEffect 
ColorMatrixEffect 
ColorLUTEffect 
BrightnessContrastEffect 
HueSaturationLightnessEffect 
ColorBalanceEffect 
LevelsEffect 
ColorCurveEffect 

Definition at line 382 of file gdiplus_private.h.

382 {
395} EffectType;
EffectType
@ ColorMatrixEffect
@ ColorLUTEffect
@ ColorBalanceEffect
@ BlurEffect
@ SharpenEffect
@ BrightnessContrastEffect
@ HueSaturationLightnessEffect
@ TintEffect
@ RedEyeCorrectionEffect
@ LevelsEffect
@ ColorCurveEffect
@ NoneEffect

◆ EmfPlusObjectType

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

Definition at line 415 of file gdiplus_private.h.

416{
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 523 of file gdiplus_private.h.

523 {
527};
@ IMAGEATTR_NOOP_UNDEFINED
@ IMAGEATTR_NOOP_CLEAR
@ IMAGEATTR_NOOP_SET

◆ RegionType

Enumerator
RegionDataRect 
RegionDataPath 
RegionDataEmptyRect 
RegionDataInfiniteRect 

Definition at line 585 of file gdiplus_private.h.

586{
587 RegionDataRect = 0x10000000,
588 RegionDataPath = 0x10000001,
589 RegionDataEmptyRect = 0x10000002,
590 RegionDataInfiniteRect = 0x10000003,
591} 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 792 of file graphics.c.

794{
795 UINT x, y;
796 INT i;
797
801 return fmt;
802
803 if (attributes->colorkeys[type].enabled ||
804 attributes->colorkeys[ColorAdjustTypeDefault].enabled)
805 {
806 const struct color_key *key;
807 BYTE min_blue, min_green, min_red;
808 BYTE max_blue, max_green, max_red;
809
810 if (!data || fmt != PixelFormat32bppARGB)
812
813 if (attributes->colorkeys[type].enabled)
814 key = &attributes->colorkeys[type];
815 else
817
818 min_blue = key->low&0xff;
819 min_green = (key->low>>8)&0xff;
820 min_red = (key->low>>16)&0xff;
821
822 max_blue = key->high&0xff;
823 max_green = (key->high>>8)&0xff;
824 max_red = (key->high>>16)&0xff;
825
826 for (y=0; y<height; y++)
827 for (x=0; x<width; x++)
828 {
829 ARGB *src_color;
830 BYTE blue, green, red;
831 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
832 blue = *src_color&0xff;
833 green = (*src_color>>8)&0xff;
834 red = (*src_color>>16)&0xff;
835 if (blue >= min_blue && green >= min_green && red >= min_red &&
836 blue <= max_blue && green <= max_green && red <= max_red)
837 *src_color = 0x00000000;
838 }
839 }
840
841 if (attributes->colorremaptables[type].enabled ||
842 attributes->colorremaptables[ColorAdjustTypeDefault].enabled)
843 {
844 const struct color_remap_table *table;
845
846 if (!data || fmt != PixelFormat32bppARGB)
848
849 if (attributes->colorremaptables[type].enabled)
850 table = &attributes->colorremaptables[type];
851 else
852 table = &attributes->colorremaptables[ColorAdjustTypeDefault];
853
854 for (y=0; y<height; y++)
855 for (x=0; x<width; x++)
856 {
857 ARGB *src_color;
858 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
859 for (i=0; i<table->mapsize; i++)
860 {
861 if (*src_color == table->colormap[i].oldColor.Argb)
862 {
863 *src_color = table->colormap[i].newColor.Argb;
864 break;
865 }
866 }
867 }
868 }
869
870 if (attributes->colormatrices[type].enabled ||
871 attributes->colormatrices[ColorAdjustTypeDefault].enabled)
872 {
873 const struct color_matrix *colormatrices;
874 int color_matrix[5][5];
875 int gray_matrix[5][5];
877
878 if (!data || fmt != PixelFormat32bppARGB)
880
881 if (attributes->colormatrices[type].enabled)
882 colormatrices = &attributes->colormatrices[type];
883 else
884 colormatrices = &attributes->colormatrices[ColorAdjustTypeDefault];
885
887
888 if (colormatrices->flags == ColorMatrixFlagsAltGray)
889 identity = (round_color_matrix(&colormatrices->graymatrix, gray_matrix) && identity);
890
891 if (!identity)
892 {
893 for (y=0; y<height; y++)
894 {
895 for (x=0; x<width; x++)
896 {
897 ARGB *src_color;
898 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
899
900 if (colormatrices->flags == ColorMatrixFlagsDefault ||
901 !color_is_gray(*src_color))
902 {
903 *src_color = transform_color(*src_color, color_matrix);
904 }
905 else if (colormatrices->flags == ColorMatrixFlagsAltGray)
906 {
907 *src_color = transform_color(*src_color, gray_matrix);
908 }
909 }
910 }
911 }
912 }
913
914 if (attributes->gamma_enabled[type] ||
915 attributes->gamma_enabled[ColorAdjustTypeDefault])
916 {
917 REAL gamma;
918
919 if (!data || fmt != PixelFormat32bppARGB)
921
922 if (attributes->gamma_enabled[type])
923 gamma = attributes->gamma[type];
924 else
925 gamma = attributes->gamma[ColorAdjustTypeDefault];
926
927 for (y=0; y<height; y++)
928 for (x=0; x<width; x++)
929 {
930 ARGB *src_color;
931 BYTE blue, green, red;
932 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
933
934 blue = *src_color&0xff;
935 green = (*src_color>>8)&0xff;
936 red = (*src_color>>16)&0xff;
937
938 /* FIXME: We should probably use a table for this. */
939 blue = floorf(powf(blue / 255.0, gamma) * 255.0);
940 green = floorf(powf(green / 255.0, gamma) * 255.0);
941 red = floorf(powf(red / 255.0, gamma) * 255.0);
942
943 *src_color = (*src_color & 0xff000000) | (red << 16) | (green << 8) | blue;
944 }
945 }
946
947 return fmt;
948}
float REAL
Definition: types.h:41
static ARGB transform_color(ARGB color, int matrix[5][5])
Definition: graphics.c:752
static BOOL color_is_gray(ARGB color)
Definition: graphics.c:780
static BOOL round_color_matrix(const ColorMatrix *matrix, int values[5][5])
Definition: graphics.c:735
_ACRTIMP float __cdecl powf(float, float)
Definition: powf.c:14
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
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
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
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
unsigned int UINT
Definition: sysinfo.c:13
#define red
Definition: linetest.c:67
#define floorf(x)
Definition: mymath.h:65
static HANDLE ACCESS_MASK ULONG attributes
Definition: om.c:94
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 partial_end_angle, end_angle;
228
229 end_angle = deg2rad(start_angle + sweep_angle);
230 start_angle = deg2rad(start_angle);
231
232 if (width != height)
233 {
234 start_angle = unstretch_angle(start_angle, width, height);
235 end_angle = unstretch_angle(end_angle, width, height);
236 }
237
238 for(i = 0; i < MAX_ARC_PTS - 1; i += 3){
239 /* check if we've overshot the end angle */
240 if( sweep_angle > 0.0 )
241 {
242 if (start_angle >= end_angle) break;
243 partial_end_angle = min(start_angle + M_PI_2, end_angle);
244 }
245 else
246 {
247 if (start_angle <= end_angle) break;
248 partial_end_angle = max(start_angle - M_PI_2, end_angle);
249 }
250
251 if (points)
252 add_arc_part(&points[i], left, top, width, height, start_angle, partial_end_angle, i == 0);
253
254 start_angle = partial_end_angle;
255 }
256
257 if (i == 0) return 0;
258 else return i+1;
259}
#define M_PI_2
Definition: math.h:410
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:164
static REAL unstretch_angle(REAL angle, REAL dia_x, REAL dia_y)
Definition: gdiplus.c:207
#define MAX_ARC_PTS
static REAL deg2rad(REAL degrees)
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLsizei const GLfloat * points
Definition: glext.h:8112
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63

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

◆ ARGB2BMP()

HBITMAP ARGB2BMP ( ARGB  color)

Definition at line 274 of file gdiplus.c.

275{
276 BITMAPINFO bi;
278 RGBQUAD *bits;
279 int alpha;
280
281 if ((color & 0xff000000) == 0xff000000) return 0;
282
283 bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
284 bi.bmiHeader.biWidth = 1;
285 bi.bmiHeader.biHeight = 1;
286 bi.bmiHeader.biPlanes = 1;
287 bi.bmiHeader.biBitCount = 32;
289 bi.bmiHeader.biSizeImage = 0;
292 bi.bmiHeader.biClrUsed = 0;
294
295 result = CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void*)&bits, NULL, 0);
296
297 bits[0].rgbReserved = alpha = (color>>24)&0xff;
298 bits[0].rgbRed = ((color>>16)&0xff)*alpha/255;
299 bits[0].rgbGreen = ((color>>8)&0xff)*alpha/255;
300 bits[0].rgbBlue = (color&0xff)*alpha/255;
301
302 return result;
303}
#define NULL
Definition: types.h:112
ULONG RGBQUAD
Definition: precomp.h:47
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:40
USHORT biBitCount
Definition: precomp.h:34
LONG biYPelsPerMeter
Definition: precomp.h:38
ULONG biCompression
Definition: precomp.h:35
LONG biXPelsPerMeter
Definition: precomp.h:37
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1922
#define BI_RGB
Definition: uefivid.c:46
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 261 of file gdiplus.c.

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

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 626 of file gdiplus_private.h.

627{
628 if (mbuf->size - mbuf->pos >= size)
629 {
630 const void *data = mbuf->buffer + mbuf->pos;
631 mbuf->pos += size;
632 return data;
633 }
634 return NULL;
635}
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 389 of file gdiplus.c.

391{
392 REAL xdiff, ydiff;
393
394 /* calculate tangent */
395 xdiff = pts[2].X - pts[0].X;
396 ydiff = pts[2].Y - pts[0].Y;
397
398 /* apply tangent to get control points */
399 *x1 = pts[1].X - tension * xdiff;
400 *y1 = pts[1].Y - tension * ydiff;
401 *x2 = pts[1].X + tension * xdiff;
402 *y2 = pts[1].Y + tension * ydiff;
403}
REAL Y
Definition: gdiplustypes.h:644
REAL X
Definition: gdiplustypes.h:643
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710

Referenced by GdipAddPathClosedCurve2(), and GdipAddPathCurve3().

◆ 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 406 of file gdiplus.c.

408{
409 /* tangent at endpoints is the line from the endpoint to the adjacent point */
410 *x = gdip_round(tension * (xadj - xend) + xend);
411 *y = gdip_round(tension * (yadj - yend) + yend);
412}
static INT gdip_round(REAL x)

Referenced by GdipAddPathCurve3().

◆ ceilr()

static INT ceilr ( REAL  x)
inlinestatic

Definition at line 159 of file gdiplus_private.h.

160{
161 return (INT) ceilf(x);
162}
#define ceilf(x)
Definition: mymath.h:62

Referenced by GdipIsVisibleRegionRect().

◆ color_over()

static ARGB color_over ( ARGB  bg,
ARGB  fg 
)
inlinestatic

Definition at line 169 of file gdiplus_private.h.

170{
171 BYTE b, g, r, a;
172 BYTE bg_alpha, fg_alpha;
173
174 fg_alpha = (fg>>24)&0xff;
175
176 if (fg_alpha == 0xff) return fg;
177
178 if (fg_alpha == 0) return bg;
179
180 bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff;
181
182 if (bg_alpha == 0) return fg;
183
184 a = bg_alpha + fg_alpha;
185 b = ((bg&0xff)*bg_alpha + (fg&0xff)*fg_alpha)/a;
186 g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*fg_alpha)/a;
187 r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*fg_alpha)/a;
188
189 return (a<<24)|(r<<16)|(g<<8)|b;
190}
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 193 of file gdiplus_private.h.

194{
195 BYTE b, g, r, a;
196 BYTE bg_alpha, fg_alpha;
197
198 fg_alpha = (fg>>24)&0xff;
199
200 if (fg_alpha == 0) return bg;
201
202 bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff;
203
204 a = bg_alpha + fg_alpha;
205 b = ((bg&0xff)*bg_alpha + (fg&0xff)*0xff)/a;
206 g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*0xff)/a;
207 r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*0xff)/a;
208
209 return (a<<24)|(r<<16)|(g<<8)|b;
210}

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 445 of file gdiplus.c.

447{
448 INT x, y;
449 for (y=0; y<height; y++)
450 {
451 const BYTE *src=src_bits+y*src_stride;
452 BYTE *dst=dst_bits+y*dst_stride;
453 for (x=0; x<width; x++)
454 {
455 BYTE alpha=src[3];
456 *dst++ = (*src++ * alpha + 127) / 255;
457 *dst++ = (*src++ * alpha + 127) / 255;
458 *dst++ = (*src++ * alpha + 127) / 255;
459 *dst++ = *src++;
460 }
461 }
462}
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,
ColorPalette *  dst_palette,
INT  src_stride,
const BYTE *  src_bits,
PixelFormat  src_format,
ColorPalette *  src_palette 
)

Definition at line 589 of file image.c.

594{
595 INT x, y;
596
597 if (src_format == dst_format ||
598 (dst_format == PixelFormat32bppRGB && PIXELFORMATBPP(src_format) == 32))
599 {
600 UINT widthbytes = PIXELFORMATBPP(src_format) * width / 8;
601 for (y=0; y<height; y++)
602 memcpy(dst_bits+dst_stride*y, src_bits+src_stride*y, widthbytes);
603 return Ok;
604 }
605
606#define convert_indexed_to_rgb(getpixel_function, setpixel_function) do { \
607 for (y=0; y<height; y++) \
608 for (x=0; x<width; x++) { \
609 BYTE index; \
610 ARGB argb; \
611 BYTE *color = (BYTE *)&argb; \
612 getpixel_function(&index, src_bits+src_stride*y, x); \
613 argb = (src_palette && index < src_palette->Count) ? src_palette->Entries[index] : 0; \
614 setpixel_function(color[2], color[1], color[0], color[3], dst_bits+dst_stride*y, x); \
615 } \
616 return Ok; \
617} while (0);
618
619#define convert_indexed_to_indexed(getpixel_function, setpixel_function) do { \
620 for (y=0; y<height; y++) \
621 for (x=0; x<width; x++) { \
622 BYTE index; \
623 ARGB argb; \
624 BYTE *color = (BYTE *)&argb; \
625 getpixel_function(&index, src_bits+src_stride*y, x); \
626 argb = (src_palette && index < src_palette->Count) ? src_palette->Entries[index] : 0; \
627 setpixel_function(color[2], color[1], color[0], color[3], dst_bits+dst_stride*y, x, dst_palette); \
628 } \
629 return Ok; \
630} while (0);
631
632#define convert_rgb_to_rgb(getpixel_function, setpixel_function) do { \
633 for (y=0; y<height; y++) \
634 for (x=0; x<width; x++) { \
635 BYTE r, g, b, a; \
636 getpixel_function(&r, &g, &b, &a, src_bits+src_stride*y, x); \
637 setpixel_function(r, g, b, a, dst_bits+dst_stride*y, x); \
638 } \
639 return Ok; \
640} while (0);
641
642#define convert_rgb_to_indexed(getpixel_function, setpixel_function) do { \
643 for (y=0; y<height; y++) \
644 for (x=0; x<width; x++) { \
645 BYTE r, g, b, a; \
646 getpixel_function(&r, &g, &b, &a, src_bits+src_stride*y, x); \
647 setpixel_function(r, g, b, a, dst_bits+dst_stride*y, x, dst_palette); \
648 } \
649 return Ok; \
650} while (0);
651
652 switch (src_format)
653 {
655 switch (dst_format)
656 {
681 default:
682 break;
683 }
684 break;
686 switch (dst_format)
687 {
712 default:
713 break;
714 }
715 break;
717 switch (dst_format)
718 {
743 default:
744 break;
745 }
746 break;
748 switch (dst_format)
749 {
774 default:
775 break;
776 }
777 break;
779 switch (dst_format)
780 {
805 default:
806 break;
807 }
808 break;
810 switch (dst_format)
811 {
836 default:
837 break;
838 }
839 break;
841 switch (dst_format)
842 {
867 default:
868 break;
869 }
870 break;
872 switch (dst_format)
873 {
898 default:
899 break;
900 }
901 break;
903 switch (dst_format)
904 {
929 default:
930 break;
931 }
932 break;
934 switch (dst_format)
935 {
953 convert_32bppARGB_to_32bppPARGB(width, height, dst_bits, dst_stride, src_bits, src_stride);
954 return Ok;
959 default:
960 break;
961 }
962 break;
964 switch (dst_format)
965 {
990 default:
991 break;
992 }
993 break;
995 switch (dst_format)
996 {
1021 default:
1022 break;
1023 }
1024 break;
1026 switch (dst_format)
1027 {
1052 default:
1053 break;
1054 }
1055 break;
1057 switch (dst_format)
1058 {
1085 default:
1086 break;
1087 }
1088 break;
1089 default:
1090 break;
1091 }
1092
1093#undef convert_indexed_to_rgb
1094#undef convert_indexed_to_indexed
1095#undef convert_rgb_to_rgb
1096#undef convert_rgb_to_indexed
1097
1098 return NotImplemented;
1099}
static void setpixel_16bppARGB1555(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:457
static void setpixel_48bppRGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:495
static void setpixel_32bppPARGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:486
static void getpixel_16bppARGB1555(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:219
static void getpixel_64bppPARGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:296
static void getpixel_16bppRGB565(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:209
static void getpixel_4bppIndexed(BYTE *index, const BYTE *row, UINT x)
Definition: image.c:179
static void setpixel_16bppRGB555(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:441
#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:474
static void getpixel_1bppIndexed(BYTE *index, const BYTE *row, UINT x)
Definition: image.c:174
static void getpixel_32bppRGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:241
static void getpixel_8bppIndexed(BYTE *index, const BYTE *row, UINT x)
Definition: image.c:187
#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:287
static void getpixel_48bppRGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:278
static void setpixel_16bppGrayScale(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:435
static void getpixel_16bppGrayScale(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:192
static void setpixel_64bppARGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:503
static void getpixel_24bppRGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:232
static void setpixel_4bppIndexed(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x, ColorPalette *palette)
Definition: image.c:426
#define convert_rgb_to_rgb(getpixel_function, setpixel_function)
#define convert_indexed_to_indexed(getpixel_function, setpixel_function)
static void setpixel_32bppARGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:480
static void setpixel_16bppRGB565(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:449
static void getpixel_16bppRGB555(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:199
static void setpixel_1bppIndexed(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x, ColorPalette *palette)
Definition: image.c:420
static void getpixel_32bppARGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:250
static void setpixel_8bppIndexed(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x, ColorPalette *palette)
Definition: image.c:413
static void setpixel_24bppRGB(BYTE r, BYTE g, BYTE b, BYTE a, BYTE *row, UINT x)
Definition: image.c:466
static void getpixel_32bppPARGB(BYTE *r, BYTE *g, BYTE *b, BYTE *a, const BYTE *row, UINT x)
Definition: image.c:259
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:445
#define PIXELFORMATBPP(x)
#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:25
@ NotImplemented
Definition: gdiplustypes.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const char * dst_format
Definition: dib.c:1339

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

◆ debugstr_matrix()

const char * debugstr_matrix ( const GpMatrix *  matrix)

Definition at line 498 of file gdiplus.c.

499{
500 if (!matrix) return "(null)";
501 return wine_dbg_sprintf("%p(%0.2f,%0.2f,%0.2f,%0.2f,%0.2f,%0.2f)",matrix, matrix->matrix[0], matrix->matrix[1],
502 matrix->matrix[2], matrix->matrix[3], matrix->matrix[4], matrix->matrix[5]);
503}
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
GLuint GLenum matrix
Definition: glext.h:9407

◆ debugstr_pointf()

const char * debugstr_pointf ( const PointF *  pt)

Definition at line 492 of file gdiplus.c.

493{
494 if (!pt) return "(null)";
495 return wine_dbg_sprintf("(%0.2f,%0.2f)", pt->X, pt->Y);
496}
#define pt(x, y)
Definition: drawing.c:79

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

◆ debugstr_rectf()

◆ deg2rad()

static REAL deg2rad ( REAL  degrees)
inlinestatic

Definition at line 164 of file gdiplus_private.h.

165{
166 return M_PI * degrees / 180.0;
167}
#define M_PI
Definition: macros.h:263

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

◆ delete_element()

void delete_element ( region_element *  element)

Definition at line 465 of file gdiplus.c.

466{
467 switch(element->type)
468 {
469 case RegionDataRect:
470 break;
471 case RegionDataPath:
472 GdipDeletePath(element->elementdata.path);
473 break;
476 break;
477 default:
478 delete_element(element->elementdata.combine.left);
479 delete_element(element->elementdata.combine.right);
480 free(element->elementdata.combine.left);
481 free(element->elementdata.combine.right);
482 break;
483 }
484}
#define free
Definition: debug_ros.c:5
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
void delete_element(region_element *element)
Definition: gdiplus.c:465

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 4859 of file image.c.

4861{
4862 return encode_image_wic(image, stream, &GUID_ContainerFormatPng, params);
4863}
static GpStatus encode_image_wic(GpImage *image, IStream *stream, REFGUID container, GDIPCONST EncoderParameters *params)
Definition: image.c:4823
GLenum const GLfloat * params
Definition: glext.h:5645
Definition: image.c:84
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 1567 of file font.c.

1568{
1569 INT i;
1570
1571 for (i = 0; i < installedFontCollection.count; i++)
1574
1577}
static GpFontCollection installedFontCollection
Definition: font.c:118
GpFontFamily ** FontFamilies

Referenced by DllMain(), and GdipNewInstalledFontCollection().

◆ gdi_dc_acquire()

GpStatus gdi_dc_acquire ( GpGraphics *  graphics,
HDC *  hdc 
)

Definition at line 50 of file graphics.c.

51{
52 if (graphics->hdc != NULL)
53 {
54 *hdc = graphics->hdc;
55 graphics->hdc_refs++;
56 return Ok;
57 }
58 else if (graphics->owndc)
59 {
60 *hdc = graphics->hdc = GetDC(graphics->hwnd);
61 if (!graphics->hdc)
62 return OutOfMemory;
63 graphics->hdc_refs++;
64 return Ok;
65 }
66
67 *hdc = NULL;
68 return InvalidParameter;
69}
@ InvalidParameter
Definition: gdiplustypes.h:27
@ OutOfMemory
Definition: gdiplustypes.h:28
HDC hdc
Definition: main.c:9
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by alpha_blend_pixels_hrgn(), brush_fill_path(), draw_cap(), draw_poly(), GDI32_GdipDrawDriverString(), GDI32_GdipDrawPath(), GDI32_GdipFillPath(), GDI32_GdipFillRegion(), gdi_alpha_blend(), gdi_transform_acquire(), GdipDrawImagePointsRect(), GdipDrawString(), GdipMeasureCharacterRanges(), GdipMeasureString(), get_path_hrgn(), and trace_path().

◆ gdi_dc_release()

void gdi_dc_release ( GpGraphics *  graphics,
HDC  hdc 
)

Definition at line 71 of file graphics.c.

72{
73 assert(graphics->hdc_refs > 0);
74 graphics->hdc_refs--;
75
76 if (graphics->owndc && !graphics->hdc_refs)
77 {
78 assert(graphics->hdc == hdc);
79 graphics->hdc = NULL;
80 ReleaseDC(graphics->hwnd, hdc);
81 }
82}
#define assert(_expr)
Definition: assert.h:32
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)

Referenced by alpha_blend_pixels_hrgn(), brush_fill_path(), draw_cap(), draw_poly(), GDI32_GdipDrawDriverString(), GDI32_GdipDrawPath(), GDI32_GdipFillPath(), GDI32_GdipFillRegion(), gdi_alpha_blend(), gdi_transform_release(), GdipDrawImagePointsRect(), GdipDrawString(), GdipMeasureCharacterRanges(), GdipMeasureString(), get_path_hrgn(), and trace_path().

◆ gdi_transform_acquire()

GpStatus gdi_transform_acquire ( GpGraphics *  graphics)

Definition at line 7224 of file graphics.c.

7225{
7226 if (graphics->gdi_transform_acquire_count == 0 && has_gdi_dc(graphics))
7227 {
7228 HDC hdc;
7229 GpStatus stat;
7230
7231 stat = gdi_dc_acquire(graphics, &hdc);
7232 if (stat != Ok)
7233 return stat;
7234
7235 graphics->gdi_transform_save = SaveDC(hdc);
7239 SetWindowOrgEx(hdc, 0, 0, NULL);
7240 SetViewportOrgEx(hdc, 0, 0, NULL);
7241 }
7242 graphics->gdi_transform_acquire_count++;
7243 return Ok;
7244}
#define stat
Definition: acwin.h:100
GpStatus gdi_dc_acquire(GpGraphics *graphics, HDC *hdc)
Definition: graphics.c:50
static BOOL has_gdi_dc(GpGraphics *graphics)
Status
Definition: gdiplustypes.h:24
static HDC
Definition: imagelist.c:88
INT gdi_transform_acquire_count
INT gdi_transform_save
Definition: stat.h:66
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define GM_COMPATIBLE
Definition: wingdi.h:864
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
Definition: dc.c:1233
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
#define MWT_IDENTITY
Definition: wingdi.h:944
int WINAPI SaveDC(_In_ HDC)
BOOL WINAPI ModifyWorldTransform(_In_ HDC, _In_opt_ const XFORM *, _In_ DWORD)

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 7246 of file graphics.c.

7247{
7248 if (graphics->gdi_transform_acquire_count <= 0)
7249 {
7250 ERR("called without matching gdi_transform_acquire\n");
7251 return GenericError;
7252 }
7253 if (graphics->gdi_transform_acquire_count == 1 && graphics->hdc)
7254 {
7255 RestoreDC(graphics->hdc, graphics->gdi_transform_save);
7256 gdi_dc_release(graphics, graphics->hdc);
7257 }
7258 graphics->gdi_transform_acquire_count--;
7259 return Ok;
7260}
#define ERR(fmt,...)
Definition: precomp.h:57
void gdi_dc_release(GpGraphics *graphics, HDC hdc)
Definition: graphics.c:71
@ GenericError
Definition: gdiplustypes.h:26
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 ( GpGraphics *  graphics,
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 5474 of file graphics.c.

5478{
5479 WCHAR* stringdup;
5480 int sum = 0, height = 0, fit, fitcpy, i, j, lret, nwidth,
5481 nheight, lineend, lineno = 0;
5482 RectF bounds;
5483 StringAlignment halign;
5484 GpStatus stat = Ok;
5485 SIZE size;
5486 HotkeyPrefix hkprefix;
5487 INT *hotkeyprefix_offsets=NULL;
5488 INT hotkeyprefix_count=0;
5489 INT hotkeyprefix_pos=0, hotkeyprefix_end_pos=0;
5490 BOOL seen_prefix = FALSE, unixstyle_newline = TRUE;
5492
5493 info.graphics = graphics;
5494 info.hdc = hdc;
5495 info.rect = rect;
5496 info.bounds = &bounds;
5497 info.user_data = user_data;
5498
5499 if(length == -1) length = lstrlenW(string);
5500
5501 stringdup = calloc(length + 1, sizeof(WCHAR));
5502 if(!stringdup) return OutOfMemory;
5503
5504 info.string = stringdup;
5505
5506 if (!format)
5508
5509 info.format = format;
5510
5511 nwidth = (int)(rect->Width + 0.005f);
5512 nheight = (int)(rect->Height + 0.005f);
5513 if (ignore_empty_clip)
5514 {
5515 if (!nwidth) nwidth = INT_MAX;
5516 if (!nheight) nheight = INT_MAX;
5517 }
5518
5519 hkprefix = format->hkprefix;
5520
5521 if (hkprefix == HotkeyPrefixShow)
5522 {
5523 for (i=0; i<length; i++)
5524 {
5525 if (string[i] == '&')
5526 hotkeyprefix_count++;
5527 }
5528 }
5529
5530 if (hotkeyprefix_count)
5531 {
5532 hotkeyprefix_offsets = calloc(hotkeyprefix_count, sizeof(INT));
5533 if (!hotkeyprefix_offsets)
5534 {
5535 free(stringdup);
5536 return OutOfMemory;
5537 }
5538 }
5539
5540 hotkeyprefix_count = 0;
5541
5542 for(i = 0, j = 0; i < length; i++){
5543
5544 /* FIXME: tabs should be handled using tabstops from stringformat */
5545 if (string[i] == '\t')
5546 continue;
5547
5548 if (seen_prefix && hkprefix == HotkeyPrefixShow && string[i] != '&')
5549 hotkeyprefix_offsets[hotkeyprefix_count++] = j;
5550 else if (!seen_prefix && hkprefix != HotkeyPrefixNone && string[i] == '&')
5551 {
5552 seen_prefix = TRUE;
5553 continue;
5554 }
5555
5556 seen_prefix = FALSE;
5557
5558 stringdup[j] = string[i];
5559 j++;
5560 }
5561
5562 length = j;
5563
5564 halign = format->align;
5565
5567
5568 while(sum < length){
5569 font_link_get_text_extent_point(&info, sum, length - sum, nwidth, &fit, &size);
5570 fitcpy = fit;
5571
5572 if(fit == 0)
5573 break;
5574
5575 for(lret = 0; lret < fit; lret++) {
5576 if(*(stringdup + sum + lret) == '\n')
5577 {
5578 unixstyle_newline = TRUE;
5579 break;
5580 }
5581
5582 if(*(stringdup + sum + lret) == '\r' && lret + 1 < fit
5583 && *(stringdup + sum + lret + 1) == '\n')
5584 {
5585 unixstyle_newline = FALSE;
5586 break;
5587 }
5588 }
5589
5590 /* Line break code (may look strange, but it imitates windows). */
5591 if(lret < fit)
5592 lineend = fit = lret; /* this is not an off-by-one error */
5593 else if(fit < (length - sum)){
5594 if(*(stringdup + sum + fit) == ' ')
5595 while(*(stringdup + sum + fit) == ' ')
5596 fit++;
5597 else if (!(format->attr & StringFormatFlagsNoWrap))
5598 while(*(stringdup + sum + fit - 1) != ' '){
5599 fit--;
5600
5601 if(*(stringdup + sum + fit) == '\t')
5602 break;
5603
5604 if(fit == 0){
5605 fit = fitcpy;
5606 break;
5607 }
5608 }
5609 lineend = fit;
5610 while(*(stringdup + sum + lineend - 1) == ' ' ||
5611 *(stringdup + sum + lineend - 1) == '\t')
5612 lineend--;
5613 }
5614 else
5615 lineend = fit;
5616
5617 font_link_get_text_extent_point(&info, sum, lineend, nwidth, &j, &size);
5618
5619 bounds.Width = size.cx;
5620
5621 if(height + size.cy > nheight)
5622 {
5624 break;
5625 bounds.Height = nheight - height;
5626 }
5627 else
5628 bounds.Height = size.cy;
5629
5630 bounds.Y = rect->Y + height;
5631
5632 switch (halign)
5633 {
5635 default:
5636 bounds.X = rect->X;
5637 break;
5639 bounds.X = rect->X + (rect->Width/2) - (bounds.Width/2);
5640 break;
5641 case StringAlignmentFar:
5642 bounds.X = rect->X + rect->Width - bounds.Width;
5643 break;
5644 }
5645
5646 for (hotkeyprefix_end_pos=hotkeyprefix_pos; hotkeyprefix_end_pos<hotkeyprefix_count; hotkeyprefix_end_pos++)
5647 if (hotkeyprefix_offsets[hotkeyprefix_end_pos] >= sum + lineend)
5648 break;
5649
5650 info.index = sum;
5651 info.length = lineend;
5652 info.lineno = lineno;
5653 info.underlined_indexes = &hotkeyprefix_offsets[hotkeyprefix_pos];
5654 info.underlined_index_count = hotkeyprefix_end_pos-hotkeyprefix_pos;
5655
5656 stat = callback(&info);
5657
5658 if (stat != Ok)
5659 break;
5660
5661
5662 if (unixstyle_newline)
5663 {
5664 height += size.cy;
5665 lineno++;
5666 sum += fit + (lret < fitcpy ? 1 : 0);
5667 }
5668 else
5669 {
5670 height += size.cy;
5671 lineno++;
5672 sum += fit + (lret < fitcpy ? 2 : 0);
5673 }
5674
5675 hotkeyprefix_pos = hotkeyprefix_end_pos;
5676
5677 if(height > nheight)
5678 break;
5679
5680 /* Stop if this was a linewrap (but not if it was a linebreak). */
5681 if ((lret == fitcpy) && (format->attr & StringFormatFlagsNoWrap))
5682 break;
5683 }
5684
5685 release_font_link_info(&info.font_link_info);
5686 free(stringdup);
5687 free(hotkeyprefix_offsets);
5688
5689 return stat;
5690}
RECT rect
Definition: combotst.c:67
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define lstrlenW
Definition: compat.h:750
static void font_link_get_text_extent_point(struct gdip_format_string_info *info, INT index, int length, int max_ext, LPINT fit, SIZE *size)
Definition: graphics.c:5422
static void release_font_link_info(struct gdip_font_link_info *font_link_info)
Definition: graphics.c:5460
static void generate_font_link_info(struct gdip_format_string_info *info, DWORD length, GDIPCONST GpFont *base_font)
Definition: graphics.c:5355
static void * user_data
Definition: metahost.c:106
#define INT_MAX
Definition: limits.h:26
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
const struct GpStringFormat default_drawstring_format
Definition: stringformat.c:35
StringAlignment
Definition: gdiplusenums.h:262
@ StringAlignmentCenter
Definition: gdiplusenums.h:264
@ StringAlignmentNear
Definition: gdiplusenums.h:263
@ StringAlignmentFar
Definition: gdiplusenums.h:265
HotkeyPrefix
Definition: gdiplusenums.h:310
@ HotkeyPrefixShow
Definition: gdiplusenums.h:312
@ HotkeyPrefixNone
Definition: gdiplusenums.h:311
@ StringFormatFlagsLineLimit
Definition: gdiplusenums.h:285
@ StringFormatFlagsNoWrap
Definition: gdiplusenums.h:284
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
static IPrintDialogCallback callback
Definition: printdlg.c:325
Definition: mk_font.cpp:20
short WCHAR
Definition: pedump.c:58
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
#define calloc
Definition: rosglue.h:14
GDIPCONST GpStringFormat * format
unsigned int index
Definition: notification.c:74

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 7340 of file graphics.c.

7342{
7344 GpStatus stat;
7345
7346 stat = get_graphics_transform(graphics, dst_space, src_space, &matrix);
7347 if (stat != Ok) return stat;
7348
7350}
GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpMatrix *matrix)
Definition: graphics.c:7262
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
Definition: matrix.c:365
GLuint GLuint GLsizei count
Definition: gl.h:1545

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

◆ gdiplus_atan2()

REAL gdiplus_atan2 ( REAL  dy,
REAL  dx 
)

Definition at line 306 of file gdiplus.c.

307{
308 if((dx == 0.0) && (dy != 0.0))
309 return dy > 0.0 ? M_PI_2 : -M_PI_2;
310
311 return atan2(dy, dx);
312}
_ACRTIMP double __cdecl atan2(double, double)
Definition: atan2.c:52
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

Referenced by draw_cap(), shorten_line_percent(), transform_properties(), and unstretch_angle().

◆ get_font_hfont()

void get_font_hfont ( GpGraphics *  graphics,
GDIPCONST GpFont *  font,
GDIPCONST GpStringFormat *  format,
HFONT *  hfont,
LOGFONTW *  lfw_return,
GDIPCONST GpMatrix *  matrix 
)

Definition at line 2381 of file graphics.c.

2384{
2386 REAL angle, rel_width, rel_height, font_height;
2387 LOGFONTW lfw;
2388 HFONT unscaled_font;
2389 TEXTMETRICW textmet;
2390
2391 if (font->unit == UnitPixel || font->unit == UnitWorld)
2392 font_height = font->emSize;
2393 else
2394 {
2395 REAL unit_scale, res;
2396
2397 res = (graphics->unit == UnitDisplay || graphics->unit == UnitPixel) ? graphics->xres : graphics->yres;
2398 unit_scale = units_scale(font->unit, graphics->unit, res, graphics->printer_display);
2399
2400 font_height = font->emSize * unit_scale;
2401 }
2402
2403 transform_properties(graphics, matrix, TRUE, &rel_width, &rel_height, &angle);
2404 /* If the font unit is not pixels scaling should not be applied */
2405 if (font->unit != UnitPixel && font->unit != UnitWorld)
2406 {
2407 rel_width /= graphics->scale;
2408 rel_height /= graphics->scale;
2409 }
2410
2411 get_log_fontW(font, graphics, &lfw);
2412 lfw.lfHeight = -gdip_round(font_height * rel_height);
2413 unscaled_font = CreateFontIndirectW(&lfw);
2414
2415 SelectObject(hdc, unscaled_font);
2416 GetTextMetricsW(hdc, &textmet);
2417
2418 lfw.lfWidth = gdip_round(textmet.tmAveCharWidth * rel_width / rel_height);
2419 lfw.lfEscapement = lfw.lfOrientation = gdip_round((angle / M_PI) * 1800.0);
2420
2421 *hfont = CreateFontIndirectW(&lfw);
2422
2423 if (lfw_return)
2424 *lfw_return = lfw;
2425
2426 DeleteDC(hdc);
2427 DeleteObject(unscaled_font);
2428}
static HFONT hfont
void transform_properties(GpGraphics *graphics, GDIPCONST GpMatrix *matrix, BOOL graphics_transform, REAL *rel_width, REAL *rel_height, REAL *angle)
Definition: graphics.c:5692
void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
Definition: graphics.c:2349
pKey DeleteObject()
REAL units_scale(GpUnit from, GpUnit to, REAL dpi, BOOL printer_display)
Definition: gdiplus.c:382
@ UnitDisplay
Definition: gdiplusenums.h:28
@ UnitWorld
Definition: gdiplusenums.h:27
@ UnitPixel
Definition: gdiplusenums.h:29
GLuint res
Definition: glext.h:9613
GLfloat angle
Definition: glext.h:10853
BOOL printer_display
LONG lfHeight
Definition: dimm.idl:59
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
LONG lfEscapement
Definition: dimm.idl:61
LONG tmAveCharWidth
Definition: wingdi.h:2834
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by font_link_get_text_extent_point(), format_string_callback(), GDI32_GdipDrawDriverString(), GdipDrawString(), GdipMeasureCharacterRanges(), GdipMeasureDriverString(), GdipMeasureString(), generate_font_link_info(), and SOFTWARE_GdipDrawDriverString().

◆ get_graphics_transform()

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

Definition at line 7262 of file graphics.c.

7264{
7265 GpStatus stat = Ok;
7266 REAL scale_x, scale_y;
7267
7268 GdipSetMatrixElements(matrix, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
7269
7270 if (dst_space != src_space)
7271 {
7272 if(graphics->unit != UnitDisplay)
7273 {
7274 scale_x = units_to_pixels(graphics->scale, graphics->unit, graphics->xres, graphics->printer_display);
7275 scale_y = units_to_pixels(graphics->scale, graphics->unit, graphics->yres, graphics->printer_display);
7276 }
7277 else
7278 {
7279 scale_x = units_to_pixels(1.0, graphics->unit, graphics->xres, graphics->printer_display);
7280 scale_y = units_to_pixels(1.0, graphics->unit, graphics->yres, graphics->printer_display);
7281 }
7282
7283 if (dst_space < src_space)
7284 {
7285 /* transform towards world space */
7286 switch ((int)src_space)
7287 {
7289 {
7290 GpMatrix gdixform = graphics->gdi_transform;
7291 stat = GdipInvertMatrix(&gdixform);
7292 if (stat != Ok)
7293 break;
7294 memcpy(matrix->matrix, gdixform.matrix, sizeof(matrix->matrix));
7295 if (dst_space == CoordinateSpaceDevice)
7296 break;
7297 /* else fall-through */
7298 }
7300 GdipScaleMatrix(matrix, 1.0/scale_x, 1.0/scale_y, MatrixOrderAppend);
7301 if (dst_space == CoordinateSpacePage)
7302 break;
7303 /* else fall-through */
7305 {
7306 GpMatrix inverted_transform = graphics->worldtrans;
7307 stat = GdipInvertMatrix(&inverted_transform);
7308 if (stat == Ok)
7309 GdipMultiplyMatrix(matrix, &inverted_transform, MatrixOrderAppend);
7310 break;
7311 }
7312 }
7313 }
7314 else
7315 {
7316 /* transform towards device space */
7317 switch ((int)src_space)
7318 {
7320 memcpy(matrix->matrix, &graphics->worldtrans, sizeof(matrix->matrix));
7321 if (dst_space == CoordinateSpacePage)
7322 break;
7323 /* else fall-through */
7325 GdipScaleMatrix(matrix, scale_x, scale_y, MatrixOrderAppend);
7326 if (dst_space == CoordinateSpaceDevice)
7327 break;
7328 /* else fall-through */
7330 {
7332 break;
7333 }
7334 }
7335 }
7336 }
7337 return stat;
7338}
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:288
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, GpMatrixOrder order)
Definition: matrix.c:239
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: matrix.c:318
GpStatus WINGDIPAPI GdipInvertMatrix(GpMatrix *matrix)
Definition: matrix.c:181
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi, BOOL printer_display)
Definition: gdiplus.c:329
#define WineCoordinateSpaceGdiDevice
@ MatrixOrderAppend
Definition: gdiplusenums.h:188
@ CoordinateSpaceDevice
Definition: gdiplusenums.h:406
@ CoordinateSpaceWorld
Definition: gdiplusenums.h:404
@ CoordinateSpacePage
Definition: gdiplusenums.h:405
GpMatrix worldtrans
GpMatrix gdi_transform
REAL matrix[6]

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 unsigned char **  result 
)

Definition at line 288 of file brush.c.

289{
290 if (hatchstyle < ARRAY_SIZE(HatchBrushes))
291 {
292 *result = HatchBrushes[hatchstyle];
293 return Ok;
294 }
295 else
296 return NotImplemented;
297}
#define ARRAY_SIZE(A)
Definition: main.h:20
static const unsigned char HatchBrushes[][9]
Definition: brush.c:232

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 2349 of file graphics.c.

2350{
2351 REAL height;
2352
2353 if (font->unit == UnitPixel)
2354 {
2355 height = units_to_pixels(font->emSize, graphics->unit, graphics->yres, graphics->printer_display);
2356 }
2357 else
2358 {
2359 if (graphics->unit == UnitDisplay || graphics->unit == UnitPixel)
2360 height = units_to_pixels(font->emSize, font->unit, graphics->xres, graphics->printer_display);
2361 else
2362 height = units_to_pixels(font->emSize, font->unit, graphics->yres, graphics->printer_display);
2363 }
2364
2365 lf->lfHeight = -(height + 0.5);
2366 lf->lfWidth = 0;
2367 lf->lfEscapement = 0;
2368 lf->lfOrientation = 0;
2369 lf->lfWeight = font->otm.otmTextMetrics.tmWeight;
2370 lf->lfItalic = font->otm.otmTextMetrics.tmItalic ? 1 : 0;
2371 lf->lfUnderline = font->otm.otmTextMetrics.tmUnderlined ? 1 : 0;
2372 lf->lfStrikeOut = font->otm.otmTextMetrics.tmStruckOut ? 1 : 0;
2373 lf->lfCharSet = font->otm.otmTextMetrics.tmCharSet;
2377 lf->lfPitchAndFamily = 0;
2378 lstrcpyW(lf->lfFaceName, font->family->FamilyName);
2379}
#define lstrcpyW
Definition: compat.h:749
BYTE lfOutPrecision
Definition: dimm.idl:68
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfClipPrecision
Definition: dimm.idl:69
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(), GdipGetLogFontW(), and get_font_hfont().

◆ graphics_from_image()

GpStatus graphics_from_image ( GpImage *  image,
GpGraphics **  graphics 
)

Definition at line 2516 of file graphics.c.

2517{
2519
2520 *graphics = calloc(1, sizeof(GpGraphics));
2521 if(!*graphics) return OutOfMemory;
2522
2523 GdipSetMatrixElements(&(*graphics)->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
2524 GdipSetMatrixElements(&(*graphics)->gdi_transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
2525
2526 if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){
2527 free(*graphics);
2528 return retval;
2529 }
2530
2531 (*graphics)->hdc = NULL;
2532 (*graphics)->hwnd = NULL;
2533 (*graphics)->owndc = FALSE;
2534 (*graphics)->image = image;
2535 /* We have to store the image type here because the image may be freed
2536 * before GdipDeleteGraphics is called, and metafiles need special treatment. */
2537 (*graphics)->image_type = image->type;
2538 (*graphics)->smoothing = SmoothingModeDefault;
2539 (*graphics)->compqual = CompositingQualityDefault;
2540 (*graphics)->interpolation = InterpolationModeBilinear;
2541 (*graphics)->pixeloffset = PixelOffsetModeDefault;
2542 (*graphics)->compmode = CompositingModeSourceOver;
2543 (*graphics)->unit = UnitDisplay;
2544 (*graphics)->scale = 1.0;
2545 (*graphics)->xres = image->xres;
2546 (*graphics)->yres = image->yres;
2547 (*graphics)->busy = FALSE;
2548 (*graphics)->textcontrast = 4;
2549 list_init(&(*graphics)->containers);
2550 (*graphics)->contid = 0;
2551
2552 TRACE("<-- %p\n", *graphics);
2553
2554 return Ok;
2555}
static void list_init(struct list_entry *head)
Definition: list.h:51
GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
Definition: region.c:390
@ SmoothingModeDefault
Definition: gdiplusenums.h:122
@ CompositingModeSourceOver
Definition: gdiplusenums.h:247
@ PixelOffsetModeDefault
Definition: gdiplusenums.h:161
@ CompositingQualityDefault
Definition: gdiplusenums.h:132
@ InterpolationModeBilinear
Definition: gdiplusenums.h:145
#define TRACE(s)
Definition: solgame.cpp:4
int retval
Definition: wcstombs.cpp:91

Referenced by GdipGetImageGraphicsContext(), and METAFILE_GetGraphicsContext().

◆ has_gdi_dc()

static BOOL has_gdi_dc ( GpGraphics *  graphics)
inlinestatic

◆ hresult_to_status()

◆ image_lock()

static BOOL image_lock ( GpImage *  image)
inlinestatic

Definition at line 675 of file gdiplus_private.h.

676{
677 return TryAcquireSRWLockExclusive(&image->lock);
678}
BOOLEAN WINAPI TryAcquireSRWLockExclusive(PSRWLOCK SRWLock)
Definition: sync_static.c:72

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

◆ image_unlock()

static void image_unlock ( GpImage *  image)
inlinestatic

Definition at line 680 of file gdiplus_private.h.

681{
683}
VOID WINAPI ReleaseSRWLockExclusive(PSRWLOCK Lock)
Definition: sync.c:36

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 619 of file gdiplus_private.h.

620{
621 mbuf->buffer = buffer;
622 mbuf->size = size;
623 mbuf->pos = 0;
624}
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 415 of file gdiplus.c.

416{
417 /* initial allocation */
418 if(path->datalen == 0){
419 path->datalen = len * 2;
420
421 path->pathdata.Points = calloc(path->datalen, sizeof(PointF));
422 if(!path->pathdata.Points) return FALSE;
423
424 path->pathdata.Types = calloc(1, path->datalen);
425 if(!path->pathdata.Types){
426 free(path->pathdata.Points);
427 return FALSE;
428 }
429 }
430 /* reallocation, double size of arrays */
431 else if(path->datalen - path->pathdata.Count < len){
432 while(path->datalen - path->pathdata.Count < len)
433 path->datalen *= 2;
434
435 path->pathdata.Points = realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
436 if(!path->pathdata.Points) return FALSE;
437
438 path->pathdata.Types = realloc(path->pathdata.Types, path->datalen);
439 if(!path->pathdata.Types) return FALSE;
440 }
441
442 return TRUE;
443}
#define realloc
Definition: debug_ros.c:6
GLenum GLsizei len
Definition: glext.h:6722

Referenced by extend_current_figure(), format_string_callback(), GdipAddPathEllipse(), GdipAddPathPath(), GdipAddPathPie(), GdipAddPathPolygon(), GdipPathIterNextMarkerPath(), GdipPathIterNextSubpathPath(), and read_element().

◆ METAFILE_AddSimpleProperty()

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

Definition at line 4839 of file metafile.c.

4840{
4842 GpStatus stat;
4843
4844 if (metafile->metafile_type != MetafileTypeEmfPlusOnly && metafile->metafile_type != MetafileTypeEmfPlusDual)
4845 return Ok;
4846
4847 stat = METAFILE_AllocateRecord(metafile, prop, sizeof(*record), (void**)&record);
4848 if (stat != Ok) return stat;
4849
4850 record->Flags = val;
4851
4853 return Ok;
4854}
static void METAFILE_WriteRecords(GpMetafile *metafile)
Definition: metafile.c:770
static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, EmfPlusRecordType record_type, DWORD size, void **result)
Definition: metafile.c:715
@ MetafileTypeEmfPlusOnly
Definition: gdiplusenums.h:218
@ MetafileTypeEmfPlusDual
Definition: gdiplusenums.h:219
GLuint GLfloat * val
Definition: glext.h:7180
static const unsigned char metafile[]
Definition: olepicture.c:126

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 1564 of file metafile.c.

1566{
1567 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1568 {
1570 GpStatus stat;
1571
1573 if (stat != Ok)
1574 return stat;
1575
1576 record->Header.Flags = unit & 0xff;
1577 record->DestRect = *dstrect;
1578 record->SrcRect = *srcrect;
1579 record->StackIndex = StackIndex;
1580
1582 }
1583
1584 return Ok;
1585}
@ EmfPlusRecordTypeBeginContainer
Definition: gdiplusenums.h:734
png_const_structrp png_const_inforp int * unit
Definition: png.h:2392

Referenced by GdipBeginContainer().

◆ METAFILE_BeginContainerNoParams()

GpStatus METAFILE_BeginContainerNoParams ( GpMetafile *  metafile,
DWORD  StackIndex 
)

Definition at line 1587 of file metafile.c.

1588{
1589 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1590 {
1592 GpStatus stat;
1593
1595 sizeof(EmfPlusContainerRecord), (void **)&record);
1596 if (stat != Ok)
1597 return stat;
1598
1599 record->StackIndex = StackIndex;
1600
1602 }
1603
1604 return Ok;
1605}
@ EmfPlusRecordTypeBeginContainerNoParams
Definition: gdiplusenums.h:735

Referenced by begin_container().

◆ METAFILE_DrawArc()

GpStatus METAFILE_DrawArc ( GpMetafile *  metafile,
GpPen *  pen,
const GpRectF *  rect,
REAL  startAngle,
REAL  sweepAngle 
)

Definition at line 5536 of file metafile.c.

5537{
5539 GpStatus stat;
5540 BOOL integer_rect;
5541 DWORD pen_id;
5542
5543 if (metafile->metafile_type == MetafileTypeEmf)
5544 {
5545 FIXME("stub!\n");
5546 return NotImplemented;
5547 }
5548
5549 stat = METAFILE_AddPenObject(metafile, pen, &pen_id);
5550 if (stat != Ok) return stat;
5551
5552 integer_rect = is_integer_rect(rect);
5553
5555 (integer_rect ? sizeof(record->RectData.rect) : sizeof(record->RectData.rectF)),
5556 (void **)&record);
5557 if (stat != Ok)
5558 return stat;
5559
5560 record->Header.Flags = pen_id;
5561 if (integer_rect)
5562 record->Header.Flags |= 0x4000;
5563 record->StartAngle = startAngle;
5564 record->SweepAngle = sweepAngle;
5565
5566 if (integer_rect)
5567 {
5568 record->RectData.rect.X = (SHORT)rect->X;
5569 record->RectData.rect.Y = (SHORT)rect->Y;
5570 record->RectData.rect.Width = (SHORT)rect->Width;
5571 record->RectData.rect.Height = (SHORT)rect->Height;
5572 }
5573 else
5574 memcpy(&record->RectData.rectF, rect, sizeof(*rect));
5575
5577
5578 return Ok;
5579}
#define FIXME(fmt,...)
Definition: precomp.h:53
static GpStatus METAFILE_AddPenObject(GpMetafile *metafile, GpPen *pen, DWORD *id)
Definition: metafile.c:4878
static BOOL is_integer_rect(const GpRectF *rect)
Definition: metafile.c:979
unsigned long DWORD
Definition: ntddk_ex.h:95
@ EmfPlusRecordTypeDrawArc
Definition: gdiplusenums.h:713
@ MetafileTypeEmf
Definition: gdiplusenums.h:217
short SHORT
Definition: pedump.c:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by GdipDrawArc().

◆ METAFILE_DrawDriverString()

GpStatus METAFILE_DrawDriverString ( GpMetafile *  metafile,
GDIPCONST UINT16 *  text,
INT  length,
GDIPCONST GpFont *  font,
GDIPCONST GpStringFormat *  format,
GDIPCONST GpBrush *  brush,
GDIPCONST PointF *  positions,
INT  flags,
GDIPCONST GpMatrix *  matrix 
)

Definition at line 5322 of file metafile.c.

5325{
5326 DWORD brush_id;
5327 DWORD font_id;
5328 DWORD alloc_size;
5329 GpStatus stat;
5330 EmfPlusDrawDriverString *draw_string_record;
5331 BYTE *cursor;
5332 BOOL inline_color;
5333 BOOL include_matrix = FALSE;
5334
5335 if (length <= 0)
5336 return InvalidParameter;
5337
5338 if (metafile->metafile_type != MetafileTypeEmfPlusOnly &&
5339 metafile->metafile_type != MetafileTypeEmfPlusDual)
5340 {
5341 FIXME("metafile type not supported: %i\n", metafile->metafile_type);
5342 return NotImplemented;
5343 }
5344
5346 if (stat != Ok)
5347 return stat;
5348
5349 inline_color = (brush->bt == BrushTypeSolidColor);
5350 if (!inline_color)
5351 {
5352 stat = METAFILE_AddBrushObject(metafile, brush, &brush_id);
5353 if (stat != Ok)
5354 return stat;
5355 }
5356
5357 if (matrix)
5358 {
5359 BOOL identity;
5360
5362 if (stat != Ok)
5363 return stat;
5364
5365 include_matrix = !identity;
5366 }
5367
5368 alloc_size = FIELD_OFFSET(EmfPlusDrawDriverString, VariableData) +
5369 length * (sizeof(*text) + sizeof(*positions));
5370
5371 if (include_matrix)
5372 alloc_size += sizeof(*matrix);
5373
5374 /* Pad record to DWORD alignment. */
5375 alloc_size = (alloc_size + 3) & ~3;
5376
5377 stat = METAFILE_AllocateRecord(metafile, EmfPlusRecordTypeDrawDriverString, alloc_size, (void**)&draw_string_record);
5378 if (stat != Ok)
5379 return stat;
5380
5381 draw_string_record->Header.Flags = font_id;
5382 draw_string_record->DriverStringOptionsFlags = flags;
5383 draw_string_record->MatrixPresent = include_matrix;
5384 draw_string_record->GlyphCount = length;
5385
5386 if (inline_color)
5387 {
5388 draw_string_record->Header.Flags |= 0x8000;
5389 draw_string_record->brush.Color = ((GpSolidFill*)brush)->color;
5390 }
5391 else
5392 draw_string_record->brush.BrushId = brush_id;
5393
5394 cursor = &draw_string_record->VariableData[0];
5395
5396 memcpy(cursor, text, length * sizeof(*text));
5397 cursor += length * sizeof(*text);
5398
5400 {
5401 static BOOL fixme_written = FALSE;
5402
5403 /* Native never writes DriverStringOptionsRealizedAdvance. Instead,
5404 in the case of RealizedAdvance, each glyph position is computed
5405 and serialized.
5406
5407 While native GDI+ is capable of playing back metafiles with this
5408 flag set, it is possible that some application might rely on
5409 metafiles produced from GDI+ not setting this flag. Ideally we
5410 would also compute the position of each glyph here, serialize those
5411 values, and not set DriverStringOptionsRealizedAdvance. */
5412 if (!fixme_written)
5413 {
5414 fixme_written = TRUE;
5415 FIXME("serializing RealizedAdvance flag and single GlyphPos with padding\n");
5416 }
5417
5418 *((PointF*)cursor) = *positions;
5419 }
5420 else
5421 memcpy(cursor, positions, length * sizeof(*positions));
5422
5423 if (include_matrix)
5424 {
5425 cursor += length * sizeof(*positions);
5426 memcpy(cursor, matrix, sizeof(*matrix));
5427 }
5428
5430
5431 return Ok;
5432}
GpStatus WINGDIPAPI GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *result)
Definition: matrix.c:513
static GpStatus METAFILE_AddBrushObject(GpMetafile *metafile, GDIPCONST GpBrush *brush, DWORD *id)
Definition: metafile.c:1238
static GpStatus METAFILE_AddFontObject(GpMetafile *metafile, GDIPCONST GpFont *font, DWORD *id)
Definition: metafile.c:5277
const WCHAR * text
Definition: package.c:1826
@ EmfPlusRecordTypeDrawDriverString
Definition: gdiplusenums.h:749
@ DriverStringOptionsRealizedAdvance
Definition: gdiplusenums.h:49
@ BrushTypeSolidColor
Definition: gdiplusenums.h:38
GLbitfield flags
Definition: glext.h:7161
const char cursor[]
Definition: icontest.c:13
union EmfPlusDrawDriverString::@523 brush
EmfPlusRecordHeader Header
Definition: metafile.c:613
DWORD DriverStringOptionsFlags
Definition: metafile.c:619

Referenced by draw_driver_string().

◆ METAFILE_DrawEllipse()

GpStatus METAFILE_DrawEllipse ( GpMetafile *  metafile,
GpPen *  pen,
GpRectF *  rect 
)

Definition at line 5095 of file metafile.c.

5096{
5098 BOOL is_int_rect;
5099 GpStatus stat;
5100 DWORD pen_id;
5101
5102 if (metafile->metafile_type == MetafileTypeEmf)
5103 {
5104 FIXME("stub!\n");
5105 return NotImplemented;
5106 }
5107
5108 stat = METAFILE_AddPenObject(metafile, pen, &pen_id);
5109 if (stat != Ok) return stat;
5110
5111 is_int_rect = is_integer_rect(rect);
5112
5114 FIELD_OFFSET(EmfPlusDrawEllipse, RectData) + (is_int_rect ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)),
5115 (void **)&record);
5116 if (stat != Ok) return stat;
5117 record->Header.Type = EmfPlusRecordTypeDrawEllipse;
5118 record->Header.Flags = pen_id;
5119 if (is_int_rect)
5120 {
5121 record->Header.Flags |= 0x4000;
5122 record->RectData.rect.X = (SHORT)rect->X;
5123 record->RectData.rect.Y = (SHORT)rect->Y;
5124 record->RectData.rect.Width = (SHORT)rect->Width;
5125 record->RectData.rect.Height = (SHORT)rect->Height;
5126 }
5127 else
5128 memcpy(&record->RectData.rectF, rect, sizeof(*rect));
5129
5131 return Ok;
5132}
@ EmfPlusRecordTypeDrawEllipse
Definition: gdiplusenums.h:710

Referenced by GdipDrawEllipse().

◆ 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 4759 of file metafile.c.

4763{
4764 EmfPlusDrawImagePoints *draw_image_record;
4765 DWORD image_id, attributes_id;
4766 GpStatus stat;
4767
4768 if (count != 3) return InvalidParameter;
4769
4770 if (metafile->metafile_type == MetafileTypeEmf)
4771 {
4772 FIXME("MetafileTypeEmf metafiles not supported\n");
4773 return NotImplemented;
4774 }
4775 else
4776 FIXME("semi-stub\n");
4777
4778 if (!imageAttributes)
4779 {
4781 }
4782 else if (image->type == ImageTypeBitmap)
4783 {
4784 INT width = ((GpBitmap*)image)->width;
4785 INT height = ((GpBitmap*)image)->height;
4786 GpGraphics *graphics;
4788
4791 if (stat != Ok) return stat;
4792
4794 if (stat != Ok)
4795 {
4797 return stat;
4798 }
4799
4800 stat = GdipDrawImageRectRectI(graphics, image, 0, 0, width, height,
4801 0, 0, width, height, UnitPixel, imageAttributes, NULL, NULL);
4802 GdipDeleteGraphics(graphics);
4803 if (stat != Ok)
4804 {
4806 return stat;
4807 }
4808
4811 }
4812 else
4813 {
4814 FIXME("imageAttributes not supported (image type %d)\n", image->type);
4815 return NotImplemented;
4816 }
4817 if (stat != Ok) return stat;
4818
4819 stat = METAFILE_AddImageAttributesObject(metafile, imageAttributes, &attributes_id);
4820 if (stat != Ok) return stat;
4821
4823 sizeof(EmfPlusDrawImagePoints), (void **)&draw_image_record);
4824 if (stat != Ok) return stat;
4825
4826 draw_image_record->Header.Flags = image_id;
4827 draw_image_record->ImageAttributesID = attributes_id;
4828 draw_image_record->SrcUnit = UnitPixel;
4829 draw_image_record->SrcRect.X = units_to_pixels(srcx, srcUnit, metafile->image.xres, metafile->printer_display);
4830 draw_image_record->SrcRect.Y = units_to_pixels(srcy, srcUnit, metafile->image.yres, metafile->printer_display);
4831 draw_image_record->SrcRect.Width = units_to_pixels(srcwidth, srcUnit, metafile->image.xres, metafile->printer_display);
4832 draw_image_record->SrcRect.Height = units_to_pixels(srcheight, srcUnit, metafile->image.yres, metafile->printer_display);
4833 draw_image_record->count = 3;
4834 memcpy(draw_image_record->PointData.pointsF, points, 3 * sizeof(*points));
4836 return Ok;
4837}
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2612
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:3570
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1793
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2195
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2099
static GpStatus METAFILE_AddImageObject(GpMetafile *metafile, GpImage *image, DWORD *id)
Definition: metafile.c:4652
static GpStatus METAFILE_AddImageAttributesObject(GpMetafile *metafile, const GpImageAttributes *attrs, DWORD *id)
Definition: metafile.c:4728
@ ImageTypeBitmap
Definition: gdiplusenums.h:194
@ EmfPlusRecordTypeDrawImagePoints
Definition: gdiplusenums.h:722
union EmfPlusDrawImagePoints::@514 PointData
EmfPlusRectF SrcRect
Definition: metafile.c:502
EmfPlusPointF pointsF[3]
Definition: metafile.c:508
EmfPlusRecordHeader Header
Definition: metafile.c:499
float Width
Definition: metafile.c:272
float Height
Definition: metafile.c:273
Definition: uimain.c:89

Referenced by GdipDrawImagePointsRect().

◆ METAFILE_DrawPath()

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

Definition at line 5065 of file metafile.c.

5066{
5067 EmfPlusDrawPath *draw_path_record;
5068 DWORD path_id;
5069 DWORD pen_id;
5070 GpStatus stat;
5071
5072 if (metafile->metafile_type == MetafileTypeEmf)
5073 {
5074 FIXME("stub!\n");
5075 return NotImplemented;
5076 }
5077
5078 stat = METAFILE_AddPenObject(metafile, pen, &pen_id);
5079 if (stat != Ok) return stat;
5080
5082 if (stat != Ok) return stat;
5083
5085 sizeof(EmfPlusDrawPath), (void **)&draw_path_record);
5086 if (stat != Ok) return stat;
5087 draw_path_record->Header.Type = EmfPlusRecordTypeDrawPath;
5088 draw_path_record->Header.Flags = path_id;
5089 draw_path_record->PenId = pen_id;
5090
5092 return Ok;
5093}
static GpStatus METAFILE_AddPathObject(GpMetafile *metafile, GpPath *path, DWORD *id)
Definition: metafile.c:4856
@ EmfPlusRecordTypeDrawPath
Definition: gdiplusenums.h:716
EmfPlusRecordHeader Header
Definition: metafile.c:514

Referenced by GdipDrawPath().

◆ METAFILE_DrawRectangles()

GpStatus METAFILE_DrawRectangles ( GpMetafile *  metafile,
GpPen *  pen,
const GpRectF *  rects,
INT  count 
)

Definition at line 5481 of file metafile.c.

5482{
5484 GpStatus stat;
5485 BOOL integer_rects = TRUE;
5486 DWORD pen_id;
5487 int i;
5488
5489 if (metafile->metafile_type == MetafileTypeEmf)
5490 {
5491 FIXME("stub!\n");
5492 return NotImplemented;
5493 }
5494
5495 stat = METAFILE_AddPenObject(metafile, pen, &pen_id);
5496 if (stat != Ok) return stat;
5497
5498 for (i = 0; i < count; i++)
5499 {
5500 if (!is_integer_rect(&rects[i]))
5501 {
5502 integer_rects = FALSE;
5503 break;
5504 }
5505 }
5506
5508 count * (integer_rects ? sizeof(record->RectData.rect) : sizeof(record->RectData.rectF)),
5509 (void **)&record);
5510 if (stat != Ok)
5511 return stat;
5512
5513 record->Header.Flags = pen_id;
5514 if (integer_rects)
5515 record->Header.Flags |= 0x4000;
5516 record->Count = count;
5517
5518 if (integer_rects)
5519 {
5520 for (i = 0; i < count; i++)
5521 {
5522 record->RectData.rect[i].X = (SHORT)rects[i].X;
5523 record->RectData.rect[i].Y = (SHORT)rects[i].Y;
5524 record->RectData.rect[i].Width = (SHORT)rects[i].Width;
5525 record->RectData.rect[i].Height = (SHORT)rects[i].Height;
5526 }
5527 }
5528 else
5529 memcpy(record->RectData.rectF, rects, sizeof(*rects) * count);
5530
5532
5533 return Ok;
5534}
_Check_return_ _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS _Out_ UINT _Out_ UINT * Height
Definition: dispmprt.h:1445
_Check_return_ _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS _Out_ UINT * Width
Definition: dispmprt.h:1444
#define Y(I)
@ EmfPlusRecordTypeDrawRects
Definition: gdiplusenums.h:706

Referenced by GdipDrawRectangles().

◆ METAFILE_EndContainer()

GpStatus METAFILE_EndContainer ( GpMetafile *  metafile,
DWORD  StackIndex 
)

Definition at line 1607 of file metafile.c.

1608{
1609 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1610 {
1612 GpStatus stat;
1613
1615 sizeof(EmfPlusContainerRecord), (void **)&record);
1616 if (stat != Ok)
1617 return stat;
1618
1619 record->StackIndex = StackIndex;
1620
1622 }
1623
1624 return Ok;
1625}
@ EmfPlusRecordTypeEndContainer
Definition: gdiplusenums.h:736

Referenced by end_container().

◆ METAFILE_FillEllipse()

GpStatus METAFILE_FillEllipse ( GpMetafile *  metafile,
GpBrush *  brush,
GpRectF *  rect 
)

Definition at line 5175 of file metafile.c.

5176{
5177 BOOL is_int_rect, inline_color;
5179 DWORD brush_id = -1;
5180 GpStatus stat;
5181
5182 if (metafile->metafile_type == MetafileTypeEmf)
5183 {
5184 FIXME("stub!\n");
5185 return NotImplemented;
5186 }
5187
5188 inline_color = brush->bt == BrushTypeSolidColor;
5189 if (!inline_color)
5190 {
5191 stat = METAFILE_AddBrushObject(metafile, brush, &brush_id);
5192 if (stat != Ok) return stat;
5193 }
5194
5195 is_int_rect = is_integer_rect(rect);
5196
5198 FIELD_OFFSET(EmfPlusFillEllipse, RectData) + (is_int_rect ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)),
5199 (void **)&record);
5200 if (stat != Ok) return stat;
5201 if (inline_color)
5202 {
5203 record->Header.Flags = 0x8000;
5204 record->BrushId = ((GpSolidFill *)brush)->color;
5205 }
5206 else
5207 record->BrushId = brush_id;
5208
5209 if (is_int_rect)
5210 {
5211 record->Header.Flags |= 0x4000;
5212 record->RectData.rect.X = (SHORT)rect->X;
5213 record->RectData.rect.Y = (SHORT)rect->Y;
5214 record->RectData.rect.Width = (SHORT)rect->Width;
5215 record->RectData.rect.Height = (SHORT)rect->Height;
5216 }
5217 else
5218 memcpy(&record->RectData.rectF, rect, sizeof(*rect));
5219
5221 return Ok;
5222}
@ EmfPlusRecordTypeFillEllipse
Definition: gdiplusenums.h:709
GpBrushType bt

Referenced by GdipFillEllipse().

◆ METAFILE_FillPath()

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

Definition at line 5134 of file metafile.c.

5135{
5136 EmfPlusFillPath *fill_path_record;
5137 DWORD brush_id = -1, path_id;
5138 BOOL inline_color;
5139 GpStatus stat;
5140
5141 if (metafile->metafile_type == MetafileTypeEmf)
5142 {
5143 FIXME("stub!\n");
5144 return NotImplemented;
5145 }
5146
5147 inline_color = brush->bt == BrushTypeSolidColor;
5148 if (!inline_color)
5149 {
5150 stat = METAFILE_AddBrushObject(metafile, brush, &brush_id);
5151 if (stat != Ok) return stat;
5152 }
5153
5155 if (stat != Ok) return stat;
5156
5158 sizeof(EmfPlusFillPath), (void**)&fill_path_record);
5159 if (stat != Ok) return stat;
5160 if (inline_color)
5161 {
5162 fill_path_record->Header.Flags = 0x8000 | path_id;
5163 fill_path_record->data.Color = ((GpSolidFill *)brush)->color;
5164 }
5165 else
5166 {
5167 fill_path_record->Header.Flags = path_id;
5168 fill_path_record->data.BrushId = brush_id;
5169 }
5170
5172 return Ok;
5173}
@ EmfPlusRecordTypeFillPath
Definition: gdiplusenums.h:715
EmfPlusRecordHeader Header
Definition: metafile.c:565
union EmfPlusFillPath::@519 data
EmfPlusARGB Color
Definition: metafile.c:569

Referenced by GdipFillPath().

◆ METAFILE_FillPie()

GpStatus METAFILE_FillPie ( GpMetafile *  metafile,
GpBrush *  brush,
const GpRectF *  rect,
REAL  startAngle,
REAL  sweepAngle 
)

Definition at line 5224 of file metafile.c.

5226{
5227 BOOL is_int_rect, inline_color;
5229 DWORD brush_id = -1;
5230 GpStatus stat;
5231
5232 if (metafile->metafile_type == MetafileTypeEmf)
5233 {
5234 FIXME("stub!\n");
5235 return NotImplemented;
5236 }
5237
5238 inline_color = brush->bt == BrushTypeSolidColor;
5239 if (!inline_color)
5240 {
5241 stat = METAFILE_AddBrushObject(metafile, brush, &brush_id);
5242 if (stat != Ok) return stat;
5243 }
5244
5245 is_int_rect = is_integer_rect(rect);
5246
5248 FIELD_OFFSET(EmfPlusFillPie, RectData) + (is_int_rect ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)),
5249 (void **)&record);
5250 if (stat != Ok) return stat;
5251 if (inline_color)
5252 {
5253 record->Header.Flags = 0x8000;
5254 record->BrushId = ((GpSolidFill *)brush)->color;
5255 }
5256 else
5257 record->BrushId = brush_id;
5258
5259 record->StartAngle = startAngle;
5260 record->SweepAngle = sweepAngle;
5261
5262 if (is_int_rect)
5263 {
5264 record->Header.Flags |= 0x4000;
5265 record->RectData.rect.X = (SHORT)rect->X;
5266 record->RectData.rect.Y = (SHORT)rect->Y;
5267 record->RectData.rect.Width = (SHORT)rect->Width;
5268 record->RectData.rect.Height = (SHORT)rect->Height;
5269 }
5270 else
5271 memcpy(&record->RectData.rectF, rect, sizeof(*rect));
5272
5274 return Ok;
5275}
@ EmfPlusRecordTypeFillPie
Definition: gdiplusenums.h:711

Referenced by GdipFillPie().

◆ METAFILE_FillRectangles()

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

Definition at line 1261 of file metafile.c.

1263{
1264 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1265 {
1267 GpStatus stat;
1268 BOOL integer_rects = TRUE;
1269 int i;
1270 DWORD brushid;
1271 int flags = 0;
1272
1273 if (brush->bt == BrushTypeSolidColor)
1274 {
1275 flags |= 0x8000;
1276 brushid = ((GpSolidFill*)brush)->color;
1277 }
1278 else
1279 {
1280 stat = METAFILE_AddBrushObject(metafile, brush, &brushid);
1281 if (stat != Ok)
1282 return stat;
1283 }
1284
1285 for (i=0; i<count; i++)
1286 {
1287 if (!is_integer_rect(&rects[i]))
1288 {
1289 integer_rects = FALSE;
1290 break;
1291 }
1292 }
1293
1294 if (integer_rects)
1295 flags |= 0x4000;
1296
1298 sizeof(EmfPlusFillRects) + count * (integer_rects ? sizeof(EmfPlusRect) : sizeof(GpRectF)),
1299 (void**)&record);
1300 if (stat != Ok)
1301 return stat;
1302
1303 record->Header.Flags = flags;
1304 record->BrushID = brushid;
1305 record->Count = count;
1306
1307 if (integer_rects)
1308 {
1309 EmfPlusRect *record_rects = (EmfPlusRect*)(record+1);
1310 for (i=0; i<count; i++)
1311 {
1312 record_rects[i].X = (SHORT)rects[i].X;
1313 record_rects[i].Y = (SHORT)rects[i].Y;
1314 record_rects[i].Width = (SHORT)rects[i].Width;
1315 record_rects[i].Height = (SHORT)rects[i].Height;
1316 }
1317 }
1318 else
1319 memcpy(record+1, rects, sizeof(GpRectF) * count);
1320
1322 }
1323
1324 if (metafile->auto_frame)
1325 {
1326 GpPointF corners[4];
1327 int i;
1328
1329 for (i=0; i<count; i++)
1330 {
1331 corners[0].X = rects[i].X;
1332 corners[0].Y = rects[i].Y;
1333 corners[1].X = rects[i].X + rects[i].Width;
1334 corners[1].Y = rects[i].Y;
1335 corners[2].X = rects[i].X;
1336 corners[2].Y = rects[i].Y + rects[i].Height;
1337 corners[3].X = rects[i].X + rects[i].Width;
1338 corners[3].Y = rects[i].Y + rects[i].Height;
1339
1341 CoordinateSpaceWorld, corners, 4);
1342
1343 METAFILE_AdjustFrame(metafile, corners, 4);
1344 }
1345 }
1346
1347 return Ok;
1348}
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:7352
static void METAFILE_AdjustFrame(GpMetafile *metafile, const GpPointF *points, UINT num_points)
Definition: metafile.c:897
@ EmfPlusRecordTypeFillRects
Definition: gdiplusenums.h:705
SHORT Y
Definition: metafile.c:98
SHORT X
Definition: metafile.c:97
SHORT Height
Definition: metafile.c:100
SHORT Width
Definition: metafile.c:99

Referenced by GdipFillRectangles().

◆ METAFILE_FillRegion()

GpStatus METAFILE_FillRegion ( GpMetafile *  metafile,
GpBrush *  brush,
GpRegion *  region 
)

Definition at line 5434 of file metafile.c.

5435{
5436 GpStatus stat;
5437 DWORD brush_id;
5438 DWORD region_id;
5439 EmfPlusFillRegion *fill_region_record;
5440 BOOL inline_color;
5441
5442 if (metafile->metafile_type != MetafileTypeEmfPlusOnly &&
5443 metafile->metafile_type != MetafileTypeEmfPlusDual)
5444 {
5445 FIXME("metafile type not supported: %i\n", metafile->metafile_type);
5446 return NotImplemented;
5447 }
5448
5449 inline_color = (brush->bt == BrushTypeSolidColor);
5450 if (!inline_color)
5451 {
5452 stat = METAFILE_AddBrushObject(metafile, brush, &brush_id);
5453 if (stat != Ok)
5454 return stat;
5455 }
5456
5458 if (stat != Ok)
5459 return stat;
5460
5462 (void**)&fill_region_record);
5463 if (stat != Ok)
5464 return stat;
5465
5466 fill_region_record->Header.Flags = region_id;
5467
5468 if (inline_color)
5469 {
5470 fill_region_record->Header.Flags |= 0x8000;
5471 fill_region_record->data.Color = ((GpSolidFill*)brush)->color;
5472 }
5473 else
5474 fill_region_record->data.BrushId = brush_id;
5475
5477
5478 return Ok;
5479}
static GpStatus METAFILE_AddRegionObject(GpMetafile *metafile, GpRegion *region, DWORD *id)
Definition: metafile.c:1374
@ EmfPlusRecordTypeFillRegion
Definition: gdiplusenums.h:714
union EmfPlusFillRegion::@524 data
EmfPlusRecordHeader Header
Definition: metafile.c:627
EmfPlusARGB Color
Definition: metafile.c:631

Referenced by GdipFillRegion().

◆ METAFILE_Free()

void METAFILE_Free ( GpMetafile *  metafile)

Definition at line 687 of file metafile.c.

688{
689 unsigned int i;
690
691 free(metafile->comment_data);
693 if (!metafile->preserve_hemf)
695 if (metafile->record_graphics)
696 {
697 WARN("metafile closed while recording\n");
698 /* not sure what to do here; for now just prevent the graphics from functioning or using this object */
699 metafile->record_graphics->image = NULL;
700 metafile->record_graphics->busy = TRUE;
701 }
702
703 if (metafile->record_stream)
704 IStream_Release(metafile->record_stream);
705
706 for (i = 0; i < ARRAY_SIZE(metafile->objtable); i++)
708}
#define WARN(fmt,...)
Definition: precomp.h:61
static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id)
Definition: metafile.c:649
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 941 of file metafile.c.

942{
943 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
944 {
947
949 if (stat != Ok)
950 return stat;
951
953 }
954
955 *hdc = metafile->record_dc;
956
957 return Ok;
958}
@ EmfPlusRecordTypeGetDC
Definition: gdiplusenums.h:699

Referenced by GdipGetDC().

◆ METAFILE_GetGraphicsContext()

GpStatus METAFILE_GetGraphicsContext ( GpMetafile *  metafile,
GpGraphics **  result 
)

Definition at line 921 of file metafile.c.

922{
924
925 if (!metafile->record_dc || metafile->record_graphics)
926 return InvalidParameter;
927
928 stat = graphics_from_image((GpImage*)metafile, &metafile->record_graphics);
929
930 if (stat == Ok)
931 {
932 *result = metafile->record_graphics;
933 metafile->record_graphics->xres = metafile->logical_dpix;
934 metafile->record_graphics->yres = metafile->logical_dpiy;
935 metafile->record_graphics->printer_display = metafile->printer_display;
936 }
937
938 return stat;
939}
GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics)
Definition: graphics.c:2516

Referenced by GdipGetImageGraphicsContext().

◆ METAFILE_GraphicsClear()

GpStatus METAFILE_GraphicsClear ( GpMetafile *  metafile,
ARGB  color 
)

Definition at line 960 of file metafile.c.

961{
962 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
963 {
966
968 if (stat != Ok)
969 return stat;
970
971 record->Color = color;
972
974 }
975
976 return Ok;
977}
@ EmfPlusRecordTypeClear
Definition: gdiplusenums.h:704

Referenced by GdipGraphicsClear().

◆ METAFILE_GraphicsDeleted()

GpStatus METAFILE_GraphicsDeleted ( GpMetafile *  metafile)

Definition at line 1675 of file metafile.c.

1676{
1677 GpStatus stat;
1678
1680 metafile->record_graphics = NULL;
1681
1682 metafile->hemf = CloseEnhMetaFile(metafile->record_dc);
1683 metafile->record_dc = NULL;
1684
1685 free(metafile->comment_data);
1686 metafile->comment_data = NULL;
1687 metafile->comment_data_size = 0;
1688
1689 if (stat == Ok)
1690 {
1692
1694 if (stat == Ok && metafile->auto_frame &&
1695 metafile->auto_frame_max.X >= metafile->auto_frame_min.X)
1696 {
1697 RECTL bounds_rc, gdi_bounds_rc;
1698 REAL x_scale = 2540.0 / header.DpiX;
1699 REAL y_scale = 2540.0 / header.DpiY;
1700 BYTE* buffer;
1702
1703 gdi_bounds_rc = header.EmfHeader.rclBounds;
1704 if (gdi_bounds_rc.right > gdi_bounds_rc.left &&
1705 gdi_bounds_rc.bottom > gdi_bounds_rc.top)
1706 {
1707 GpPointF *af_min = &metafile->auto_frame_min;
1708 GpPointF *af_max = &metafile->auto_frame_max;
1709
1710 af_min->X = fmin(af_min->X, gdi_bounds_rc.left);
1711 af_min->Y = fmin(af_min->Y, gdi_bounds_rc.top);
1712 af_max->X = fmax(af_max->X, gdi_bounds_rc.right);
1713 af_max->Y = fmax(af_max->Y, gdi_bounds_rc.bottom);
1714 }
1715
1716 bounds_rc.left = floorf(metafile->auto_frame_min.X * x_scale);
1717 bounds_rc.top = floorf(metafile->auto_frame_min.Y * y_scale);
1718 bounds_rc.right = ceilf(metafile->auto_frame_max.X * x_scale);
1719 bounds_rc.bottom = ceilf(metafile->auto_frame_max.Y * y_scale);
1720
1723 if (buffer)
1724 {
1725 HENHMETAFILE new_hemf;
1726
1728
1729 ((ENHMETAHEADER*)buffer)->rclFrame = bounds_rc;
1730
1732
1733 if (new_hemf)
1734 {
1736 metafile->hemf = new_hemf;
1737 }
1738 else
1739 stat = OutOfMemory;
1740
1741 free(buffer);
1742 }
1743 else
1744 stat = OutOfMemory;
1745
1746 if (stat == Ok)
1748 }
1749 if (stat == Ok)
1750 {
1751 metafile->bounds.X = header.X;
1752 metafile->bounds.Y = header.Y;
1753 metafile->bounds.Width = header.Width;
1754 metafile->bounds.Height = header.Height;
1755 }
1756 }
1757
1758 if (stat == Ok && metafile->record_stream)
1759 {
1760 BYTE *buffer;
1762
1764
1766 if (buffer)
1767 {
1768 HRESULT hr;
1769
1771
1772 hr = IStream_Write(metafile->record_stream, buffer, buffer_size, NULL);
1773
1774 if (FAILED(hr))
1776
1777 free(buffer);
1778 }
1779 else
1780 stat = OutOfMemory;
1781 }
1782
1783 if (metafile->record_stream)
1784 {
1785 IStream_Release(metafile->record_stream);
1786 metafile->record_stream = NULL;
1787 }
1788
1789 return stat;
1790}
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
static GpStatus METAFILE_WriteEndOfFile(GpMetafile *metafile)
Definition: metafile.c:810
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hemf, MetafileHeader *header)
Definition: metafile.c:4128
_ACRTIMP double __cdecl fmin(double, double)
_ACRTIMP double __cdecl fmax(double, double)
GpStatus hresult_to_status(HRESULT res)
Definition: gdiplus.c:314
#define FAILED(hr)
Definition: intsafe.h:51
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
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 1482 of file metafile.c.

1483{
1484 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1485 {
1487 GpStatus stat;
1488
1490 sizeof(EmfPlusMultiplyWorldTransform), (void **)&record);
1491 if (stat != Ok)
1492 return stat;
1493
1494 record->Header.Flags = (order == MatrixOrderAppend ? 0x2000 : 0);
1495 memcpy(record->MatrixData, matrix->matrix, sizeof(record->MatrixData));
1496
1498 }
1499
1500 return Ok;
1501}
@ EmfPlusRecordTypeMultiplyWorldTransform
Definition: gdiplusenums.h:739
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194

Referenced by GdipMultiplyWorldTransform().

◆ METAFILE_OffsetClip()

GpStatus METAFILE_OffsetClip ( GpMetafile *  metafile,
REAL  dx,
REAL  dy 
)

Definition at line 5581 of file metafile.c.

5582{
5584 GpStatus stat;
5585
5586 if (metafile->metafile_type == MetafileTypeEmf)
5587 {
5588 FIXME("stub!\n");
5589 return NotImplemented;
5590 }
5591
5593 sizeof(*record), (void **)&record);
5594 if (stat != Ok)
5595 return stat;
5596
5597 record->dx = dx;
5598 record->dy = dy;
5599
5601
5602 return Ok;
5603}
@ EmfPlusRecordTypeOffsetClip
Definition: gdiplusenums.h:748

Referenced by GdipTranslateClip().

◆ METAFILE_ReleaseDC()

GpStatus METAFILE_ReleaseDC ( GpMetafile *  metafile,
HDC  hdc 
)

Definition at line 1667 of file metafile.c.

1668{
1669 if (hdc != metafile->record_dc)
1670 return InvalidParameter;
1671
1672 return Ok;
1673}

Referenced by GdipReleaseDC().

◆ METAFILE_ResetClip()

GpStatus METAFILE_ResetClip ( GpMetafile *  metafile)

Definition at line 5605 of file metafile.c.

5606{
5608 GpStatus stat;
5609
5610 if (metafile->metafile_type == MetafileTypeEmf)
5611 {
5612 FIXME("stub!\n");
5613 return NotImplemented;
5614 }
5615
5617 sizeof(*record), (void **)&record);
5618 if (stat != Ok)
5619 return stat;
5620
5622
5623 return Ok;
5624}
@ EmfPlusRecordTypeResetClip
Definition: gdiplusenums.h:744

Referenced by GdipResetClip().

◆ METAFILE_ResetWorldTransform()

GpStatus METAFILE_ResetWorldTransform ( GpMetafile *  metafile)

Definition at line 1546 of file metafile.c.

1547{
1548 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1549 {
1551 GpStatus stat;
1552
1554 sizeof(EmfPlusRecordHeader), (void **)&record);
1555 if (stat != Ok)
1556 return stat;
1557
1559 }
1560
1561 return Ok;
1562}
@ EmfPlusRecordTypeResetWorldTransform
Definition: gdiplusenums.h:738

Referenced by GdipResetWorldTransform().

◆ METAFILE_RestoreGraphics()

GpStatus METAFILE_RestoreGraphics ( GpMetafile *  metafile,
DWORD  StackIndex 
)

Definition at line 1647 of file metafile.c.

1648{
1649 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1650 {
1652 GpStatus stat;
1653
1655 sizeof(EmfPlusContainerRecord), (void **)&record);
1656 if (stat != Ok)
1657 return stat;
1658
1659 record->StackIndex = StackIndex;
1660
1662 }
1663
1664 return Ok;
1665}
@ EmfPlusRecordTypeRestore
Definition: gdiplusenums.h:733

Referenced by end_container().

◆ METAFILE_RotateWorldTransform()

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

Definition at line 1503 of file metafile.c.

1504{
1505 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1506 {
1508 GpStatus stat;
1509
1511 sizeof(EmfPlusRotateWorldTransform), (void **)&record);
1512 if (stat != Ok)
1513 return stat;
1514
1515 record->Header.Flags = (order == MatrixOrderAppend ? 0x2000 : 0);
1516 record->Angle = angle;
1517
1519 }
1520
1521 return Ok;
1522}
@ EmfPlusRecordTypeRotateWorldTransform
Definition: gdiplusenums.h:742

Referenced by GdipRotateWorldTransform().

◆ METAFILE_SaveGraphics()

GpStatus METAFILE_SaveGraphics ( GpMetafile *  metafile,
DWORD  StackIndex 
)

Definition at line 1627 of file metafile.c.

1628{
1629 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1630 {
1632 GpStatus stat;
1633
1635 sizeof(EmfPlusContainerRecord), (void **)&record);
1636 if (stat != Ok)
1637 return stat;
1638
1639 record->StackIndex = StackIndex;
1640
1642 }
1643
1644 return Ok;
1645}
@ EmfPlusRecordTypeSave
Definition: gdiplusenums.h:732

Referenced by begin_container().

◆ METAFILE_ScaleWorldTransform()

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

Definition at line 1460 of file metafile.c.

1461{
1462 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1463 {
1465 GpStatus stat;
1466
1468 sizeof(EmfPlusScaleWorldTransform), (void **)&record);
1469 if (stat != Ok)
1470 return stat;
1471
1472 record->Header.Flags = (order == MatrixOrderAppend ? 0x2000 : 0);
1473 record->Sx = sx;
1474 record->Sy = sy;
1475
1477 }
1478
1479 return Ok;
1480}
@ EmfPlusRecordTypeScaleWorldTransform
Definition: gdiplusenums.h:741

Referenced by GdipScaleWorldTransform().

◆ METAFILE_SetClipPath()

GpStatus METAFILE_SetClipPath ( GpMetafile *  metafile,
GpPath *  path,
CombineMode  mode 
)

Definition at line 5626 of file metafile.c.

5627{
5629 DWORD path_id;
5630 GpStatus stat;
5631
5632 if (metafile->metafile_type == MetafileTypeEmf)
5633 {
5634 FIXME("stub!\n");
5635 return NotImplemented;
5636 }
5637
5639 if (stat != Ok) return stat;
5640
5642 sizeof(*record), (void **)&record);
5643 if (stat != Ok)
5644 return stat;
5645
5646 record->Flags = ((mode & 0xf) << 8) | path_id;
5647
5649
5650 return Ok;
5651}
@ EmfPlusRecordTypeSetClipPath
Definition: gdiplusenums.h:746
GLenum mode
Definition: glext.h:6217

Referenced by GdipSetClipPath().

◆ METAFILE_SetClipRect()

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

Definition at line 1350 of file metafile.c.

1351{
1352 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1353 {
1355 GpStatus stat;
1356
1358 sizeof(EmfPlusSetClipRect), (void **)&record);
1359 if (stat != Ok)
1360 return stat;
1361
1362 record->Header.Flags = (mode & 0xf) << 8;
1363 record->ClipRect.X = x;
1364 record->ClipRect.Y = y;
1365 record->ClipRect.Width = width;
1366 record->ClipRect.Height = height;
1367
1369 }
1370
1371 return Ok;
1372}
@ EmfPlusRecordTypeSetClipRect
Definition: gdiplusenums.h:745

Referenced by GdipSetClipRect().

◆ METAFILE_SetClipRegion()

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

Definition at line 1395 of file metafile.c.

1396{
1398 DWORD region_id;
1399 GpStatus stat;
1400
1401 if (metafile->metafile_type == MetafileTypeEmf)
1402 {
1403 FIXME("stub!\n");
1404 return NotImplemented;
1405 }
1406
1408 if (stat != Ok) return stat;
1409
1411 if (stat != Ok) return stat;
1412
1413 record->Flags = region_id | mode << 8;
1414
1416 return Ok;
1417}
@ EmfPlusRecordTypeSetClipRegion
Definition: gdiplusenums.h:747

Referenced by GdipSetClipRegion().

◆ METAFILE_SetPageTransform()

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

Definition at line 1419 of file metafile.c.

1420{
1421 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1422 {
1424 GpStatus stat;
1425
1427 sizeof(EmfPlusSetPageTransform), (void **)&record);
1428 if (stat != Ok)
1429 return stat;
1430
1431 record->Header.Flags = unit;
1432 record->PageScale = scale;
1433
1435 }
1436
1437 return Ok;
1438}
@ EmfPlusRecordTypeSetPageTransform
Definition: gdiplusenums.h:743
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032

Referenced by GdipResetPageTransform(), GdipSetPageScale(), and GdipSetPageUnit().

◆ METAFILE_SetRenderingOrigin()

GpStatus METAFILE_SetRenderingOrigin ( GpMetafile *  metafile,
INT  x,
INT  y 
)

Definition at line 5653 of file metafile.c.

5654{
5656 GpStatus stat;
5657
5658 if (metafile->metafile_type == MetafileTypeEmf)
5659 {
5660 FIXME("stub!\n");
5661 return NotImplemented;
5662 }
5663
5665 sizeof(*record), (void **)&record);
5666 if (stat != Ok)
5667 return stat;
5668
5669 record->x = x;
5670 record->y = y;
5671
5673
5674 return Ok;
5675}
@ EmfPlusRecordTypeSetRenderingOrigin
Definition: gdiplusenums.h:724

Referenced by GdipSetRenderingOrigin().

◆ METAFILE_SetWorldTransform()

GpStatus METAFILE_SetWorldTransform ( GpMetafile *  metafile,
GDIPCONST GpMatrix *  transform 
)

Definition at line 1440 of file metafile.c.

1441{
1442 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1443 {
1445 GpStatus stat;
1446
1448 sizeof(EmfPlusSetWorldTransform), (void **)&record);
1449 if (stat != Ok)
1450 return stat;
1451
1452 memcpy(record->MatrixData, transform->matrix, sizeof(record->MatrixData));
1453
1455 }
1456
1457 return Ok;
1458}
@ EmfPlusRecordTypeSetWorldTransform
Definition: gdiplusenums.h:737
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 1524 of file metafile.c.

1525{
1526 if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
1527 {
1529 GpStatus stat;
1530
1532 sizeof(EmfPlusTranslateWorldTransform), (void **)&record);
1533 if (stat != Ok)
1534 return stat;
1535
1536 record->Header.Flags = (order == MatrixOrderAppend ? 0x2000 : 0);
1537 record->dx = dx;
1538 record->dy = dy;
1539
1541 }
1542
1543 return Ok;
1544}
@ EmfPlusRecordTypeTranslateWorldTransform
Definition: gdiplusenums.h:740

Referenced by GdipTranslateWorldTransform().

◆ pixels_to_units()

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

Definition at line 356 of file gdiplus.c.

357{
358 switch (unit)
359 {
360 case UnitPixel:
361 case UnitWorld:
362 return pixels;
363 case UnitDisplay:
364 if (printer_display)
365 return pixels * 100.0 / dpi;
366 else
367 return pixels;
368 case UnitPoint:
369 return pixels * point_per_inch / dpi;
370 case UnitInch:
371 return pixels / dpi;
372 case UnitDocument:
373 return pixels * 300.0 / dpi;
374 case UnitMillimeter:
375 return pixels * mm_per_inch / dpi;
376 default:
377 FIXME("Unhandled unit type: %d\n", unit);
378 return 0;
379 }
380}
static const REAL mm_per_inch
Definition: gdiplus.c:38
static const REAL point_per_inch
Definition: gdiplus.c:40
@ UnitDocument
Definition: gdiplusenums.h:32
@ UnitInch
Definition: gdiplusenums.h:31
@ UnitMillimeter
Definition: gdiplusenums.h:33
@ 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().

◆ set_rect()

◆ terminate_encoder_wic()

GpStatus terminate_encoder_wic ( GpImage *  image)

Definition at line 4655 of file image.c.

4656{
4657 if (!image->encoder)
4658 return Ok;
4659 else
4660 {
4661 HRESULT hr = IWICBitmapEncoder_Commit(image->encoder);
4662 IWICBitmapEncoder_Release(image->encoder);
4663 image->encoder = NULL;
4664 return hresult_to_status(hr);
4665 }
4666}

Referenced by encode_image_wic(), free_image_data(), GdipSaveAddImage(), GdipSaveImageToFile(), initialize_encoder_wic(), and move_bitmap().

◆ trace_path()

GpStatus trace_path ( GpGraphics *  graphics,
GpPath *  path 
)

Definition at line 2123 of file graphics.c.

2124{
2125 HDC hdc;
2127
2128 result = gdi_dc_acquire(graphics, &hdc);
2129 if (result != Ok)
2130 return result;
2131
2132 BeginPath(hdc);
2133 result = draw_poly(graphics, NULL, path->pathdata.Points,
2134 path->pathdata.Types, path->pathdata.Count, FALSE);
2135 EndPath(hdc);
2136
2137 gdi_dc_release(graphics, hdc);
2138
2139 return result;
2140}
static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *pt, GDIPCONST BYTE *types, INT count, BOOL caps)
Definition: graphics.c:1989
BOOL WINAPI EndPath(_In_ HDC)
BOOL WINAPI BeginPath(_In_ HDC hdc)

Referenced by get_path_hrgn().

◆ transform_properties()

void transform_properties ( GpGraphics *  graphics,
GDIPCONST GpMatrix *  matrix,
BOOL  graphics_transform,
REAL *  rel_width,
REAL *  rel_height,
REAL *  angle 
)

Definition at line 5692 of file graphics.c.

5694{
5695 GpPointF pt[3] = {{0.0f, 0.0f}, {1.0f, 0.0f}, {0.0f, 1.0f}};
5696 GpMatrix xform;
5697
5698 if (matrix)
5699 {
5700 xform = *matrix;
5701 GdipTransformMatrixPoints(&xform, pt, 3);
5702 }
5703
5704 if (graphics_transform)
5706
5707 if (rel_width)
5708 *rel_width = hypotf(pt[1].Y - pt[0].Y, pt[1].X - pt[0].X);
5709 if (rel_height)
5710 *rel_height = hypotf(pt[2].Y - pt[0].Y, pt[2].X - pt[0].X);
5711 if (angle)
5712 *angle = -gdiplus_atan2((pt[1].Y - pt[0].Y), (pt[1].X - pt[0].X));
5713}
GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:7340
static float hypotf(float x, float y)
Definition: math.h:428
REAL gdiplus_atan2(REAL dy, REAL dx)
Definition: gdiplus.c:306

Referenced by GdipDrawString(), GdipGetLogFontW(), GdipMeasureCharacterRanges(), GdipMeasureString(), and get_font_hfont().

◆ units_scale()

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

Definition at line 382 of file gdiplus.c.

383{
384 REAL pixels = units_to_pixels(1.0, from, dpi, printer_display);
385 return pixels_to_units(pixels, to, dpi, printer_display);
386}
REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi, BOOL printer_display)
Definition: gdiplus.c:356
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,
BOOL  printer_display 
)

Definition at line 329 of file gdiplus.c.

330{
331 switch (unit)
332 {
333 case UnitPixel:
334 case UnitWorld:
335 return units;
336 case UnitDisplay:
337 if (printer_display)
338 return units * dpi * 0.01f;
339 else
340 return units;
341 case UnitPoint:
342 return units * dpi * inch_per_point;
343 case UnitInch:
344 return units * dpi;
345 case UnitDocument:
346 return units * dpi * (1.0f / 300.0f); /* Per MSDN */
347 case UnitMillimeter:
348 return units * dpi * inch_per_mm;
349 default:
350 FIXME("Unhandled unit type: %d\n", unit);
351 return 0;
352 }
353}
static const REAL inch_per_mm
Definition: gdiplus.c:39
static const REAL inch_per_point
Definition: gdiplus.c:41
GLfloat units
Definition: glext.h:11727

Referenced by GdipBeginContainer(), GdipCreateFont(), GdipDrawImagePointsRect(), GdipEnumerateMetafileDestPoint(), GdipGetFontHeightGivenDPI(), GdipGetImageDimension(), GdipGetImageHeight(), GdipGetImageWidth(), GdipGetLogFontW(), GdipPlayMetafileRecord(), get_graphics_transform(), get_log_fontW(), METAFILE_DrawImagePointsRect(), METAFILE_PlaybackUpdateWorldTransform(), prepare_dc(), test_font_height_scaling(), test_GdipMeasureString(), test_measured_extra_space(), and units_scale().

◆ widen_flat_path_anchors()

GpStatus widen_flat_path_anchors ( GpPath *  flat_path,
GpPen *  pen,
REAL  pen_width,
GpPath **  anchors 
)

Definition at line 2551 of file graphicspath.c.

2552{
2553 GpStatus stat;
2554 path_list_node_t *points=NULL, *last_point=NULL;
2555
2556 if (!flat_path || !pen)
2557 return InvalidParameter;
2558
2559 if (init_path_list(&points, 314.0, 22.0))
2560 {
2561 last_point = points;
2562
2563 stat = GdipCreatePath(flat_path->fill, anchors);
2564 if (stat == Ok)
2565 {
2566 widen_anchors(flat_path, pen, pen_width, &last_point);
2567
2568 if (!path_list_to_path(points->next, *anchors))
2569 stat = OutOfMemory;
2570
2571 if (stat != Ok)
2572 {
2573 GdipDeletePath(*anchors);
2574 *anchors = NULL;
2575 }
2576 }
2578 }
2579 else
2580 stat = OutOfMemory;
2581
2582 /* FIXME: Apply insets to flat_path */
2583
2584 return stat;
2585}
GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
static void free_path_list(path_list_node_t *node)
Definition: graphicspath.c:61
void widen_anchors(GpPath *flat_path, GpPen *pen, REAL pen_width, path_list_node_t **last_point)
static BOOL init_path_list(path_list_node_t **node, REAL x, REAL y)
Definition: graphicspath.c:46
static BOOL path_list_to_path(path_list_node_t *node, GpPath *path)
Definition: graphicspath.c:109
GpFillMode fill

Referenced by SOFTWARE_GdipDrawThinPath().

◆ write_path_data()

DWORD write_path_data ( GpPath *  path,
void *  data 
)

Definition at line 2863 of file graphicspath.c.

2864{
2865 struct path_header *header = data;
2866 BOOL integer_path = is_integer_path(path);
2867 DWORD i, size;
2868 BYTE *types;
2869
2870 size = sizeof(struct path_header) + path->pathdata.Count;
2871 if (integer_path)
2872 size += sizeof(short[2]) * path->pathdata.Count;
2873 else
2874 size += sizeof(float[2]) * path->pathdata.Count;
2875 size = (size + 3) & ~3;
2876
2877 if (!data) return size;
2878
2879 header->version = VERSION_MAGIC2;
2880 header->count = path->pathdata.Count;
2881 header->flags = integer_path ? FLAGS_INTPATH : 0;
2882
2883 if (integer_path)
2884 {
2885 short *points = (short*)(header + 1);
2886 for (i = 0; i < path->pathdata.Count; i++)
2887 {
2888 points[2*i] = path->pathdata.Points[i].X;
2889 points[2*i + 1] = path->pathdata.Points[i].Y;
2890 }
2891 types = (BYTE*)(points + 2*i);
2892 }
2893 else
2894 {
2895 float *points = (float*)(header + 1);
2896 for (i = 0; i < path->pathdata.Count; i++)
2897 {
2898 points[2*i] = path->pathdata.Points[i].X;
2899 points[2*i + 1] = path->pathdata.Points[i].Y;
2900 }
2901 types = (BYTE*)(points + 2*i);
2902 }
2903
2904 for (i=0; i<path->pathdata.Count; i++)
2905 types[i] = path->pathdata.Types[i];
2906 memset(types + i, 0, ((path->pathdata.Count + 3) & ~3) - path->pathdata.Count);
2907 return size;
2908}
#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 689 of file region.c.

690{
691 struct region_header *header = data;
692 INT filled = 0;
693 DWORD size;
694
695 size = sizeof(struct region_header) + get_element_size(&region->node);
696 if (!data) return size;
697
698 header->magic = VERSION_MAGIC2;
699 header->num_children = region->num_children;
700 filled += 2;
701 /* With few exceptions, everything written is DWORD aligned,
702 * so use that as our base */
703 write_element(&region->node, (DWORD*)data, &filled);
704 return size;
705}
static void write_element(const region_element *element, DWORD *buffer, INT *filled)
Definition: region.c:655
static INT get_element_size(const region_element *element)
Definition: region.c:110

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

Variable Documentation

◆ default_drawstring_format

const struct GpStringFormat default_drawstring_format
extern