ReactOS  0.4.13-dev-257-gfabbd7c
graphics.c File Reference
#include <stdarg.h>
#include <math.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/unicode.h"
#include "objbase.h"
#include "ocidl.h"
#include "olectl.h"
#include "ole2.h"
#include "winreg.h"
#include "shlwapi.h"
#include "gdiplus.h"
#include "gdiplus_private.h"
#include "wine/debug.h"
#include "wine/list.h"
Include dependency graph for graphics.c:

Go to the source code of this file.

Classes

struct  _GraphicsContainerItem
 
struct  measure_ranges_args
 
struct  measure_string_args
 
struct  draw_string_args
 

Macros

#define COBJMACROS
 
#define GDIP_CONTID_STEP   64
 
#define GDIP_GET_NEW_CONTID_FOR(pGpGraphics)   (UINT)(InterlockedExchangeAdd(&g_priv_contid,GDIP_CONTID_STEP))
 
#define fmax   max
 
#define ANCHOR_WIDTH   (2.0)
 
#define MAX_ITERS   (50)
 

Typedefs

typedef enum GraphicsContainerType GraphicsContainerType
 
typedef struct _GraphicsContainerItem GraphicsContainerItem
 

Enumerations

enum  GraphicsContainerType { BEGIN_CONTAINER, SAVE_GRAPHICS }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (gdiplus)
 
static GpStatus draw_driver_string (GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix)
 
static BYTE convert_path_point_type (BYTE type)
 
static COLORREF get_gdi_brush_color (const GpBrush *brush)
 
static HBITMAP create_hatch_bitmap (const GpHatch *hatch)
 
static GpStatus create_gdi_logbrush (const GpBrush *brush, LOGBRUSH *lb)
 
static GpStatus free_gdi_logbrush (LOGBRUSH *lb)
 
static HBRUSH create_gdi_brush (const GpBrush *brush)
 
static INT prepare_dc (GpGraphics *graphics, GpPen *pen)
 
static void restore_dc (GpGraphics *graphics, INT state)
 
static void round_points (POINT *pti, GpPointF *ptf, INT count)
 
static void gdi_alpha_blend (GpGraphics *graphics, INT dst_x, INT dst_y, INT dst_width, INT dst_height, HDC hdc, INT src_x, INT src_y, INT src_width, INT src_height)
 
static GpStatus get_clip_hrgn (GpGraphics *graphics, HRGN *hrgn)
 
static GpStatus alpha_blend_bmp_pixels (GpGraphics *graphics, INT dst_x, INT dst_y, const BYTE *src, INT src_width, INT src_height, INT src_stride, const PixelFormat fmt)
 
static GpStatus alpha_blend_hdc_pixels (GpGraphics *graphics, INT dst_x, INT dst_y, const BYTE *src, INT src_width, INT src_height, INT src_stride, PixelFormat fmt)
 
static GpStatus alpha_blend_pixels_hrgn (GpGraphics *graphics, INT dst_x, INT dst_y, const BYTE *src, INT src_width, INT src_height, INT src_stride, HRGN hregion, PixelFormat fmt)
 
static GpStatus alpha_blend_pixels (GpGraphics *graphics, INT dst_x, INT dst_y, const BYTE *src, INT src_width, INT src_height, INT src_stride, PixelFormat fmt)
 
static ARGB blend_colors_premult (ARGB start, ARGB end, REAL position)
 
static ARGB blend_colors (ARGB start, ARGB end, REAL position)
 
static ARGB blend_line_gradient (GpLineGradient *brush, REAL position)
 
static BOOL round_color_matrix (const ColorMatrix *matrix, int values[5][5])
 
static ARGB transform_color (ARGB color, int matrix[5][5])
 
static BOOL color_is_gray (ARGB color)
 
PixelFormat apply_image_attributes (const GpImageAttributes *attributes, LPBYTE data, UINT width, UINT height, INT stride, ColorAdjustType type, PixelFormat fmt)
 
static void get_bitmap_sample_size (InterpolationMode interpolation, WrapMode wrap, GpBitmap *bitmap, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpRect *rect)
 
static ARGB sample_bitmap_pixel (GDIPCONST GpRect *src_rect, LPBYTE bits, UINT width, UINT height, INT x, INT y, GDIPCONST GpImageAttributes *attributes)
 
static int positive_ceilf (float f)
 
static ARGB resample_bitmap_pixel (GDIPCONST GpRect *src_rect, LPBYTE bits, UINT width, UINT height, GpPointF *point, GDIPCONST GpImageAttributes *attributes, InterpolationMode interpolation, PixelOffsetMode offset_mode)
 
static ARGB resample_bitmap_pixel_premult (GDIPCONST GpRect *src_rect, LPBYTE bits, UINT width, UINT height, GpPointF *point, GDIPCONST GpImageAttributes *attributes, InterpolationMode interpolation, PixelOffsetMode offset_mode)
 
static REAL intersect_line_scanline (const GpPointF *p1, const GpPointF *p2, REAL y)
 
static BOOL brush_can_fill_path (GpBrush *brush, BOOL is_fill)
 
static GpStatus brush_fill_path (GpGraphics *graphics, GpBrush *brush)
 
static BOOL brush_can_fill_pixels (GpBrush *brush)
 
static GpStatus brush_fill_pixels (GpGraphics *graphics, GpBrush *brush, DWORD *argb_pixels, GpRect *fill_area, UINT cdwStride)
 
static void draw_cap (GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL size, const GpCustomLineCap *custom, REAL x1, REAL y1, REAL x2, REAL y2)
 
static void shorten_line_percent (REAL x1, REAL y1, REAL *x2, REAL *y2, REAL percent)
 
static void shorten_line_amt (REAL x1, REAL y1, REAL *x2, REAL *y2, REAL amt)
 
static void shorten_bezier_amt (GpPointF *pt, REAL amt, BOOL rev)
 
static GpStatus draw_poly (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *pt, GDIPCONST BYTE *types, INT count, BOOL caps)
 
GpStatus trace_path (GpGraphics *graphics, GpPath *path)
 
static GpStatus init_container (GraphicsContainerItem **container, GDIPCONST GpGraphics *graphics, GraphicsContainerType type)
 
static void delete_container (GraphicsContainerItem *container)
 
static GpStatus restore_container (GpGraphics *graphics, GDIPCONST GraphicsContainerItem *container)
 
static GpStatus get_graphics_device_bounds (GpGraphics *graphics, GpRectF *rect)
 
static GpStatus get_graphics_bounds (GpGraphics *graphics, GpRectF *rect)
 
static GpStatus get_visible_clip_region (GpGraphics *graphics, GpRegion *rgn)
 
void get_log_fontW (const GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
 
static void get_font_hfont (GpGraphics *graphics, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, HFONT *hfont, GDIPCONST GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipCreateFromHDC (HDC hdc, GpGraphics **graphics)
 
static void get_gdi_transform (GpGraphics *graphics, GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipCreateFromHDC2 (HDC hdc, HANDLE hDevice, GpGraphics **graphics)
 
GpStatus graphics_from_image (GpImage *image, GpGraphics **graphics)
 
GpStatus WINGDIPAPI GdipCreateFromHWND (HWND hwnd, GpGraphics **graphics)
 
GpStatus WINGDIPAPI GdipCreateFromHWNDICM (HWND hwnd, GpGraphics **graphics)
 
GpStatus WINGDIPAPI GdipCreateStreamOnFile (GDIPCONST WCHAR *filename, UINT access, IStream **stream)
 
GpStatus WINGDIPAPI GdipDeleteGraphics (GpGraphics *graphics)
 
GpStatus WINGDIPAPI GdipDrawArc (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
 
GpStatus WINGDIPAPI GdipDrawArcI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
 
GpStatus WINGDIPAPI GdipDrawBezier (GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4)
 
GpStatus WINGDIPAPI GdipDrawBezierI (GpGraphics *graphics, GpPen *pen, INT x1, INT y1, INT x2, INT y2, INT x3, INT y3, INT x4, INT y4)
 
GpStatus WINGDIPAPI GdipDrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count)
 
GpStatus WINGDIPAPI GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count)
 
GpStatus WINGDIPAPI GdipDrawClosedCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count)
 
GpStatus WINGDIPAPI GdipDrawClosedCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count)
 
GpStatus WINGDIPAPI GdipDrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, REAL tension)
 
GpStatus WINGDIPAPI GdipDrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, REAL tension)
 
GpStatus WINGDIPAPI GdipDrawCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count)
 
GpStatus WINGDIPAPI GdipDrawCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count)
 
GpStatus WINGDIPAPI GdipDrawCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, REAL tension)
 
GpStatus WINGDIPAPI GdipDrawCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, REAL tension)
 
GpStatus WINGDIPAPI GdipDrawCurve3 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, INT offset, INT numberOfSegments, REAL tension)
 
GpStatus WINGDIPAPI GdipDrawCurve3I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, INT offset, INT numberOfSegments, REAL tension)
 
GpStatus WINGDIPAPI GdipDrawEllipse (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height)
 
GpStatus WINGDIPAPI GdipDrawEllipseI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height)
 
GpStatus WINGDIPAPI GdipDrawImage (GpGraphics *graphics, GpImage *image, REAL x, REAL y)
 
GpStatus WINGDIPAPI GdipDrawImageI (GpGraphics *graphics, GpImage *image, INT x, INT y)
 
GpStatus WINGDIPAPI GdipDrawImagePointRect (GpGraphics *graphics, GpImage *image, REAL x, REAL y, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit)
 
GpStatus WINGDIPAPI GdipDrawImagePointRectI (GpGraphics *graphics, GpImage *image, INT x, INT y, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit)
 
GpStatus WINGDIPAPI GdipDrawImagePoints (GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *dstpoints, INT count)
 
GpStatus WINGDIPAPI GdipDrawImagePointsI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *dstpoints, INT count)
 
static BOOL CALLBACK play_metafile_proc (EmfPlusRecordType record_type, unsigned int flags, unsigned int dataSize, const unsigned char *pStr, void *userdata)
 
GpStatus WINGDIPAPI GdipDrawImagePointsRect (GpGraphics *graphics, 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 WINGDIPAPI GdipDrawImagePointsRectI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *points, INT count, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, VOID *callbackData)
 
GpStatus WINGDIPAPI GdipDrawImageRectRect (GpGraphics *graphics, GpImage *image, REAL dstx, REAL dsty, REAL dstwidth, REAL dstheight, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageattr, DrawImageAbort callback, VOID *callbackData)
 
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)
 
GpStatus WINGDIPAPI GdipDrawImageRect (GpGraphics *graphics, GpImage *image, REAL x, REAL y, REAL width, REAL height)
 
GpStatus WINGDIPAPI GdipDrawImageRectI (GpGraphics *graphics, GpImage *image, INT x, INT y, INT width, INT height)
 
GpStatus WINGDIPAPI GdipDrawLine (GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2)
 
GpStatus WINGDIPAPI GdipDrawLineI (GpGraphics *graphics, GpPen *pen, INT x1, INT y1, INT x2, INT y2)
 
GpStatus WINGDIPAPI GdipDrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count)
 
GpStatus WINGDIPAPI GdipDrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count)
 
static GpStatus GDI32_GdipDrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path)
 
static GpStatus SOFTWARE_GdipDrawThinPath (GpGraphics *graphics, GpPen *pen, GpPath *path)
 
static GpStatus SOFTWARE_GdipDrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path)
 
GpStatus WINGDIPAPI GdipDrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path)
 
GpStatus WINGDIPAPI GdipDrawPie (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
 
GpStatus WINGDIPAPI GdipDrawPieI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
 
GpStatus WINGDIPAPI GdipDrawRectangle (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height)
 
GpStatus WINGDIPAPI GdipDrawRectangleI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height)
 
GpStatus WINGDIPAPI GdipDrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, INT count)
 
GpStatus WINGDIPAPI GdipDrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, INT count)
 
GpStatus WINGDIPAPI GdipFillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count, REAL tension, GpFillMode fill)
 
GpStatus WINGDIPAPI GdipFillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count, REAL tension, GpFillMode fill)
 
GpStatus WINGDIPAPI GdipFillClosedCurve (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count)
 
GpStatus WINGDIPAPI GdipFillClosedCurveI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count)
 
GpStatus WINGDIPAPI GdipFillEllipse (GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height)
 
GpStatus WINGDIPAPI GdipFillEllipseI (GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height)
 
static GpStatus GDI32_GdipFillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path)
 
static GpStatus SOFTWARE_GdipFillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path)
 
GpStatus WINGDIPAPI GdipFillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path)
 
GpStatus WINGDIPAPI GdipFillPie (GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
 
GpStatus WINGDIPAPI GdipFillPieI (GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
 
GpStatus WINGDIPAPI GdipFillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count, GpFillMode fillMode)
 
GpStatus WINGDIPAPI GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count, GpFillMode fillMode)
 
GpStatus WINGDIPAPI GdipFillPolygon2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count)
 
GpStatus WINGDIPAPI GdipFillPolygon2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count)
 
GpStatus WINGDIPAPI GdipFillRectangle (GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height)
 
GpStatus WINGDIPAPI GdipFillRectangleI (GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height)
 
GpStatus WINGDIPAPI GdipFillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, INT count)
 
GpStatus WINGDIPAPI GdipFillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, INT count)
 
static GpStatus GDI32_GdipFillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region)
 
static GpStatus SOFTWARE_GdipFillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region)
 
GpStatus WINGDIPAPI GdipFillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region)
 
GpStatus WINGDIPAPI GdipFlush (GpGraphics *graphics, GpFlushIntention intention)
 
GpStatus WINGDIPAPI GdipGetClipBounds (GpGraphics *graphics, GpRectF *rect)
 
GpStatus WINGDIPAPI GdipGetClipBoundsI (GpGraphics *graphics, GpRect *rect)
 
GpStatus WINGDIPAPI GdipGetCompositingMode (GpGraphics *graphics, CompositingMode *mode)
 
GpStatus WINGDIPAPI GdipGetCompositingQuality (GpGraphics *graphics, CompositingQuality *quality)
 
GpStatus WINGDIPAPI GdipGetInterpolationMode (GpGraphics *graphics, InterpolationMode *mode)
 
GpStatus WINGDIPAPI GdipGetNearestColor (GpGraphics *graphics, ARGB *argb)
 
GpStatus WINGDIPAPI GdipGetPageScale (GpGraphics *graphics, REAL *scale)
 
GpStatus WINGDIPAPI GdipGetPageUnit (GpGraphics *graphics, GpUnit *unit)
 
GpStatus WINGDIPAPI GdipGetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode *mode)
 
GpStatus WINGDIPAPI GdipGetSmoothingMode (GpGraphics *graphics, SmoothingMode *mode)
 
GpStatus WINGDIPAPI GdipGetTextContrast (GpGraphics *graphics, UINT *contrast)
 
GpStatus WINGDIPAPI GdipGetTextRenderingHint (GpGraphics *graphics, TextRenderingHint *hint)
 
GpStatus WINGDIPAPI GdipGetVisibleClipBounds (GpGraphics *graphics, GpRectF *rect)
 
GpStatus WINGDIPAPI GdipGetVisibleClipBoundsI (GpGraphics *graphics, GpRect *rect)
 
GpStatus WINGDIPAPI GdipGetWorldTransform (GpGraphics *graphics, GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipGraphicsClear (GpGraphics *graphics, ARGB color)
 
GpStatus WINGDIPAPI GdipIsClipEmpty (GpGraphics *graphics, BOOL *res)
 
GpStatus WINGDIPAPI GdipIsVisiblePoint (GpGraphics *graphics, REAL x, REAL y, BOOL *result)
 
GpStatus WINGDIPAPI GdipIsVisiblePointI (GpGraphics *graphics, INT x, INT y, BOOL *result)
 
GpStatus WINGDIPAPI GdipIsVisibleRect (GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, BOOL *result)
 
GpStatus WINGDIPAPI GdipIsVisibleRectI (GpGraphics *graphics, INT x, INT y, INT width, INT height, BOOL *result)
 
GpStatus gdip_format_string (HDC hdc, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data)
 
static GpStatus measure_ranges_callback (HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data)
 
GpStatus WINGDIPAPI GdipMeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, INT regionCount, GpRegion **regions)
 
static GpStatus measure_string_callback (HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data)
 
GpStatus WINGDIPAPI GdipMeasureString (GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, RectF *bounds, INT *codepointsfitted, INT *linesfilled)
 
static GpStatus draw_string_callback (HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data)
 
GpStatus WINGDIPAPI GdipDrawString (GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush)
 
GpStatus WINGDIPAPI GdipResetClip (GpGraphics *graphics)
 
GpStatus WINGDIPAPI GdipResetWorldTransform (GpGraphics *graphics)
 
GpStatus WINGDIPAPI GdipRotateWorldTransform (GpGraphics *graphics, REAL angle, GpMatrixOrder order)
 
static GpStatus begin_container (GpGraphics *graphics, GraphicsContainerType type, GraphicsContainer *state)
 
GpStatus WINGDIPAPI GdipSaveGraphics (GpGraphics *graphics, GraphicsState *state)
 
GpStatus WINGDIPAPI GdipBeginContainer2 (GpGraphics *graphics, GraphicsContainer *state)
 
GpStatus WINGDIPAPI GdipBeginContainer (GpGraphics *graphics, GDIPCONST GpRectF *dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state)
 
GpStatus WINGDIPAPI GdipBeginContainerI (GpGraphics *graphics, GDIPCONST GpRect *dstrect, GDIPCONST GpRect *srcrect, GpUnit unit, GraphicsContainer *state)
 
GpStatus WINGDIPAPI GdipComment (GpGraphics *graphics, UINT sizeData, GDIPCONST BYTE *data)
 
static GpStatus end_container (GpGraphics *graphics, GraphicsContainerType type, GraphicsContainer state)
 
GpStatus WINGDIPAPI GdipEndContainer (GpGraphics *graphics, GraphicsContainer state)
 
GpStatus WINGDIPAPI GdipRestoreGraphics (GpGraphics *graphics, GraphicsState state)
 
GpStatus WINGDIPAPI GdipScaleWorldTransform (GpGraphics *graphics, REAL sx, REAL sy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipSetClipGraphics (GpGraphics *graphics, GpGraphics *srcgraphics, CombineMode mode)
 
GpStatus WINGDIPAPI GdipSetCompositingMode (GpGraphics *graphics, CompositingMode mode)
 
GpStatus WINGDIPAPI GdipSetCompositingQuality (GpGraphics *graphics, CompositingQuality quality)
 
GpStatus WINGDIPAPI GdipSetInterpolationMode (GpGraphics *graphics, InterpolationMode mode)
 
GpStatus WINGDIPAPI GdipSetPageScale (GpGraphics *graphics, REAL scale)
 
GpStatus WINGDIPAPI GdipSetPageUnit (GpGraphics *graphics, GpUnit unit)
 
GpStatus WINGDIPAPI GdipSetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode mode)
 
GpStatus WINGDIPAPI GdipSetRenderingOrigin (GpGraphics *graphics, INT x, INT y)
 
GpStatus WINGDIPAPI GdipGetRenderingOrigin (GpGraphics *graphics, INT *x, INT *y)
 
GpStatus WINGDIPAPI GdipSetSmoothingMode (GpGraphics *graphics, SmoothingMode mode)
 
GpStatus WINGDIPAPI GdipSetTextContrast (GpGraphics *graphics, UINT contrast)
 
GpStatus WINGDIPAPI GdipSetTextRenderingHint (GpGraphics *graphics, TextRenderingHint hint)
 
GpStatus WINGDIPAPI GdipSetWorldTransform (GpGraphics *graphics, GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipTranslateWorldTransform (GpGraphics *graphics, REAL dx, REAL dy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipSetClipHrgn (GpGraphics *graphics, HRGN hrgn, CombineMode mode)
 
GpStatus WINGDIPAPI GdipSetClipPath (GpGraphics *graphics, GpPath *path, CombineMode mode)
 
GpStatus WINGDIPAPI GdipSetClipRect (GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, CombineMode mode)
 
GpStatus WINGDIPAPI GdipSetClipRectI (GpGraphics *graphics, INT x, INT y, INT width, INT height, CombineMode mode)
 
GpStatus WINGDIPAPI GdipSetClipRegion (GpGraphics *graphics, GpRegion *region, CombineMode mode)
 
GpStatus WINGDIPAPI GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count)
 
GpStatus WINGDIPAPI GdipDrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count)
 
GpStatus WINGDIPAPI GdipGetDpiX (GpGraphics *graphics, REAL *dpi)
 
GpStatus WINGDIPAPI GdipGetDpiY (GpGraphics *graphics, REAL *dpi)
 
GpStatus WINGDIPAPI GdipMultiplyWorldTransform (GpGraphics *graphics, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipGetDC (GpGraphics *graphics, HDC *hdc)
 
GpStatus WINGDIPAPI GdipReleaseDC (GpGraphics *graphics, HDC hdc)
 
GpStatus WINGDIPAPI GdipGetClip (GpGraphics *graphics, GpRegion *region)
 
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)
 
GpStatus WINGDIPAPI GdipTransformPoints (GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
 
GpStatus WINGDIPAPI GdipTransformPointsI (GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPoint *points, INT count)
 
HPALETTE WINGDIPAPI GdipCreateHalftonePalette (void)
 
GpStatus WINGDIPAPI GdipTranslateClip (GpGraphics *graphics, REAL dx, REAL dy)
 
GpStatus WINGDIPAPI GdipTranslateClipI (GpGraphics *graphics, INT dx, INT dy)
 
GpStatus WINGDIPAPI GdipMeasureDriverString (GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix, RectF *boundingBox)
 
static GpStatus GDI32_GdipDrawDriverString (GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix)
 
static GpStatus SOFTWARE_GdipDrawDriverString (GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipDrawDriverString (GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipIsVisibleClipEmpty (GpGraphics *graphics, BOOL *res)
 
GpStatus WINGDIPAPI GdipResetPageTransform (GpGraphics *graphics)
 
GpStatus WINGDIPAPI GdipGraphicsSetAbort (GpGraphics *graphics, GdiplusAbort *pabort)
 

Variables

static volatile LONG g_priv_contid = GDIP_CONTID_STEP
 
static const COLORREF DC_BACKGROUND_KEY = 0x0c0b0d
 

Macro Definition Documentation

◆ ANCHOR_WIDTH

#define ANCHOR_WIDTH   (2.0)

Definition at line 67 of file graphics.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 29 of file graphics.c.

◆ fmax

#define fmax   max

Definition at line 64 of file graphics.c.

◆ GDIP_CONTID_STEP

#define GDIP_CONTID_STEP   64

Definition at line 57 of file graphics.c.

◆ GDIP_GET_NEW_CONTID_FOR

#define GDIP_GET_NEW_CONTID_FOR (   pGpGraphics)    (UINT)(InterlockedExchangeAdd(&g_priv_contid,GDIP_CONTID_STEP))

Definition at line 59 of file graphics.c.

◆ MAX_ITERS

#define MAX_ITERS   (50)

Definition at line 68 of file graphics.c.

Typedef Documentation

◆ GraphicsContainerItem

◆ GraphicsContainerType

Enumeration Type Documentation

◆ GraphicsContainerType

Enumerator
BEGIN_CONTAINER 
SAVE_GRAPHICS 

Definition at line 2098 of file graphics.c.

2098  {
GraphicsContainerType
Definition: graphics.c:2098

Function Documentation

◆ alpha_blend_bmp_pixels()

static GpStatus alpha_blend_bmp_pixels ( GpGraphics graphics,
INT  dst_x,
INT  dst_y,
const BYTE src,
INT  src_width,
INT  src_height,
INT  src_stride,
const PixelFormat  fmt 
)
static

Definition at line 392 of file graphics.c.

394 {
395  GpBitmap *dst_bitmap = (GpBitmap*)graphics->image;
396  INT x, y;
397 
398  for (y=0; y<src_height; y++)
399  {
400  for (x=0; x<src_width; x++)
401  {
402  ARGB dst_color, src_color;
403  src_color = ((ARGB*)(src + src_stride * y))[x];
404 
405  if (!(src_color & 0xff000000))
406  continue;
407 
408  GdipBitmapGetPixel(dst_bitmap, x+dst_x, y+dst_y, &dst_color);
409  if (fmt & PixelFormatPAlpha)
410  GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over_fgpremult(dst_color, src_color));
411  else
412  GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over(dst_color, src_color));
413  }
414  }
415 
416  return Ok;
417 }
static ARGB color_over(ARGB bg, ARGB fg)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap *bitmap, INT x, INT y, ARGB color)
Definition: image.c:494
int32_t INT
Definition: typedefs.h:56
GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap *bitmap, INT x, INT y, ARGB *color)
Definition: image.c:288
#define PixelFormatPAlpha
#define for
Definition: utility.h:88
GpImage * image
GLenum src
Definition: glext.h:6340
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
Definition: dsound.c:943
static ARGB color_over_fgpremult(ARGB bg, ARGB fg)
DWORD ARGB

Referenced by alpha_blend_pixels_hrgn().

◆ alpha_blend_hdc_pixels()

static GpStatus alpha_blend_hdc_pixels ( GpGraphics graphics,
INT  dst_x,
INT  dst_y,
const BYTE src,
INT  src_width,
INT  src_height,
INT  src_stride,
PixelFormat  fmt 
)
static

Definition at line 419 of file graphics.c.

421 {
422  HDC hdc;
424  BITMAPINFOHEADER bih;
425  BYTE *temp_bits;
426 
427  hdc = CreateCompatibleDC(0);
428 
429  bih.biSize = sizeof(BITMAPINFOHEADER);
430  bih.biWidth = src_width;
431  bih.biHeight = -src_height;
432  bih.biPlanes = 1;
433  bih.biBitCount = 32;
434  bih.biCompression = BI_RGB;
435  bih.biSizeImage = 0;
436  bih.biXPelsPerMeter = 0;
437  bih.biYPelsPerMeter = 0;
438  bih.biClrUsed = 0;
439  bih.biClrImportant = 0;
440 
442  (void**)&temp_bits, NULL, 0);
443 
444  if ((GetDeviceCaps(graphics->hdc, TECHNOLOGY) == DT_RASPRINTER &&
445  GetDeviceCaps(graphics->hdc, SHADEBLENDCAPS) == SB_NONE) ||
447  memcpy(temp_bits, src, src_width * src_height * 4);
448  else
449  convert_32bppARGB_to_32bppPARGB(src_width, src_height, temp_bits,
450  4 * src_width, src, src_stride);
451 
453  gdi_alpha_blend(graphics, dst_x, dst_y, src_width, src_height,
454  hdc, 0, 0, src_width, src_height);
455  DeleteDC(hdc);
457 
458  return Ok;
459 }
DWORD biClrImportant
Definition: amvideo.idl:40
LONG biXPelsPerMeter
Definition: amvideo.idl:37
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG biYPelsPerMeter
Definition: amvideo.idl:38
#define TECHNOLOGY
Definition: wingdi.h:705
void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height, BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride)
Definition: gdiplus.c:435
#define PixelFormatPAlpha
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
#define DT_RASPRINTER
Definition: wingdi.h:708
DWORD biSizeImage
Definition: amvideo.idl:36
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
static void gdi_alpha_blend(GpGraphics *graphics, INT dst_x, INT dst_y, INT dst_width, INT dst_height, HDC hdc, INT src_x, INT src_y, INT src_width, INT src_height)
Definition: graphics.c:326
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
static HBITMAP hbitmap
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define BI_RGB
Definition: precomp.h:35
Definition: dsound.c:943

Referenced by alpha_blend_pixels_hrgn().

◆ alpha_blend_pixels()

static GpStatus alpha_blend_pixels ( GpGraphics graphics,
INT  dst_x,
INT  dst_y,
const BYTE src,
INT  src_width,
INT  src_height,
INT  src_stride,
PixelFormat  fmt 
)
static

Definition at line 554 of file graphics.c.

556 {
557  return alpha_blend_pixels_hrgn(graphics, dst_x, dst_y, src, src_width, src_height, src_stride, NULL, fmt);
558 }
smooth NULL
Definition: ftsmooth.c:416
GLenum src
Definition: glext.h:6340
static GpStatus alpha_blend_pixels_hrgn(GpGraphics *graphics, INT dst_x, INT dst_y, const BYTE *src, INT src_width, INT src_height, INT src_stride, HRGN hregion, PixelFormat fmt)
Definition: graphics.c:461
Definition: dsound.c:943

Referenced by GdipDrawImagePointsRect(), GdipReleaseDC(), SOFTWARE_GdipDrawDriverString(), and SOFTWARE_GdipDrawThinPath().

◆ alpha_blend_pixels_hrgn()

static GpStatus alpha_blend_pixels_hrgn ( GpGraphics graphics,
INT  dst_x,
INT  dst_y,
const BYTE src,
INT  src_width,
INT  src_height,
INT  src_stride,
HRGN  hregion,
PixelFormat  fmt 
)
static

Definition at line 461 of file graphics.c.

463 {
464  GpStatus stat=Ok;
465 
466  if (graphics->image && graphics->image->type == ImageTypeBitmap)
467  {
468  DWORD i;
469  int size;
470  RGNDATA *rgndata;
471  RECT *rects;
472  HRGN hrgn, visible_rgn;
473 
474  hrgn = CreateRectRgn(dst_x, dst_y, dst_x + src_width, dst_y + src_height);
475  if (!hrgn)
476  return OutOfMemory;
477 
478  stat = get_clip_hrgn(graphics, &visible_rgn);
479  if (stat != Ok)
480  {
482  return stat;
483  }
484 
485  if (visible_rgn)
486  {
487  CombineRgn(hrgn, hrgn, visible_rgn, RGN_AND);
488  DeleteObject(visible_rgn);
489  }
490 
491  if (hregion)
492  CombineRgn(hrgn, hrgn, hregion, RGN_AND);
493 
494  size = GetRegionData(hrgn, 0, NULL);
495 
496  rgndata = heap_alloc_zero(size);
497  if (!rgndata)
498  {
500  return OutOfMemory;
501  }
502 
503  GetRegionData(hrgn, size, rgndata);
504 
505  rects = (RECT*)rgndata->Buffer;
506 
507  for (i=0; stat == Ok && i<rgndata->rdh.nCount; i++)
508  {
509  stat = alpha_blend_bmp_pixels(graphics, rects[i].left, rects[i].top,
510  &src[(rects[i].left - dst_x) * 4 + (rects[i].top - dst_y) * src_stride],
511  rects[i].right - rects[i].left, rects[i].bottom - rects[i].top,
512  src_stride, fmt);
513  }
514 
515  heap_free(rgndata);
516 
518 
519  return stat;
520  }
521  else if (graphics->image && graphics->image->type == ImageTypeMetafile)
522  {
523  ERR("This should not be used for metafiles; fix caller\n");
524  return NotImplemented;
525  }
526  else
527  {
528  HRGN hrgn;
529  int save;
530 
531  stat = get_clip_hrgn(graphics, &hrgn);
532 
533  if (stat != Ok)
534  return stat;
535 
536  save = SaveDC(graphics->hdc);
537 
538  ExtSelectClipRgn(graphics->hdc, hrgn, RGN_COPY);
539 
540  if (hregion)
541  ExtSelectClipRgn(graphics->hdc, hregion, RGN_AND);
542 
543  stat = alpha_blend_hdc_pixels(graphics, dst_x, dst_y, src, src_width,
544  src_height, src_stride, fmt);
545 
546  RestoreDC(graphics->hdc, save);
547 
549 
550  return stat;
551  }
552 }
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
static GpStatus alpha_blend_bmp_pixels(GpGraphics *graphics, INT dst_x, INT dst_y, const BYTE *src, INT src_width, INT src_height, INT src_stride, const PixelFormat fmt)
Definition: graphics.c:392
static GpStatus alpha_blend_hdc_pixels(GpGraphics *graphics, INT dst_x, INT dst_y, const BYTE *src, INT src_width, INT src_height, INT src_stride, PixelFormat fmt)
Definition: graphics.c:419
char Buffer[1]
Definition: axextend.idl:395
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
ImageType type
#define RGN_AND
Definition: wingdi.h:355
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
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
static GpStatus get_clip_hrgn(GpGraphics *graphics, HRGN *hrgn)
Definition: graphics.c:351
smooth NULL
Definition: ftsmooth.c:416
GLint GLint bottom
Definition: glext.h:7726
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
GLsizeiptr size
Definition: glext.h:5919
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
GpImage * image
static HRGN hrgn
Definition: win.c:55
Definition: stat.h:55
GLenum src
Definition: glext.h:6340
Status
Definition: gdiplustypes.h:24
#define RGN_COPY
Definition: wingdi.h:356
#define ERR(fmt,...)
Definition: debug.h:109
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
int WINAPI SaveDC(_In_ HDC)
RGNDATAHEADER rdh
Definition: axextend.idl:394
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
Definition: dsound.c:943
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by alpha_blend_pixels(), and SOFTWARE_GdipFillRegion().

◆ apply_image_attributes()

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

Definition at line 710 of file graphics.c.

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

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

◆ begin_container()

static GpStatus begin_container ( GpGraphics graphics,
GraphicsContainerType  type,
GraphicsContainer state 
)
static

Definition at line 5885 of file graphics.c.

5887 {
5889  GpStatus sts;
5890 
5891  if(!graphics || !state)
5892  return InvalidParameter;
5893 
5894  sts = init_container(&container, graphics, type);
5895  if(sts != Ok)
5896  return sts;
5897 
5898  list_add_head(&graphics->containers, &container->entry);
5899  *state = graphics->contid = container->contid;
5900 
5901  if (graphics->image && graphics->image->type == ImageTypeMetafile) {
5902  if (type == BEGIN_CONTAINER)
5904  else
5905  METAFILE_SaveGraphics((GpMetafile*)graphics->image, container->contid);
5906  }
5907 
5908  return Ok;
5909 }
static GpStatus init_container(GraphicsContainerItem **container, GDIPCONST GpGraphics *graphics, GraphicsContainerType type)
Definition: graphics.c:2122
GpStatus METAFILE_BeginContainerNoParams(GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
Definition: metafile.c:1400
struct list entry
Definition: metafile.c:154
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
GpStatus METAFILE_SaveGraphics(GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
Definition: metafile.c:1446
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GraphicsContainer contid
ImageType type
struct container container
struct list containers
GpImage * image
static int state
Definition: maze.c:121
Status
Definition: gdiplustypes.h:24

Referenced by GdipBeginContainer2(), and GdipSaveGraphics().

◆ blend_colors()

static ARGB blend_colors ( ARGB  start,
ARGB  end,
REAL  position 
)
static

Definition at line 571 of file graphics.c.

572 {
573  INT start_a, end_a, final_a;
574  INT pos;
575 
576  pos = (INT)(position * 255.0f + 0.5f);
577 
578  start_a = ((start >> 24) & 0xff) * (pos ^ 0xff);
579  end_a = ((end >> 24) & 0xff) * pos;
580 
581  final_a = start_a + end_a;
582 
583  if (final_a < 0xff) return 0;
584 
585  return (final_a / 0xff) << 24 |
586  ((((start >> 16) & 0xff) * start_a + (((end >> 16) & 0xff) * end_a)) / final_a) << 16 |
587  ((((start >> 8) & 0xff) * start_a + (((end >> 8) & 0xff) * end_a)) / final_a) << 8 |
588  (((start & 0xff) * start_a + ((end & 0xff) * end_a)) / final_a);
589 }
#define INT
Definition: polytest.cpp:20
GLuint GLuint end
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
GLfloat f
Definition: glext.h:7540
GLuint start
Definition: gl.h:1545

Referenced by blend_line_gradient(), brush_fill_pixels(), and resample_bitmap_pixel().

◆ blend_colors_premult()

static ARGB blend_colors_premult ( ARGB  start,
ARGB  end,
REAL  position 
)
inlinestatic

Definition at line 561 of file graphics.c.

562 {
563  UINT pos = position * 255.0f + 0.5f;
564  return
565  (((((start >> 24) ) << 8) + (((end >> 24) ) - ((start >> 24) )) * pos) >> 8) << 24 |
566  (((((start >> 16) & 0xff) << 8) + (((end >> 16) & 0xff) - ((start >> 16) & 0xff)) * pos) >> 8) << 16 |
567  (((((start >> 8) & 0xff) << 8) + (((end >> 8) & 0xff) - ((start >> 8) & 0xff)) * pos) >> 8) << 8 |
568  (((((start ) & 0xff) << 8) + (((end ) & 0xff) - ((start ) & 0xff)) * pos) >> 8);
569 }
GLuint GLuint end
Definition: gl.h:1545
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50

Referenced by resample_bitmap_pixel_premult().

◆ blend_line_gradient()

static ARGB blend_line_gradient ( GpLineGradient brush,
REAL  position 
)
static

Definition at line 591 of file graphics.c.

592 {
593  REAL blendfac;
594 
595  /* clamp to between 0.0 and 1.0, using the wrap mode */
596  position = (position - brush->rect.X) / brush->rect.Width;
597  if (brush->wrap == WrapModeTile)
598  {
599  position = fmodf(position, 1.0f);
600  if (position < 0.0f) position += 1.0f;
601  }
602  else /* WrapModeFlip* */
603  {
604  position = fmodf(position, 2.0f);
605  if (position < 0.0f) position += 2.0f;
606  if (position > 1.0f) position = 2.0f - position;
607  }
608 
609  if (brush->blendcount == 1)
610  blendfac = position;
611  else
612  {
613  int i=1;
614  REAL left_blendpos, left_blendfac, right_blendpos, right_blendfac;
615  REAL range;
616 
617  /* locate the blend positions surrounding this position */
618  while (position > brush->blendpos[i])
619  i++;
620 
621  /* interpolate between the blend positions */
622  left_blendpos = brush->blendpos[i-1];
623  left_blendfac = brush->blendfac[i-1];
624  right_blendpos = brush->blendpos[i];
625  right_blendfac = brush->blendfac[i];
626  range = right_blendpos - left_blendpos;
627  blendfac = (left_blendfac * (right_blendpos - position) +
628  right_blendfac * (position - left_blendpos)) / range;
629  }
630 
631  if (brush->pblendcount == 0)
632  return blend_colors(brush->startcolor, brush->endcolor, blendfac);
633  else
634  {
635  int i=1;
636  ARGB left_blendcolor, right_blendcolor;
637  REAL left_blendpos, right_blendpos;
638 
639  /* locate the blend colors surrounding this position */
640  while (blendfac > brush->pblendpos[i])
641  i++;
642 
643  /* interpolate between the blend colors */
644  left_blendpos = brush->pblendpos[i-1];
645  left_blendcolor = brush->pblendcolor[i-1];
646  right_blendpos = brush->pblendpos[i];
647  right_blendcolor = brush->pblendcolor[i];
648  blendfac = (blendfac - left_blendpos) / (right_blendpos - left_blendpos);
649  return blend_colors(left_blendcolor, right_blendcolor, blendfac);
650  }
651 }
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
GLfloat f
Definition: glext.h:7540
if(!(yy_init))
Definition: macro.lex.yy.c:714
REAL X
Definition: gdiplustypes.h:261
_Check_return_ __CRT_INLINE float fmodf(_In_ float x, _In_ float y)
Definition: math.h:212
GLenum GLint * range
Definition: glext.h:7539
REAL Width
Definition: gdiplustypes.h:263
static ARGB blend_colors(ARGB start, ARGB end, REAL position)
Definition: graphics.c:571
float REAL
Definition: types.h:41
DWORD ARGB

Referenced by brush_fill_pixels().

◆ brush_can_fill_path()

static BOOL brush_can_fill_path ( GpBrush brush,
BOOL  is_fill 
)
static

Definition at line 1131 of file graphics.c.

1132 {
1133  switch (brush->bt)
1134  {
1135  case BrushTypeSolidColor:
1136  {
1137  if (is_fill)
1138  return TRUE;
1139  else
1140  {
1141  /* cannot draw semi-transparent colors */
1142  return (((GpSolidFill*)brush)->color & 0xff000000) == 0xff000000;
1143  }
1144  }
1145  case BrushTypeHatchFill:
1146  {
1147  GpHatch *hatch = (GpHatch*)brush;
1148  return ((hatch->forecol & 0xff000000) == 0xff000000) &&
1149  ((hatch->backcol & 0xff000000) == 0xff000000);
1150  }
1152  case BrushTypeTextureFill:
1153  /* Gdi32 isn't much help with these, so we should use brush_fill_pixels instead. */
1154  default:
1155  return FALSE;
1156  }
1157 }
#define TRUE
Definition: types.h:120
GpBrushType bt
GLuint color
Definition: glext.h:6243

Referenced by GDI32_GdipFillPath(), GDI32_GdipFillRegion(), and GdipDrawPath().

◆ brush_can_fill_pixels()

static BOOL brush_can_fill_pixels ( GpBrush brush)
static

Definition at line 1224 of file graphics.c.

1225 {
1226  switch (brush->bt)
1227  {
1228  case BrushTypeSolidColor:
1229  case BrushTypeHatchFill:
1231  case BrushTypeTextureFill:
1232  case BrushTypePathGradient:
1233  return TRUE;
1234  default:
1235  return FALSE;
1236  }
1237 }
#define TRUE
Definition: types.h:120
GpBrushType bt

Referenced by SOFTWARE_GdipFillPath(), and SOFTWARE_GdipFillRegion().

◆ brush_fill_path()

static GpStatus brush_fill_path ( GpGraphics graphics,
GpBrush brush 
)
static

Definition at line 1159 of file graphics.c.

1160 {
1161  GpStatus status = Ok;
1162  switch (brush->bt)
1163  {
1164  case BrushTypeSolidColor:
1165  {
1166  GpSolidFill *fill = (GpSolidFill*)brush;
1167  HBITMAP bmp = ARGB2BMP(fill->color);
1168 
1169  if (bmp)
1170  {
1171  RECT rc;
1172  /* partially transparent fill */
1173 
1174  if (!SelectClipPath(graphics->hdc, RGN_AND))
1175  {
1176  status = GenericError;
1177  DeleteObject(bmp);
1178  break;
1179  }
1180  if (GetClipBox(graphics->hdc, &rc) != NULLREGION)
1181  {
1183 
1184  if (!hdc)
1185  {
1186  status = OutOfMemory;
1187  DeleteObject(bmp);
1188  break;
1189  }
1190 
1191  SelectObject(hdc, bmp);
1192  gdi_alpha_blend(graphics, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
1193  hdc, 0, 0, 1, 1);
1194  DeleteDC(hdc);
1195  }
1196 
1197  DeleteObject(bmp);
1198  break;
1199  }
1200  /* else fall through */
1201  }
1202  default:
1203  {
1204  HBRUSH gdibrush, old_brush;
1205 
1206  gdibrush = create_gdi_brush(brush);
1207  if (!gdibrush)
1208  {
1209  status = OutOfMemory;
1210  break;
1211  }
1212 
1213  old_brush = SelectObject(graphics->hdc, gdibrush);
1214  FillPath(graphics->hdc);
1215  SelectObject(graphics->hdc, old_brush);
1216  DeleteObject(gdibrush);
1217  break;
1218  }
1219  }
1220 
1221  return status;
1222 }
static HDC
Definition: imagelist.c:92
BOOL WINAPI SelectClipPath(_In_ HDC, _In_ int)
#define NULLREGION
Definition: wingdi.h:360
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
GpBrushType bt
#define RGN_AND
Definition: wingdi.h:355
HBITMAP ARGB2BMP(ARGB color)
Definition: gdiplus.c:272
smooth NULL
Definition: ftsmooth.c:416
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
BITMAP bmp
Definition: alphablend.c:62
HDC hdc
Definition: main.c:9
Status
Definition: gdiplustypes.h:24
static void gdi_alpha_blend(GpGraphics *graphics, INT dst_x, INT dst_y, INT dst_width, INT dst_height, HDC hdc, INT src_x, INT src_y, INT src_width, INT src_height)
Definition: graphics.c:326
BOOL WINAPI DeleteDC(_In_ HDC)
LONG bottom
Definition: windef.h:294
static HBRUSH create_gdi_brush(const GpBrush *brush)
Definition: graphics.c:231
static HBITMAP
Definition: button.c:44
BOOL WINAPI FillPath(_In_ HDC)
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by GDI32_GdipFillPath(), and GDI32_GdipFillRegion().

◆ brush_fill_pixels()

static GpStatus brush_fill_pixels ( GpGraphics graphics,
GpBrush brush,
DWORD argb_pixels,
GpRect fill_area,
UINT  cdwStride 
)
static

Definition at line 1239 of file graphics.c.

1241 {
1242  switch (brush->bt)
1243  {
1244  case BrushTypeSolidColor:
1245  {
1246  int x, y;
1247  GpSolidFill *fill = (GpSolidFill*)brush;
1248  for (x=0; x<fill_area->Width; x++)
1249  for (y=0; y<fill_area->Height; y++)
1250  argb_pixels[x + y*cdwStride] = fill->color;
1251  return Ok;
1252  }
1253  case BrushTypeHatchFill:
1254  {
1255  int x, y;
1256  GpHatch *fill = (GpHatch*)brush;
1257  const char *hatch_data;
1258 
1259  if (get_hatch_data(fill->hatchstyle, &hatch_data) != Ok)
1260  return NotImplemented;
1261 
1262  for (x=0; x<fill_area->Width; x++)
1263  for (y=0; y<fill_area->Height; y++)
1264  {
1265  int hx, hy;
1266 
1267  /* FIXME: Account for the rendering origin */
1268  hx = (x + fill_area->X) % 8;
1269  hy = (y + fill_area->Y) % 8;
1270 
1271  if ((hatch_data[7-hy] & (0x80 >> hx)) != 0)
1272  argb_pixels[x + y*cdwStride] = fill->forecol;
1273  else
1274  argb_pixels[x + y*cdwStride] = fill->backcol;
1275  }
1276 
1277  return Ok;
1278  }
1280  {
1281  GpLineGradient *fill = (GpLineGradient*)brush;
1282  GpPointF draw_points[3];
1283  GpStatus stat;
1284  int x, y;
1285 
1286  draw_points[0].X = fill_area->X;
1287  draw_points[0].Y = fill_area->Y;
1288  draw_points[1].X = fill_area->X+1;
1289  draw_points[1].Y = fill_area->Y;
1290  draw_points[2].X = fill_area->X;
1291  draw_points[2].Y = fill_area->Y+1;
1292 
1293  /* Transform the points to a co-ordinate space where X is the point's
1294  * position in the gradient, 0.0 being the start point and 1.0 the
1295  * end point. */
1297  WineCoordinateSpaceGdiDevice, draw_points, 3);
1298 
1299  if (stat == Ok)
1300  {
1301  GpMatrix world_to_gradient = fill->transform;
1302 
1303  stat = GdipInvertMatrix(&world_to_gradient);
1304  if (stat == Ok)
1305  stat = GdipTransformMatrixPoints(&world_to_gradient, draw_points, 3);
1306  }
1307 
1308  if (stat == Ok)
1309  {
1310  REAL x_delta = draw_points[1].X - draw_points[0].X;
1311  REAL y_delta = draw_points[2].X - draw_points[0].X;
1312 
1313  for (y=0; y<fill_area->Height; y++)
1314  {
1315  for (x=0; x<fill_area->Width; x++)
1316  {
1317  REAL pos = draw_points[0].X + x * x_delta + y * y_delta;
1318 
1319  argb_pixels[x + y*cdwStride] = blend_line_gradient(fill, pos);
1320  }
1321  }
1322  }
1323 
1324  return stat;
1325  }
1326  case BrushTypeTextureFill:
1327  {
1328  GpTexture *fill = (GpTexture*)brush;
1329  GpPointF draw_points[3];
1330  GpStatus stat;
1331  int x, y;
1332  GpBitmap *bitmap;
1333  int src_stride;
1334  GpRect src_area;
1335 
1336  if (fill->image->type != ImageTypeBitmap)
1337  {
1338  FIXME("metafile texture brushes not implemented\n");
1339  return NotImplemented;
1340  }
1341 
1342  bitmap = (GpBitmap*)fill->image;
1343  src_stride = sizeof(ARGB) * bitmap->width;
1344 
1345  src_area.X = src_area.Y = 0;
1346  src_area.Width = bitmap->width;
1347  src_area.Height = bitmap->height;
1348 
1349  draw_points[0].X = fill_area->X;
1350  draw_points[0].Y = fill_area->Y;
1351  draw_points[1].X = fill_area->X+1;
1352  draw_points[1].Y = fill_area->Y;
1353  draw_points[2].X = fill_area->X;
1354  draw_points[2].Y = fill_area->Y+1;
1355 
1356  /* Transform the points to the co-ordinate space of the bitmap. */
1358  WineCoordinateSpaceGdiDevice, draw_points, 3);
1359 
1360  if (stat == Ok)
1361  {
1362  GpMatrix world_to_texture = fill->transform;
1363 
1364  stat = GdipInvertMatrix(&world_to_texture);
1365  if (stat == Ok)
1366  stat = GdipTransformMatrixPoints(&world_to_texture, draw_points, 3);
1367  }
1368 
1369  if (stat == Ok && !fill->bitmap_bits)
1370  {
1371  BitmapData lockeddata;
1372 
1373  fill->bitmap_bits = heap_alloc_zero(sizeof(ARGB) * bitmap->width * bitmap->height);
1374  if (!fill->bitmap_bits)
1375  stat = OutOfMemory;
1376 
1377  if (stat == Ok)
1378  {
1379  lockeddata.Width = bitmap->width;
1380  lockeddata.Height = bitmap->height;
1381  lockeddata.Stride = src_stride;
1382  lockeddata.PixelFormat = PixelFormat32bppARGB;
1383  lockeddata.Scan0 = fill->bitmap_bits;
1384 
1386  PixelFormat32bppARGB, &lockeddata);
1387  }
1388 
1389  if (stat == Ok)
1390  stat = GdipBitmapUnlockBits(bitmap, &lockeddata);
1391 
1392  if (stat == Ok)
1393  apply_image_attributes(fill->imageattributes, fill->bitmap_bits,
1395  src_stride, ColorAdjustTypeBitmap, lockeddata.PixelFormat);
1396 
1397  if (stat != Ok)
1398  {
1399  heap_free(fill->bitmap_bits);
1400  fill->bitmap_bits = NULL;
1401  }
1402  }
1403 
1404  if (stat == Ok)
1405  {
1406  REAL x_dx = draw_points[1].X - draw_points[0].X;
1407  REAL x_dy = draw_points[1].Y - draw_points[0].Y;
1408  REAL y_dx = draw_points[2].X - draw_points[0].X;
1409  REAL y_dy = draw_points[2].Y - draw_points[0].Y;
1410 
1411  for (y=0; y<fill_area->Height; y++)
1412  {
1413  for (x=0; x<fill_area->Width; x++)
1414  {
1415  GpPointF point;
1416  point.X = draw_points[0].X + x * x_dx + y * y_dx;
1417  point.Y = draw_points[0].Y + y * x_dy + y * y_dy;
1418 
1419  argb_pixels[x + y*cdwStride] = resample_bitmap_pixel(
1420  &src_area, fill->bitmap_bits, bitmap->width, bitmap->height,
1421  &point, fill->imageattributes, graphics->interpolation,
1422  graphics->pixeloffset);
1423  }
1424  }
1425  }
1426 
1427  return stat;
1428  }
1429  case BrushTypePathGradient:
1430  {
1431  GpPathGradient *fill = (GpPathGradient*)brush;
1432  GpPath *flat_path;
1433  GpMatrix world_to_device;
1434  GpStatus stat;
1435  int i, figure_start=0;
1436  GpPointF start_point, end_point, center_point;
1437  BYTE type;
1438  REAL min_yf, max_yf, line1_xf, line2_xf;
1439  INT min_y, max_y, min_x, max_x;
1440  INT x, y;
1441  ARGB outer_color;
1442  static BOOL transform_fixme_once;
1443 
1444  if (fill->focus.X != 0.0 || fill->focus.Y != 0.0)
1445  {
1446  static int once;
1447  if (!once++)
1448  FIXME("path gradient focus not implemented\n");
1449  }
1450 
1451  if (fill->gamma)
1452  {
1453  static int once;
1454  if (!once++)
1455  FIXME("path gradient gamma correction not implemented\n");
1456  }
1457 
1458  if (fill->blendcount)
1459  {
1460  static int once;
1461  if (!once++)
1462  FIXME("path gradient blend not implemented\n");
1463  }
1464 
1465  if (fill->pblendcount)
1466  {
1467  static int once;
1468  if (!once++)
1469  FIXME("path gradient preset blend not implemented\n");
1470  }
1471 
1472  if (!transform_fixme_once)
1473  {
1475  GdipIsMatrixIdentity(&fill->transform, &is_identity);
1476  if (!is_identity)
1477  {
1478  FIXME("path gradient transform not implemented\n");
1479  transform_fixme_once = TRUE;
1480  }
1481  }
1482 
1483  stat = GdipClonePath(fill->path, &flat_path);
1484 
1485  if (stat != Ok)
1486  return stat;
1487 
1489  CoordinateSpaceWorld, &world_to_device);
1490  if (stat == Ok)
1491  {
1492  stat = GdipTransformPath(flat_path, &world_to_device);
1493 
1494  if (stat == Ok)
1495  {
1496  center_point = fill->center;
1497  stat = GdipTransformMatrixPoints(&world_to_device, &center_point, 1);
1498  }
1499 
1500  if (stat == Ok)
1501  stat = GdipFlattenPath(flat_path, NULL, 0.5);
1502  }
1503 
1504  if (stat != Ok)
1505  {
1506  GdipDeletePath(flat_path);
1507  return stat;
1508  }
1509 
1510  for (i=0; i<flat_path->pathdata.Count; i++)
1511  {
1512  int start_center_line=0, end_center_line=0;
1513  BOOL seen_start = FALSE, seen_end = FALSE, seen_center = FALSE;
1514  REAL center_distance;
1515  ARGB start_color, end_color;
1516  REAL dy, dx;
1517 
1518  type = flat_path->pathdata.Types[i];
1519 
1521  figure_start = i;
1522 
1523  start_point = flat_path->pathdata.Points[i];
1524 
1525  start_color = fill->surroundcolors[min(i, fill->surroundcolorcount-1)];
1526 
1528  {
1529  end_point = flat_path->pathdata.Points[figure_start];
1530  end_color = fill->surroundcolors[min(figure_start, fill->surroundcolorcount-1)];
1531  }
1532  else if ((flat_path->pathdata.Types[i+1] & PathPointTypePathTypeMask) == PathPointTypeLine)
1533  {
1534  end_point = flat_path->pathdata.Points[i+1];
1535  end_color = fill->surroundcolors[min(i+1, fill->surroundcolorcount-1)];
1536  }
1537  else
1538  continue;
1539 
1540  outer_color = start_color;
1541 
1542  min_yf = center_point.Y;
1543  if (min_yf > start_point.Y) min_yf = start_point.Y;
1544  if (min_yf > end_point.Y) min_yf = end_point.Y;
1545 
1546  if (min_yf < fill_area->Y)
1547  min_y = fill_area->Y;
1548  else
1549  min_y = (INT)ceil(min_yf);
1550 
1551  max_yf = center_point.Y;
1552  if (max_yf < start_point.Y) max_yf = start_point.Y;
1553  if (max_yf < end_point.Y) max_yf = end_point.Y;
1554 
1555  if (max_yf > fill_area->Y + fill_area->Height)
1556  max_y = fill_area->Y + fill_area->Height;
1557  else
1558  max_y = (INT)ceil(max_yf);
1559 
1560  dy = end_point.Y - start_point.Y;
1561  dx = end_point.X - start_point.X;
1562 
1563  /* This is proportional to the distance from start-end line to center point. */
1564  center_distance = dy * (start_point.X - center_point.X) +
1565  dx * (center_point.Y - start_point.Y);
1566 
1567  for (y=min_y; y<max_y; y++)
1568  {
1569  REAL yf = (REAL)y;
1570 
1571  if (!seen_start && yf >= start_point.Y)
1572  {
1573  seen_start = TRUE;
1574  start_center_line ^= 1;
1575  }
1576  if (!seen_end && yf >= end_point.Y)
1577  {
1578  seen_end = TRUE;
1579  end_center_line ^= 1;
1580  }
1581  if (!seen_center && yf >= center_point.Y)
1582  {
1583  seen_center = TRUE;
1584  start_center_line ^= 1;
1585  end_center_line ^= 1;
1586  }
1587 
1588  if (start_center_line)
1589  line1_xf = intersect_line_scanline(&start_point, &center_point, yf);
1590  else
1591  line1_xf = intersect_line_scanline(&start_point, &end_point, yf);
1592 
1593  if (end_center_line)
1594  line2_xf = intersect_line_scanline(&end_point, &center_point, yf);
1595  else
1596  line2_xf = intersect_line_scanline(&start_point, &end_point, yf);
1597 
1598  if (line1_xf < line2_xf)
1599  {
1600  min_x = (INT)ceil(line1_xf);
1601  max_x = (INT)ceil(line2_xf);
1602  }
1603  else
1604  {
1605  min_x = (INT)ceil(line2_xf);
1606  max_x = (INT)ceil(line1_xf);
1607  }
1608 
1609  if (min_x < fill_area->X)
1610  min_x = fill_area->X;
1611  if (max_x > fill_area->X + fill_area->Width)
1612  max_x = fill_area->X + fill_area->Width;
1613 
1614  for (x=min_x; x<max_x; x++)
1615  {
1616  REAL xf = (REAL)x;
1617  REAL distance;
1618 
1619  if (start_color != end_color)
1620  {
1621  REAL blend_amount, pdy, pdx;
1622  pdy = yf - center_point.Y;
1623  pdx = xf - center_point.X;
1624 
1625  if (fabs(pdx) <= 0.001 && fabs(pdy) <= 0.001)
1626  {
1627  /* Too close to center point, don't try to calculate outer color */
1628  outer_color = start_color;
1629  }
1630  else
1631  {
1632  blend_amount = ( (center_point.Y - start_point.Y) * pdx + (start_point.X - center_point.X) * pdy ) / ( dy * pdx - dx * pdy );
1633  outer_color = blend_colors(start_color, end_color, blend_amount);
1634  }
1635  }
1636 
1637  distance = (end_point.Y - start_point.Y) * (start_point.X - xf) +
1638  (end_point.X - start_point.X) * (yf - start_point.Y);
1639 
1640  distance = distance / center_distance;
1641 
1642  argb_pixels[(x-fill_area->X) + (y-fill_area->Y)*cdwStride] =
1643  blend_colors(outer_color, fill->centercolor, distance);
1644  }
1645  }
1646  }
1647 
1648  GdipDeletePath(flat_path);
1649  return stat;
1650  }
1651  default:
1652  return NotImplemented;
1653  }
1654 }
_Check_return_ _CRTIMP double __cdecl ceil(_In_ double x)
static REAL intersect_line_scanline(const GpPointF *p1, const GpPointF *p2, REAL y)
Definition: graphics.c:1125
#define TRUE
Definition: types.h:120
static ARGB blend_line_gradient(GpLineGradient *brush, REAL position)
Definition: graphics.c:591
uint32 width
Definition: uimain.c:91
#define Y(I)
BYTE * Types
Definition: gdiplustypes.h:256
INT Width
Definition: gdiplustypes.h:271
GpStatus WINGDIPAPI GdipTransformPath(GpPath *path, GpMatrix *matrix)
GLint dy
Definition: linetemp.h:97
static GLboolean is_identity(const GLfloat m[16])
Definition: matrix.c:402
#define INT
Definition: polytest.cpp:20
GpPathData pathdata
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix *matrix, REAL flatness)
GpBrushType bt
int32_t INT
Definition: typedefs.h:56
POINTL point
Definition: edittest.c:50
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
GLsizei GLsizei GLfloat distance
Definition: glext.h:11755
InterpolationMode interpolation
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6948
GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap *bitmap, GDIPCONST GpRect *rect, UINT flags, PixelFormat format, BitmapData *lockeddata)
Definition: image.c:1030
INT X
Definition: gdiplustypes.h:269
#define FIXME(fmt,...)
Definition: debug.h:110
PixelOffsetMode pixeloffset
smooth NULL
Definition: ftsmooth.c:416
static ARGB resample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT width, UINT height, GpPointF *point, GDIPCONST GpImageAttributes *attributes, InterpolationMode interpolation, PixelOffsetMode offset_mode)
Definition: graphics.c:987
Definition: uimain.c:88
GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap *bitmap, BitmapData *lockeddata)
Definition: image.c:1176
PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE data, UINT width, UINT height, INT stride, ColorAdjustType type, PixelFormat fmt)
Definition: graphics.c:710
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
REAL Y
Definition: gdiplustypes.h:249
Definition: stat.h:55
REAL X
Definition: gdiplustypes.h:248
unsigned char BYTE
Definition: mem.h:68
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
Definition: matrix.c:363
Status
Definition: gdiplustypes.h:24
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
PixelFormat PixelFormat
GpStatus WINGDIPAPI GdipInvertMatrix(GpMatrix *matrix)
Definition: matrix.c:185
uint32 height
Definition: uimain.c:92
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpMatrix *matrix)
Definition: graphics.c:6871
static ARGB blend_colors(ARGB start, ARGB end, REAL position)
Definition: graphics.c:571
GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result)
Definition: brush.c:262
#define min(a, b)
Definition: monoChain.cc:55
PointF * Points
Definition: gdiplustypes.h:255
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
INT Height
Definition: gdiplustypes.h:272
GpStatus WINGDIPAPI GdipClonePath(GpPath *path, GpPath **clone)
static HBITMAP bitmap
Definition: clipboard.c:1344
INT Y
Definition: gdiplustypes.h:270
float REAL
Definition: types.h:41
GpStatus WINGDIPAPI GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *result)
Definition: matrix.c:512
#define WineCoordinateSpaceGdiDevice
#define PixelFormat32bppARGB
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
DWORD ARGB

Referenced by SOFTWARE_GdipDrawDriverString(), SOFTWARE_GdipDrawThinPath(), and SOFTWARE_GdipFillRegion().

◆ color_is_gray()

static BOOL color_is_gray ( ARGB  color)
static

Definition at line 698 of file graphics.c.

699 {
700  unsigned char r, g, b;
701 
702  r = (color >> 16) & 0xff;
703  g = (color >> 8) & 0xff;
704  b = color & 0xff;
705 
706  return (r == g) && (g == b);
707 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint color
Definition: glext.h:6243
#define b
Definition: ke_i.h:79
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

Referenced by apply_image_attributes().

◆ convert_path_point_type()

static BYTE convert_path_point_type ( BYTE  type)
static

Definition at line 76 of file graphics.c.

77 {
78  BYTE ret;
79 
82  ret = PT_BEZIERTO;
83  break;
84  case PathPointTypeLine:
85  ret = PT_LINETO;
86  break;
87  case PathPointTypeStart:
88  ret = PT_MOVETO;
89  break;
90  default:
91  ERR("Bad point type\n");
92  return 0;
93  }
94 
97 
98  return ret;
99 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int ret
unsigned char BYTE
Definition: mem.h:68
#define ERR(fmt,...)
Definition: debug.h:109
#define PT_CLOSEFIGURE
Definition: wingdi.h:886
#define PT_LINETO
Definition: wingdi.h:884
#define PT_MOVETO
Definition: wingdi.h:883
#define PT_BEZIERTO
Definition: wingdi.h:885

Referenced by draw_cap(), and draw_poly().

◆ create_gdi_brush()

static HBRUSH create_gdi_brush ( const GpBrush brush)
static

Definition at line 231 of file graphics.c.

232 {
233  LOGBRUSH lb;
234  HBRUSH gdibrush;
235 
236  if (create_gdi_logbrush(brush, &lb) != Ok) return 0;
237 
238  gdibrush = CreateBrushIndirect(&lb);
239  free_gdi_logbrush(&lb);
240 
241  return gdibrush;
242 }
static GpStatus free_gdi_logbrush(LOGBRUSH *lb)
Definition: graphics.c:220
static GpStatus create_gdi_logbrush(const GpBrush *brush, LOGBRUSH *lb)
Definition: graphics.c:184
HBRUSH WINAPI CreateBrushIndirect(_In_ const LOGBRUSH *plb)

Referenced by brush_fill_path().

◆ create_gdi_logbrush()

static GpStatus create_gdi_logbrush ( const GpBrush brush,
LOGBRUSH lb 
)
static

Definition at line 184 of file graphics.c.

185 {
186  switch (brush->bt)
187  {
188  case BrushTypeSolidColor:
189  {
190  const GpSolidFill *sf = (const GpSolidFill *)brush;
191  lb->lbStyle = BS_SOLID;
192  lb->lbColor = ARGB2COLORREF(sf->color);
193  lb->lbHatch = 0;
194  return Ok;
195  }
196 
197  case BrushTypeHatchFill:
198  {
199  const GpHatch *hatch = (const GpHatch *)brush;
200  HBITMAP hbmp;
201 
202  hbmp = create_hatch_bitmap(hatch);
203  if (!hbmp) return OutOfMemory;
204 
205  lb->lbStyle = BS_PATTERN;
206  lb->lbColor = 0;
207  lb->lbHatch = (ULONG_PTR)hbmp;
208  return Ok;
209  }
210 
211  default:
212  FIXME("unhandled brush type %d\n", brush->bt);
213  lb->lbStyle = BS_SOLID;
214  lb->lbColor = get_gdi_brush_color(brush);
215  lb->lbHatch = 0;
216  return Ok;
217  }
218 }
static COLORREF get_gdi_brush_color(const GpBrush *brush)
Definition: graphics.c:101
UINT lbStyle
Definition: wingdi.h:1725
ULONG_PTR lbHatch
Definition: wingdi.h:1727
static HBITMAP create_hatch_bitmap(const GpHatch *hatch)
Definition: graphics.c:139
GpBrushType bt
COLORREF ARGB2COLORREF(ARGB color)
Definition: gdiplus.c:259
#define FIXME(fmt,...)
Definition: debug.h:110
HBITMAP hbmp
COLORREF lbColor
Definition: wingdi.h:1726
#define BS_PATTERN
Definition: wingdi.h:1072
#define ULONG_PTR
Definition: config.h:101
static HBITMAP
Definition: button.c:44
#define BS_SOLID
Definition: wingdi.h:1068

Referenced by create_gdi_brush(), and prepare_dc().

◆ create_hatch_bitmap()

static HBITMAP create_hatch_bitmap ( const GpHatch hatch)
static

Definition at line 139 of file graphics.c.

140 {
141  HBITMAP hbmp;
142  BITMAPINFOHEADER bmih;
143  DWORD *bits;
144  int x, y;
145 
146  bmih.biSize = sizeof(bmih);
147  bmih.biWidth = 8;
148  bmih.biHeight = 8;
149  bmih.biPlanes = 1;
150  bmih.biBitCount = 32;
151  bmih.biCompression = BI_RGB;
152  bmih.biSizeImage = 0;
153 
154  hbmp = CreateDIBSection(0, (BITMAPINFO *)&bmih, DIB_RGB_COLORS, (void **)&bits, NULL, 0);
155  if (hbmp)
156  {
157  const char *hatch_data;
158 
159  if (get_hatch_data(hatch->hatchstyle, &hatch_data) == Ok)
160  {
161  for (y = 0; y < 8; y++)
162  {
163  for (x = 0; x < 8; x++)
164  {
165  if (hatch_data[y] & (0x80 >> x))
166  bits[y * 8 + x] = hatch->forecol;
167  else
168  bits[y * 8 + x] = hatch->backcol;
169  }
170  }
171  }
172  else
173  {
174  FIXME("Unimplemented hatch style %d\n", hatch->hatchstyle);
175 
176  for (y = 0; y < 64; y++)
177  bits[y] = hatch->forecol;
178  }
179  }
180 
181  return hbmp;
182 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GpHatchStyle hatchstyle
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmp
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result)
Definition: brush.c:262
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define BI_RGB
Definition: precomp.h:35

Referenced by create_gdi_logbrush().

◆ delete_container()

static void delete_container ( GraphicsContainerItem container)
static

Definition at line 2156 of file graphics.c.

2157 {
2160 }
GpRegion * clip
Definition: metafile.c:161
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
Definition: region.c:571
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by end_container(), and GdipDeleteGraphics().

◆ draw_cap()

static void draw_cap ( GpGraphics graphics,
COLORREF  color,
GpLineCap  cap,
REAL  size,
const GpCustomLineCap custom,
REAL  x1,
REAL  y1,
REAL  x2,
REAL  y2 
)
static

Definition at line 1659 of file graphics.c.

1661 {
1662  HGDIOBJ oldbrush = NULL, oldpen = NULL;
1663  GpMatrix matrix;
1664  HBRUSH brush = NULL;
1665  HPEN pen = NULL;
1666  PointF ptf[4], *custptf = NULL;
1667  POINT pt[4], *custpt = NULL;
1668  BYTE *tp = NULL;
1669  REAL theta, dsmall, dbig, dx, dy = 0.0;
1670  INT i, count;
1671  LOGBRUSH lb;
1672  BOOL customstroke;
1673 
1674  if((x1 == x2) && (y1 == y2))
1675  return;
1676 
1677  theta = gdiplus_atan2(y2 - y1, x2 - x1);
1678 
1679  customstroke = (cap == LineCapCustom) && custom && (!custom->fill);
1680  if(!customstroke){
1681  brush = CreateSolidBrush(color);
1682  lb.lbStyle = BS_SOLID;
1683  lb.lbColor = color;
1684  lb.lbHatch = 0;
1686  PS_JOIN_MITER, 1, &lb, 0,
1687  NULL);
1688  oldbrush = SelectObject(graphics->hdc, brush);
1689  oldpen = SelectObject(graphics->hdc, pen);
1690  }
1691 
1692  switch(cap){
1693  case LineCapFlat:
1694  break;
1695  case LineCapSquare:
1696  case LineCapSquareAnchor:
1697  case LineCapDiamondAnchor:
1698  size = size * (cap & LineCapNoAnchor ? ANCHOR_WIDTH : 1.0) / 2.0;
1699  if(cap == LineCapDiamondAnchor){
1700  dsmall = cos(theta + M_PI_2) * size;
1701  dbig = sin(theta + M_PI_2) * size;
1702  }
1703  else{
1704  dsmall = cos(theta + M_PI_4) * size;
1705  dbig = sin(theta + M_PI_4) * size;
1706  }
1707 
1708  ptf[0].X = x2 - dsmall;
1709  ptf[1].X = x2 + dbig;
1710 
1711  ptf[0].Y = y2 - dbig;
1712  ptf[3].Y = y2 + dsmall;
1713 
1714  ptf[1].Y = y2 - dsmall;
1715  ptf[2].Y = y2 + dbig;
1716 
1717  ptf[3].X = x2 - dbig;
1718  ptf[2].X = x2 + dsmall;
1719 
1721 
1722  round_points(pt, ptf, 4);
1723 
1724  Polygon(graphics->hdc, pt, 4);
1725 
1726  break;
1727  case LineCapArrowAnchor:
1728  size = size * 4.0 / sqrt(3.0);
1729 
1730  dx = cos(M_PI / 6.0 + theta) * size;
1731  dy = sin(M_PI / 6.0 + theta) * size;
1732 
1733  ptf[0].X = x2 - dx;
1734  ptf[0].Y = y2 - dy;
1735 
1736  dx = cos(- M_PI / 6.0 + theta) * size;
1737  dy = sin(- M_PI / 6.0 + theta) * size;
1738 
1739  ptf[1].X = x2 - dx;
1740  ptf[1].Y = y2 - dy;
1741 
1742  ptf[2].X = x2;
1743  ptf[2].Y = y2;
1744 
1746 
1747  round_points(pt, ptf, 3);
1748 
1749  Polygon(graphics->hdc, pt, 3);
1750 
1751  break;
1752  case LineCapRoundAnchor:
1753  dx = dy = ANCHOR_WIDTH * size / 2.0;
1754 
1755  ptf[0].X = x2 - dx;
1756  ptf[0].Y = y2 - dy;
1757  ptf[1].X = x2 + dx;
1758  ptf[1].Y = y2 + dy;
1759 
1761 
1762  round_points(pt, ptf, 2);
1763 
1764  Ellipse(graphics->hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
1765 
1766  break;
1767  case LineCapTriangle:
1768  size = size / 2.0;
1769  dx = cos(M_PI_2 + theta) * size;
1770  dy = sin(M_PI_2 + theta) * size;
1771 
1772  ptf[0].X = x2 - dx;
1773  ptf[0].Y = y2 - dy;
1774  ptf[1].X = x2 + dx;
1775  ptf[1].Y = y2 + dy;
1776 
1777  dx = cos(theta) * size;
1778  dy = sin(theta) * size;
1779 
1780  ptf[2].X = x2 + dx;
1781  ptf[2].Y = y2 + dy;
1782 
1784 
1785  round_points(pt, ptf, 3);
1786 
1787  Polygon(graphics->hdc, pt, 3);
1788 
1789  break;
1790  case LineCapRound:
1791  dx = dy = size / 2.0;
1792 
1793  ptf[0].X = x2 - dx;
1794  ptf[0].Y = y2 - dy;
1795  ptf[1].X = x2 + dx;
1796  ptf[1].Y = y2 + dy;
1797 
1798  dx = -cos(M_PI_2 + theta) * size;
1799  dy = -sin(M_PI_2 + theta) * size;
1800 
1801  ptf[2].X = x2 - dx;
1802  ptf[2].Y = y2 - dy;
1803  ptf[3].X = x2 + dx;
1804  ptf[3].Y = y2 + dy;
1805 
1807 
1808  round_points(pt, ptf, 4);
1809 
1810  Pie(graphics->hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y, pt[2].x,
1811  pt[2].y, pt[3].x, pt[3].y);
1812 
1813  break;
1814  case LineCapCustom:
1815  if(!custom)
1816  break;
1817 
1818  if (custom->type == CustomLineCapTypeAdjustableArrow)
1819  {
1820  GpAdjustableArrowCap *arrow = (GpAdjustableArrowCap *)custom;
1821  if (arrow->cap.fill && arrow->height <= 0.0)
1822  break;
1823  }
1824 
1825  count = custom->pathdata.Count;
1826  custptf = heap_alloc_zero(count * sizeof(PointF));
1827  custpt = heap_alloc_zero(count * sizeof(POINT));
1828  tp = heap_alloc_zero(count);
1829 
1830  if(!custptf || !custpt || !tp)
1831  goto custend;
1832 
1833  memcpy(custptf, custom->pathdata.Points, count * sizeof(PointF));
1834 
1835  GdipSetMatrixElements(&matrix, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
1837  GdipRotateMatrix(&matrix, (180.0 / M_PI) * (theta - M_PI_2),
1841 
1843 
1844  round_points(custpt, custptf, count);
1845 
1846  for(i = 0; i < count; i++)
1847  tp[i] = convert_path_point_type(custom->pathdata.Types[i]);
1848 
1849  if(custom->fill){
1850  BeginPath(graphics->hdc);
1851  PolyDraw(graphics->hdc, custpt, tp, count);
1852  EndPath(graphics->hdc);
1853  StrokeAndFillPath(graphics->hdc);
1854  }
1855  else
1856  PolyDraw(graphics->hdc, custpt, tp, count);
1857 
1858 custend:
1859  heap_free(custptf);
1860  heap_free(custpt);
1861  heap_free(tp);
1862  break;
1863  default:
1864  break;
1865  }
1866 
1867  if(!customstroke){
1868  SelectObject(graphics->hdc, oldbrush);
1869  SelectObject(graphics->hdc, oldpen);
1870  DeleteObject(brush);
1871  DeleteObject(pen);
1872  }
1873 }
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
BOOL WINAPI PolyDraw(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_reads_(cpt) const BYTE *aj, _In_ int cpt)
#define M_PI_4
Definition: port.h:153
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: matrix.c:316
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
UINT lbStyle
Definition: wingdi.h:1725
BYTE * Types
Definition: gdiplustypes.h:256
#define pt(x, y)
Definition: drawing.c:79
GLuint GLenum matrix
Definition: glext.h:9407
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint dy
Definition: linetemp.h:97
ULONG_PTR lbHatch
Definition: wingdi.h:1727
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
BOOL WINAPI EndPath(_In_ HDC)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define PS_JOIN_MITER
Definition: wingdi.h:597
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2663
#define PS_GEOMETRIC
Definition: wingdi.h:582
int32_t INT
Definition: typedefs.h:56
GpCustomLineCap cap
#define PS_SOLID
Definition: wingdi.h:585
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
GLenum cap
Definition: glext.h:9639
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint color
Definition: glext.h:6243
GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6948
BOOL WINAPI StrokeAndFillPath(_In_ HDC)
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
smooth NULL
Definition: ftsmooth.c:416
static void round_points(POINT *pti, GpPointF *ptf, INT count)
Definition: graphics.c:316
#define ANCHOR_WIDTH
Definition: graphics.c:67
GLsizeiptr size
Definition: glext.h:5919
CustomLineCapType type
BOOL WINAPI Pie(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
COLORREF lbColor
Definition: wingdi.h:1726
REAL Y
Definition: gdiplustypes.h:249
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:258
static BYTE convert_path_point_type(BYTE type)
Definition: graphics.c:76
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:289
REAL X
Definition: gdiplustypes.h:248
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
REAL gdiplus_atan2(REAL dy, REAL dx)
Definition: gdiplus.c:304
unsigned char BYTE
Definition: mem.h:68
#define M_PI_2
Definition: port.h:185
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
Definition: matrix.c:363
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:418
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
GpPathData pathdata
#define PS_ENDCAP_FLAT
Definition: wingdi.h:595
#define M_PI
Definition: macros.h:263
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
PointF * Points
Definition: gdiplustypes.h:255
GLint dx
Definition: linetemp.h:97
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
BOOL WINAPI BeginPath(_In_ HDC hdc)
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)
#define BS_SOLID
Definition: wingdi.h:1068
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
float REAL
Definition: types.h:41
#define WineCoordinateSpaceGdiDevice
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by draw_poly().

◆ draw_driver_string()

static GpStatus draw_driver_string ( GpGraphics graphics,
GDIPCONST UINT16 text,
INT  length,
GDIPCONST GpFont font,
GDIPCONST GpStringFormat format,
GDIPCONST GpBrush brush,
GDIPCONST PointF positions,
INT  flags,
GDIPCONST GpMatrix matrix 
)
static

Definition at line 7433 of file graphics.c.

7437 {
7439 
7440  if (length == -1)
7441  length = strlenW(text);
7442 
7443  if (graphics->hdc && !graphics->alpha_hdc &&
7445  brush->bt == BrushTypeSolidColor &&
7446  (((GpSolidFill*)brush)->color & 0xff000000) == 0xff000000)
7448  brush, positions, flags, matrix);
7449  if (stat == NotImplemented)
7451  brush, positions, flags, matrix);
7452  return stat;
7453 }
static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix)
Definition: graphics.c:7225
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
Definition: mk_font.cpp:20
GLuint GLenum matrix
Definition: glext.h:9407
const WCHAR * text
Definition: package.c:1827
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
GLbitfield flags
Definition: glext.h:7161
Definition: stat.h:55
Status
Definition: gdiplustypes.h:24
static GpStatus GDI32_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix)
Definition: graphics.c:7173
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345

Referenced by draw_string_callback(), and GdipDrawDriverString().

◆ draw_poly()

static GpStatus draw_poly ( GpGraphics graphics,
GpPen pen,
GDIPCONST GpPointF pt,
GDIPCONST BYTE types,
INT  count,
BOOL  caps 
)
static

Definition at line 1960 of file graphics.c.

1962 {
1963  POINT *pti = heap_alloc_zero(count * sizeof(POINT));
1964  BYTE *tp = heap_alloc_zero(count);
1965  GpPointF *ptcopy = heap_alloc_zero(count * sizeof(GpPointF));
1966  INT i, j;
1968 
1969  if(!count){
1970  status = Ok;
1971  goto end;
1972  }
1973  if(!pti || !tp || !ptcopy){
1974  status = OutOfMemory;
1975  goto end;
1976  }
1977 
1978  for(i = 1; i < count; i++){
1980  if((i + 2 >= count) || !(types[i + 1] & PathPointTypeBezier)
1981  || !(types[i + 2] & PathPointTypeBezier)){
1982  ERR("Bad bezier points\n");
1983  goto end;
1984  }
1985  i += 2;
1986  }
1987  }
1988 
1989  memcpy(ptcopy, pt, count * sizeof(GpPointF));
1990 
1991  /* If we are drawing caps, go through the points and adjust them accordingly,
1992  * and draw the caps. */
1993  if(caps){
1994  switch(types[count - 1] & PathPointTypePathTypeMask){
1995  case PathPointTypeBezier:
1996  if(pen->endcap == LineCapArrowAnchor)
1997  shorten_bezier_amt(&ptcopy[count - 4], pen->width, FALSE);
1998  else if((pen->endcap == LineCapCustom) && pen->customend)
1999  shorten_bezier_amt(&ptcopy[count - 4],
2000  pen->width * pen->customend->inset, FALSE);
2001 
2002  draw_cap(graphics, get_gdi_brush_color(pen->brush), pen->endcap, pen->width, pen->customend,
2003  pt[count - 1].X - (ptcopy[count - 1].X - ptcopy[count - 2].X),
2004  pt[count - 1].Y - (ptcopy[count - 1].Y - ptcopy[count - 2].Y),
2005  pt[count - 1].X, pt[count - 1].Y);
2006 
2007  break;
2008  case PathPointTypeLine:
2009  if(pen->endcap == LineCapArrowAnchor)
2010  shorten_line_amt(ptcopy[count - 2].X, ptcopy[count - 2].Y,
2011  &ptcopy[count - 1].X, &ptcopy[count - 1].Y,
2012  pen->width);
2013  else if((pen->endcap == LineCapCustom) && pen->customend)
2014  shorten_line_amt(ptcopy[count - 2].X, ptcopy[count - 2].Y,
2015  &ptcopy[count - 1].X, &ptcopy[count - 1].Y,
2016  pen->customend->inset * pen->width);
2017 
2018  draw_cap(graphics, get_gdi_brush_color(pen->brush), pen->endcap, pen->width, pen->customend,
2019  pt[count - 2].X, pt[count - 2].Y, pt[count - 1].X,
2020  pt[count - 1].Y);
2021 
2022  break;
2023  default:
2024  ERR("Bad path last point\n");
2025  goto end;
2026  }
2027 
2028  /* Find start of points */
2029  for(j = 1; j < count && ((types[j] & PathPointTypePathTypeMask)
2030  == PathPointTypeStart); j++);
2031 
2032  switch(types[j] & PathPointTypePathTypeMask){
2033  case PathPointTypeBezier:
2034  if(pen->startcap == LineCapArrowAnchor)
2035  shorten_bezier_amt(&ptcopy[j - 1], pen->width, TRUE);
2036  else if((pen->startcap == LineCapCustom) && pen->customstart)
2037  shorten_bezier_amt(&ptcopy[j - 1],
2038  pen->width * pen->customstart->inset, TRUE);
2039 
2040  draw_cap(graphics, get_gdi_brush_color(pen->brush), pen->startcap, pen->width, pen->customstart,
2041  pt[j - 1].X - (ptcopy[j - 1].X - ptcopy[j].X),
2042  pt[j - 1].Y - (ptcopy[j - 1].Y - ptcopy[j].Y),
2043  pt[j - 1].X, pt[j - 1].Y);
2044 
2045  break;
2046  case PathPointTypeLine:
2047  if(pen->startcap == LineCapArrowAnchor)
2048  shorten_line_amt(ptcopy[j].X, ptcopy[j].Y,
2049  &ptcopy[j - 1].X, &ptcopy[j - 1].Y,
2050  pen->width);
2051  else if((pen->startcap == LineCapCustom) && pen->customstart)
2052  shorten_line_amt(ptcopy[j].X, ptcopy[j].Y,
2053  &ptcopy[j - 1].X, &ptcopy[j - 1].Y,
2054  pen->customstart->inset * pen->width);
2055 
2056  draw_cap(graphics, get_gdi_brush_color(pen->brush), pen->startcap, pen->width, pen->customstart,
2057  pt[j].X, pt[j].Y, pt[j - 1].X,
2058  pt[j - 1].Y);
2059 
2060  break;
2061  default:
2062  ERR("Bad path points\n");
2063  goto end;
2064  }
2065  }
2066 
2068 
2069  round_points(pti, ptcopy, count);
2070 
2071  for(i = 0; i < count; i++){
2073  }
2074 
2075  PolyDraw(graphics->hdc, pti, tp, count);
2076 
2077  status = Ok;
2078 
2079 end:
2080  heap_free(pti);
2081  heap_free(ptcopy);
2082  heap_free(tp);
2083 
2084  return status;
2085 }
BOOL WINAPI PolyDraw(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_reads_(cpt) const BYTE *aj, _In_ int cpt)
static COLORREF get_gdi_brush_color(const GpBrush *brush)
Definition: graphics.c:101
#define TRUE
Definition: types.h:120
GpLineCap startcap
#define Y(I)
GpCustomLineCap * customend
#define pt(x, y)
Definition: drawing.c:79
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2663
int32_t INT
Definition: typedefs.h:56
REAL width
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
GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6948
GpLineCap endcap
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 void round_points(POINT *pti, GpPointF *ptf, INT count)
Definition: graphics.c:316
static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL size, const GpCustomLineCap *custom, REAL x1, REAL y1, REAL x2, REAL y2)
Definition: graphics.c:1659
Definition: cmds.c:130
static BYTE convert_path_point_type(BYTE type)
Definition: graphics.c:76
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
static void shorten_bezier_amt(GpPointF *pt, REAL amt, BOOL rev)
Definition: graphics.c:1923
GpBrush * brush
static void shorten_line_amt(REAL x1, REAL y1, REAL *x2, REAL *y2, REAL amt)
Definition: graphics.c:1897
GpCustomLineCap * customstart
static SERVICE_STATUS status
Definition: service.c:31
#define WineCoordinateSpaceGdiDevice
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: ps.c:97

Referenced by GDI32_GdipDrawPath(), GDI32_GdipFillPath(), and trace_path().

◆ draw_string_callback()

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

Definition at line 5649 of file graphics.c.

5654 {
5655  struct draw_string_args *args = user_data;
5656  PointF position;
5657  GpStatus stat;
5658 
5659  position.X = args->x + bounds->X / args->rel_width;
5660  position.Y = args->y + bounds->Y / args->rel_height + args->ascent;
5661 
5662  stat = draw_driver_string(args->graphics, &string[index], length, font, format,
5663  args->brush, &position,
5665 
5666  if (stat == Ok && underlined_index_count)
5667  {
5668  OUTLINETEXTMETRICW otm;
5669  REAL underline_y, underline_height;
5670  int i;
5671 
5672  GetOutlineTextMetricsW(hdc, sizeof(otm), &otm);
5673 
5674  underline_height = otm.otmsUnderscoreSize / args->rel_height;
5675  underline_y = position.Y - otm.otmsUnderscorePosition / args->rel_height - underline_height / 2;
5676 
5677  for (i=0; i<underlined_index_count; i++)
5678  {
5679  REAL start_x, end_x;
5680  SIZE text_size;
5681  INT ofs = underlined_indexes[i] - index;
5682 
5683  GetTextExtentExPointW(hdc, string + index, ofs, INT_MAX, NULL, NULL, &text_size);
5684  start_x = text_size.cx / args->rel_width;
5685 
5686  GetTextExtentExPointW(hdc, string + index, ofs+1, INT_MAX, NULL, NULL, &text_size);
5687  end_x = text_size.cx / args->rel_width;
5688 
5689  GdipFillRectangle(args->graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height);
5690  }
5691  }
5692 
5693  return stat;
5694 }
static int start_x
Definition: maze.c:118
#define INT_MAX
Definition: limits.h:40
Definition: mk_font.cpp:20
int otmsUnderscorePosition
Definition: wingdi.h:2518
Definition: match.c:390
int32_t INT
Definition: typedefs.h:56
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
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
BOOL WINAPI GetTextExtentExPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpszString, _In_ int cchString, _In_ int nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
GpStatus WINGDIPAPI GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height)
Definition: graphics.c:4537
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
REAL X
Definition: gdiplustypes.h:261
REAL Y
Definition: gdiplustypes.h:249
#define index(s, c)
Definition: various.h:29
HDC hdc
Definition: main.c:9
Definition: stat.h:55
REAL X
Definition: gdiplustypes.h:248
Status
Definition: gdiplustypes.h:24
static int end_x
Definition: maze.c:118
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)
float REAL
Definition: types.h:41
REAL Y
Definition: gdiplustypes.h:262
static GpStatus draw_driver_string(GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix)
Definition: graphics.c:7433

Referenced by GdipDrawString().

◆ end_container()

static GpStatus end_container ( GpGraphics graphics,
GraphicsContainerType  type,
GraphicsContainer  state 
)
static

Definition at line 5996 of file graphics.c.

5998 {
5999  GpStatus sts;
6000  GraphicsContainerItem *container, *container2;
6001 
6002  if(!graphics)
6003  return InvalidParameter;
6004 
6006  if(container->contid == state && container->type == type)
6007  break;
6008  }
6009 
6010  /* did not find a matching container */
6011  if(&container->entry == &graphics->containers)
6012  return Ok;
6013 
6015  if(sts != Ok)
6016  return sts;
6017 
6018  /* remove all of the containers on top of the found container */
6020  if(container->contid == state)
6021  break;
6024  }
6025 
6028 
6030  if (type == BEGIN_CONTAINER)
6032  else
6034  }
6035 
6036  return Ok;
6037 }
struct list entry
Definition: metafile.c:154
enum container_type type
Definition: metafile.c:156
static GpStatus restore_container(GpGraphics *graphics, GDIPCONST GraphicsContainerItem *container)
Definition: graphics.c:2162
GpStatus METAFILE_RestoreGraphics(GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
Definition: metafile.c:1469
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GpStatus METAFILE_EndContainer(GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
Definition: metafile.c:1423
GpGraphics * graphics
Definition: graphics.c:5644
ImageType type
struct container container
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
struct list containers
static void delete_container(GraphicsContainerItem *container)
Definition: graphics.c:2156
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
GpImage * image
static int state
Definition: maze.c:121
uint32_t entry
Definition: isohybrid.c:63
Status
Definition: gdiplustypes.h:24
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204

Referenced by GdipEndContainer(), and GdipRestoreGraphics().

◆ free_gdi_logbrush()

static GpStatus free_gdi_logbrush ( LOGBRUSH lb)
static

Definition at line 220 of file graphics.c.

221 {
222  switch (lb->lbStyle)
223  {
224  case BS_PATTERN:
226  break;
227  }
228  return Ok;
229 }
UINT lbStyle
Definition: wingdi.h:1725
ULONG_PTR lbHatch
Definition: wingdi.h:1727
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define BS_PATTERN
Definition: wingdi.h:1072

Referenced by create_gdi_brush(), and prepare_dc().

◆ GDI32_GdipDrawDriverString()

static GpStatus GDI32_GdipDrawDriverString ( GpGraphics graphics,
GDIPCONST UINT16 text,
INT  length,
GDIPCONST GpFont font,
GDIPCONST GpStringFormat format,
GDIPCONST GpBrush brush,
GDIPCONST PointF positions,
INT  flags,
GDIPCONST GpMatrix matrix 
)
static

Definition at line 7173 of file graphics.c.

7177 {
7178  static const INT unsupported_flags = ~(DriverStringOptionsRealizedAdvance|DriverStringOptionsCmapLookup);
7179  INT save_state;
7180  GpPointF pt;
7181  HFONT hfont;
7182  UINT eto_flags=0;
7183  GpStatus status;
7184  HRGN hrgn;
7185 
7186  if (flags & unsupported_flags)
7187  FIXME("Ignoring flags %x\n", flags & unsupported_flags);
7188 
7190  eto_flags |= ETO_GLYPH_INDEX;
7191 
7192  save_state = SaveDC(graphics->hdc);
7195 
7197 
7198  if (status == Ok)
7199  {
7201  DeleteObject(hrgn);
7202  }
7203 
7204  pt = positions[0];
7206 
7209 
7211 
7213 
7214  ExtTextOutW(graphics->hdc, gdip_round(pt.X), gdip_round(pt.Y), eto_flags, NULL, text, length, NULL);
7215 
7217 
7218  RestoreDC(graphics->hdc, save_state);
7219 
7221 
7222  return Ok;
7223 }
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
static COLORREF get_gdi_brush_color(const GpBrush *brush)
Definition: graphics.c:101
Definition: mk_font.cpp:20
#define pt(x, y)
Definition: drawing.c:79
GLuint GLenum matrix
Definition: glext.h:9407
const WCHAR * text
Definition: package.c:1827
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define TA_LEFT
Definition: wingdi.h:931
UINT WINAPI SetTextAlign(_In_ HDC, _In_ UINT)
Definition: text.c:851
GDIPCONST GpBrush * brush
Definition: graphics.c:5645
int32_t INT
Definition: typedefs.h:56
GpGraphics * graphics
Definition: graphics.c:5644
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6948
#define TA_BASELINE
Definition: wingdi.h:927
#define FIXME(fmt,...)
Definition: debug.h:110
static GpStatus get_clip_hrgn(GpGraphics *graphics, HRGN *hrgn)
Definition: graphics.c:351
#define TRANSPARENT
Definition: wingdi.h:949
GpStatus gdi_transform_acquire(GpGraphics *graphics)
Definition: graphics.c:6842
smooth NULL
Definition: ftsmooth.c:416
static INT gdip_round(REAL x)
static HFONT hfont
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
GLbitfield flags
Definition: glext.h:7161
static HRGN hrgn
Definition: win.c:55
Status
Definition: gdiplustypes.h:24
#define RGN_COPY
Definition: wingdi.h:356
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:886
static void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, HFONT *hfont, GDIPCONST GpMatrix *matrix)
Definition: graphics.c:2337
unsigned int UINT
Definition: ndis.h:50
int WINAPI SaveDC(_In_ HDC)
GpStatus gdi_transform_release(GpGraphics *graphics)
Definition: graphics.c:6856
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static SERVICE_STATUS status
Definition: service.c:31
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)
#define WineCoordinateSpaceGdiDevice
Definition: ps.c:97

Referenced by draw_driver_string().

◆ GDI32_GdipDrawPath()

static GpStatus GDI32_GdipDrawPath ( GpGraphics graphics,
GpPen pen,
GpPath path 
)
static

Definition at line 3645 of file graphics.c.

3646 {
3647  INT save_state;
3648  GpStatus retval;
3649  HRGN hrgn=NULL;
3650 
3651  save_state = prepare_dc(graphics, pen);
3652 
3653  retval = get_clip_hrgn(graphics, &hrgn);
3654 
3655  if (retval != Ok)
3656  goto end;
3657 
3659 
3661 
3662  retval = draw_poly(graphics, pen, path->pathdata.Points,
3663  path->pathdata.Types, path->pathdata.Count, TRUE);
3664 
3666 
3667 end:
3668  restore_dc(graphics, save_state);
3669  DeleteObject(hrgn);
3670 
3671  return retval;
3672 }
#define TRUE
Definition: types.h:120
static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
Definition: graphics.c:244
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLuint GLuint end
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
GpGraphics * graphics
Definition: graphics.c:5644
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
static GpStatus get_clip_hrgn(GpGraphics *graphics, HRGN *hrgn)
Definition: graphics.c:351
static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *pt, GDIPCONST BYTE *types, INT count, BOOL caps)
Definition: graphics.c:1960
GpStatus gdi_transform_acquire(GpGraphics *graphics)
Definition: graphics.c:6842
smooth NULL
Definition: ftsmooth.c:416
static HRGN hrgn
Definition: win.c:55
Status
Definition: gdiplustypes.h:24
#define RGN_COPY
Definition: wingdi.h:356
Definition: services.c:325
GpStatus gdi_transform_release(GpGraphics *graphics)
Definition: graphics.c:6856
static void restore_dc(GpGraphics *graphics, INT state)
Definition: graphics.c:310

Referenced by GdipDrawPath().

◆ GDI32_GdipFillPath()

static GpStatus GDI32_GdipFillPath ( GpGraphics graphics,
GpBrush brush,
GpPath path 
)
static

Definition at line 4327 of file graphics.c.

4328 {
4329  INT save_state;
4330  GpStatus retval;
4331  HRGN hrgn=NULL;
4332 
4334  return NotImplemented;
4335 
4336  save_state = SaveDC(graphics->hdc);
4337  EndPath(graphics->hdc);
4339  : WINDING));
4340 
4341  retval = get_clip_hrgn(graphics, &hrgn);
4342 
4343  if (retval != Ok)
4344  goto end;
4345 
4347 
4349 
4351  retval = draw_poly(graphics, NULL, path->pathdata.Points,
4352  path->pathdata.Types, path->pathdata.Count, FALSE);
4353 
4354  if(retval == Ok)
4355  {
4356  EndPath(graphics->hdc);
4357  retval = brush_fill_path(graphics, brush);
4358  }
4359 
4361 
4362 end:
4363  RestoreDC(graphics->hdc, save_state);
4364  DeleteObject(hrgn);
4365 
4366  return retval;
4367