ReactOS 0.4.17-dev-218-g5635d24
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 chardebugstr_rectf (const RectF *rc)
 
const chardebugstr_pointf (const PointF *pt)
 
const chardebugstr_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 voidbuffer_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 796 of file graphics.c.

798{
799 UINT x, y;
800 INT i;
801
805 return fmt;
806
807 if (attributes->colorkeys[type].enabled ||
808 attributes->colorkeys[ColorAdjustTypeDefault].enabled)
809 {
810 const struct color_key *key;
811 BYTE min_blue, min_green, min_red;
812 BYTE max_blue, max_green, max_red;
813
814 if (!data || fmt != PixelFormat32bppARGB)
816
817 if (attributes->colorkeys[type].enabled)
818 key = &attributes->colorkeys[type];
819 else
821
822 min_blue = key->low&0xff;
823 min_green = (key->low>>8)&0xff;
824 min_red = (key->low>>16)&0xff;
825
826 max_blue = key->high&0xff;
827 max_green = (key->high>>8)&0xff;
828 max_red = (key->high>>16)&0xff;
829
830 for (y=0; y<height; y++)
831 for (x=0; x<width; x++)
832 {
833 ARGB *src_color;
834 BYTE blue, green, red;
835 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
836 blue = *src_color&0xff;
837 green = (*src_color>>8)&0xff;
838 red = (*src_color>>16)&0xff;
839 if (blue >= min_blue && green >= min_green && red >= min_red &&
840 blue <= max_blue && green <= max_green && red <= max_red)
841 *src_color = 0x00000000;
842 }
843 }
844
845 if (attributes->colorremaptables[type].enabled ||
846 attributes->colorremaptables[ColorAdjustTypeDefault].enabled)
847 {
848 const struct color_remap_table *table;
849
850 if (!data || fmt != PixelFormat32bppARGB)
852
853 if (attributes->colorremaptables[type].enabled)
854 table = &attributes->colorremaptables[type];
855 else
856 table = &attributes->colorremaptables[ColorAdjustTypeDefault];
857
858 for (y=0; y<height; y++)
859 for (x=0; x<width; x++)
860 {
861 ARGB *src_color;
862 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
863 for (i=0; i<table->mapsize; i++)
864 {
865 if (*src_color == table->colormap[i].oldColor.Argb)
866 {
867 *src_color = table->colormap[i].newColor.Argb;
868 break;
869 }
870 }
871 }
872 }
873
874 if (attributes->colormatrices[type].enabled ||
875 attributes->colormatrices[ColorAdjustTypeDefault].enabled)
876 {
877 const struct color_matrix *colormatrices;
878 int color_matrix[5][5];
879 int gray_matrix[5][5];
881
882 if (!data || fmt != PixelFormat32bppARGB)
884
885 if (attributes->colormatrices[type].enabled)
886 colormatrices = &attributes->colormatrices[type];
887 else
888 colormatrices = &attributes->colormatrices[ColorAdjustTypeDefault];
889
891
892 if (colormatrices->flags == ColorMatrixFlagsAltGray)
893 identity = (round_color_matrix(&colormatrices->graymatrix, gray_matrix) && identity);
894
895 if (!identity)
896 {
897 for (y=0; y<height; y++)
898 {
899 for (x=0; x<width; x++)
900 {
901 ARGB *src_color;
902 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
903
904 if (colormatrices->flags == ColorMatrixFlagsDefault ||
905 !color_is_gray(*src_color))
906 {
907 *src_color = transform_color(*src_color, color_matrix);
908 }
909 else if (colormatrices->flags == ColorMatrixFlagsAltGray)
910 {
911 *src_color = transform_color(*src_color, gray_matrix);
912 }
913 }
914 }
915 }
916 }
917
918 if (attributes->gamma_enabled[type] ||
919 attributes->gamma_enabled[ColorAdjustTypeDefault])
920 {
921 REAL gamma;
922
923 if (!data || fmt != PixelFormat32bppARGB)
925
926 if (attributes->gamma_enabled[type])
927 gamma = attributes->gamma[type];
928 else
929 gamma = attributes->gamma[ColorAdjustTypeDefault];
930
931 for (y=0; y<height; y++)
932 for (x=0; x<width; x++)
933 {
934 ARGB *src_color;
935 BYTE blue, green, red;
936 src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
937
938 blue = *src_color&0xff;
939 green = (*src_color>>8)&0xff;
940 red = (*src_color>>16)&0xff;
941
942 /* FIXME: We should probably use a table for this. */
943 blue = floorf(powf(blue / 255.0, gamma) * 255.0);
944 green = floorf(powf(green / 255.0, gamma) * 255.0);
945 red = floorf(powf(red / 255.0, gamma) * 255.0);
946
947 *src_color = (*src_color & 0xff000000) | (red << 16) | (green << 8) | blue;
948 }
949 }
950
951 return fmt;
952}
float REAL
Definition: types.h:41
static ARGB transform_color(ARGB color, int matrix[5][5])
Definition: graphics.c:756
static BOOL color_is_gray(ARGB color)
Definition: graphics.c:784
static BOOL round_color_matrix(const ColorMatrix *matrix, int values[5][5])
Definition: graphics.c:739
_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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLclampf GLclampf blue
Definition: gl.h:1740
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizei stride
Definition: glext.h:5848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define red
Definition: linetest.c:67
#define floorf(x)
Definition: mymath.h:65
unsigned int UINT
Definition: ndis.h:50
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)

◆ 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: 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 54 of file graphics.c.

55{
56 if (graphics->hdc != NULL)
57 {
58 *hdc = graphics->hdc;
59 graphics->hdc_refs++;
60 return Ok;
61 }
62 else if (graphics->owndc)
63 {
64 *hdc = graphics->hdc = GetDC(graphics->hwnd);
65 if (!graphics->hdc)
66 return OutOfMemory;
67 graphics->hdc_refs++;
68 return Ok;
69 }
70
71 *hdc = NULL;
72 return InvalidParameter;
73}
@ 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 75 of file graphics.c.

76{
77 assert(graphics->hdc_refs > 0);
78 graphics->hdc_refs--;
79
80 if (graphics->owndc && !graphics->hdc_refs)
81 {
82 assert(graphics->hdc == hdc);
83 graphics->hdc = NULL;
84 ReleaseDC(graphics->hwnd, hdc);
85 }
86}
#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 7228 of file graphics.c.

7229{
7230 if (graphics->gdi_transform_acquire_count == 0 && has_gdi_dc(graphics))
7231 {
7232 HDC hdc;
7233 GpStatus stat;
7234
7235 stat = gdi_dc_acquire(graphics, &hdc);
7236 if (stat != Ok)
7237 return stat;
7238
7239 graphics->gdi_transform_save = SaveDC(hdc);
7243 SetWindowOrgEx(hdc, 0, 0, NULL);
7244 SetViewportOrgEx(hdc, 0, 0, NULL);
7245 }
7246 graphics->gdi_transform_acquire_count++;
7247 return Ok;
7248}
#define stat
Definition: acwin.h:100
GpStatus gdi_dc_acquire(GpGraphics *graphics, HDC *hdc)
Definition: graphics.c:54
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 7250 of file graphics.c.

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

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

7346{
7348 GpStatus stat;
7349
7350 stat = get_graphics_transform(graphics, dst_space, src_space, &matrix);
7351 if (stat != Ok) return stat;
7352
7354}
GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpMatrix *matrix)
Definition: graphics.c:7266
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 2385 of file graphics.c.

2388{
2390 REAL angle, rel_width, rel_height, font_height;
2391 LOGFONTW lfw;
2392 HFONT unscaled_font;
2393 TEXTMETRICW textmet;
2394
2395 if (font->unit == UnitPixel || font->unit == UnitWorld)
2396 font_height = font->emSize;
2397 else
2398 {
2399 REAL unit_scale, res;
2400
2401 res = (graphics->unit == UnitDisplay || graphics->unit == UnitPixel) ? graphics->xres : graphics->yres;
2402 unit_scale = units_scale(font->unit, graphics->unit, res, graphics->printer_display);
2403
2404 font_height = font->emSize * unit_scale;
2405 }
2406
2407 transform_properties(graphics, matrix, TRUE, &rel_width, &rel_height, &angle);
2408 /* If the font unit is not pixels scaling should not be applied */
2409 if (font->unit != UnitPixel && font->unit != UnitWorld)
2410 {
2411 rel_width /= graphics->scale;
2412 rel_height /= graphics->scale;
2413 }
2414
2415 get_log_fontW(font, graphics, &lfw);
2416 lfw.lfHeight = -gdip_round(font_height * rel_height);
2417 unscaled_font = CreateFontIndirectW(&lfw);
2418
2419 SelectObject(hdc, unscaled_font);
2420 GetTextMetricsW(hdc, &textmet);
2421
2422 lfw.lfWidth = gdip_round(textmet.tmAveCharWidth * rel_width / rel_height);
2423 lfw.lfEscapement = lfw.lfOrientation = gdip_round((angle / M_PI) * 1800.0);
2424
2425 *hfont = CreateFontIndirectW(&lfw);
2426
2427 if (lfw_return)
2428 *lfw_return = lfw;
2429
2430 DeleteDC(hdc);
2431 DeleteObject(unscaled_font);
2432}
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:5696
void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
Definition: graphics.c:2353
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 7266 of file graphics.c.

7268{
7269 GpStatus stat = Ok;
7270 REAL scale_x, scale_y;
7271
7272 GdipSetMatrixElements(matrix, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
7273
7274 if (dst_space != src_space)
7275 {
7276 if(graphics->unit != UnitDisplay)
7277 {
7278 scale_x = units_to_pixels(graphics->scale, graphics->unit, graphics->xres, graphics->printer_display);
7279 scale_y = units_to_pixels(graphics->scale, graphics->unit, graphics->yres, graphics->printer_display);
7280 }
7281 else
7282 {
7283 scale_x = units_to_pixels(1.0, graphics->unit, graphics->xres, graphics->printer_display);
7284 scale_y = units_to_pixels(1.0, graphics->unit, graphics->yres, graphics->printer_display);
7285 }
7286
7287 if (dst_space < src_space)
7288 {
7289 /* transform towards world space */
7290 switch ((int)src_space)
7291 {
7293 {
7294 GpMatrix gdixform = graphics->gdi_transform;
7295 stat = GdipInvertMatrix(&gdixform);
7296 if (stat != Ok)
7297 break;
7298 memcpy(matrix->matrix, gdixform.matrix, sizeof(matrix->matrix));
7299 if (dst_space == CoordinateSpaceDevice)
7300 break;
7301 /* else fall-through */
7302 }
7304 GdipScaleMatrix(matrix, 1.0/scale_x, 1.0/scale_y, MatrixOrderAppend);
7305 if (dst_space == CoordinateSpacePage)
7306 break;
7307 /* else fall-through */
7309 {
7310 GpMatrix inverted_transform = graphics->worldtrans;
7311 stat = GdipInvertMatrix(&inverted_transform);
7312 if (stat == Ok)
7313 GdipMultiplyMatrix(matrix, &inverted_transform, MatrixOrderAppend);
7314 break;
7315 }
7316 }
7317 }
7318 else
7319 {
7320 /* transform towards device space */
7321 switch ((int)src_space)
7322 {
7324 memcpy(matrix->matrix, &graphics->worldtrans, sizeof(matrix->matrix));
7325 if (dst_space == CoordinateSpacePage)
7326 break;
7327 /* else fall-through */
7329 GdipScaleMatrix(matrix, scale_x, scale_y, MatrixOrderAppend);
7330 if (dst_space == CoordinateSpaceDevice)
7331 break;
7332 /* else fall-through */
7334 {
7336 break;
7337 }
7338 }
7339 }
7340 }
7341 return stat;
7342}
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 2353 of file graphics.c.

2354{
2355 REAL height;
2356
2357 if (font->unit == UnitPixel)
2358 {
2359 height = units_to_pixels(font->emSize, graphics->unit, graphics->yres, graphics->printer_display);
2360 }
2361 else
2362 {
2363 if (graphics->unit == UnitDisplay || graphics->unit == UnitPixel)
2364 height = units_to_pixels(font->emSize, font->unit, graphics->xres, graphics->printer_display);
2365 else
2366 height = units_to_pixels(font->emSize, font->unit, graphics->yres, graphics->printer_display);
2367 }
2368
2369 lf->lfHeight = -(height + 0.5);
2370 lf->lfWidth = 0;
2371 lf->lfEscapement = 0;
2372 lf->lfOrientation = 0;
2373 lf->lfWeight = font->otm.otmTextMetrics.tmWeight;
2374 lf->lfItalic = font->otm.otmTextMetrics.tmItalic ? 1 : 0;
2375 lf->lfUnderline = font->otm.otmTextMetrics.tmUnderlined ? 1 : 0;
2376 lf->lfStrikeOut = font->otm.otmTextMetrics.tmStruckOut ? 1 : 0;
2377 lf->lfCharSet = font->otm.otmTextMetrics.tmCharSet;
2381 lf->lfPitchAndFamily = 0;
2382 lstrcpyW(lf->lfFaceName, font->family->FamilyName);
2383}
#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 2520 of file graphics.c.

2521{
2523
2524 *graphics = calloc(1, sizeof(GpGraphics));
2525 if(!*graphics) return OutOfMemory;
2526
2527 GdipSetMatrixElements(&(*graphics)->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
2528 GdipSetMatrixElements(&(*graphics)->gdi_transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
2529
2530 if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){
2531 free(*graphics);
2532 return retval;
2533 }
2534
2535 (*graphics)->hdc = NULL;
2536 (*graphics)->hwnd = NULL;
2537 (*graphics)->owndc = FALSE;
2538 (*graphics)->image = image;
2539 /* We have to store the image type here because the image may be freed
2540 * before GdipDeleteGraphics is called, and metafiles need special treatment. */
2541 (*graphics)->image_type = image->type;
2542 (*graphics)->smoothing = SmoothingModeDefault;
2543 (*graphics)->compqual = CompositingQualityDefault;
2544 (*graphics)->interpolation = InterpolationModeBilinear;
2545 (*graphics)->pixeloffset = PixelOffsetModeDefault;
2546 (*graphics)->compmode = CompositingModeSourceOver;
2547 (*graphics)->unit = UnitDisplay;
2548 (*graphics)->scale = 1.0;
2549 (*graphics)->xres = image->xres;
2550 (*graphics)->yres = image->yres;
2551 (*graphics)->busy = FALSE;
2552 (*graphics)->textcontrast = 4;
2553 list_init(&(*graphics)->containers);
2554 (*graphics)->contid = 0;
2555
2556 TRACE("<-- %p\n", *graphics);
2557
2558 return Ok;
2559}
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
GLeglImageOES image
Definition: gl.h:2204
#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}

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:138

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

◆ METAFILE_BeginContainer()

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

Definition at line 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:1794
@ 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
EmfPlusRecordHeader Header
Definition: metafile.c:613
union EmfPlusDrawDriverString::@421 brush
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:2616
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:3574
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
EmfPlusRectF SrcRect
Definition: metafile.c:502
union EmfPlusDrawImagePoints::@412 PointData
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}
#define Y(I)
@ EmfPlusRecordTypeDrawRects
Definition: gdiplusenums.h:706
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88

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
EmfPlusARGB Color
Definition: metafile.c:569
union EmfPlusFillPath::@417 data

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:7356
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
5457 stat = METAFILE_AddRegionObject(metafile, region, &region_id);
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
EmfPlusRecordHeader Header
Definition: metafile.c:627
union EmfPlusFillRegion::@422 data
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:2520

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
1407 stat = METAFILE_AddRegionObject(metafile, region, &region_id);
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 2127 of file graphics.c.

2128{
2129 HDC hdc;
2131
2132 result = gdi_dc_acquire(graphics, &hdc);
2133 if (result != Ok)
2134 return result;
2135
2136 BeginPath(hdc);
2137 result = draw_poly(graphics, NULL, path->pathdata.Points,
2138 path->pathdata.Types, path->pathdata.Count, FALSE);
2139 EndPath(hdc);
2140
2141 gdi_dc_release(graphics, hdc);
2142
2143 return result;
2144}
static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *pt, GDIPCONST BYTE *types, INT count, BOOL caps)
Definition: graphics.c:1993
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 5696 of file graphics.c.

5698{
5699 GpPointF pt[3] = {{0.0f, 0.0f}, {1.0f, 0.0f}, {0.0f, 1.0f}};
5700 GpMatrix xform;
5701
5702 if (matrix)
5703 {
5704 xform = *matrix;
5705 GdipTransformMatrixPoints(&xform, pt, 3);
5706 }
5707
5708 if (graphics_transform)
5710
5711 if (rel_width)
5712 *rel_width = hypotf(pt[1].Y - pt[0].Y, pt[1].X - pt[0].X);
5713 if (rel_height)
5714 *rel_height = hypotf(pt[2].Y - pt[0].Y, pt[2].X - pt[0].X);
5715 if (angle)
5716 *angle = -gdiplus_atan2((pt[1].Y - pt[0].Y), (pt[1].X - pt[0].X));
5717}
GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:7344
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
region_element node
DWORD num_children

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

Variable Documentation

◆ default_drawstring_format

const struct GpStringFormat default_drawstring_format
extern