ReactOS 0.4.15-dev-7928-g68a8619
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
@ SAVE_GRAPHICS
Definition: graphics.c:2100
@ BEGIN_CONTAINER
Definition: graphics.c:2099

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);
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}
GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap *bitmap, INT x, INT y, ARGB *color)
Definition: image.c:288
GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap *bitmap, INT x, INT y, ARGB color)
Definition: image.c:494
static ARGB color_over(ARGB bg, ARGB fg)
static ARGB color_over_fgpremult(ARGB bg, ARGB fg)
DWORD ARGB
#define PixelFormatPAlpha
@ Ok
Definition: gdiplustypes.h:26
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum src
Definition: glext.h:6340
#define for
Definition: utility.h:88
GpImage * image
Definition: dsound.c:943
int32_t INT
Definition: typedefs.h:58

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;
425 BYTE *temp_bits;
426
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}
static HBITMAP hbitmap
#define NULL
Definition: types.h:112
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
#define BI_RGB
Definition: precomp.h:56
pKey DeleteObject()
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 memcpy(s1, s2, n)
Definition: mkisofs.h:878
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
LONG biYPelsPerMeter
Definition: amvideo.idl:38
DWORD biCompression
Definition: amvideo.idl:35
DWORD biClrImportant
Definition: amvideo.idl:40
LONG biXPelsPerMeter
Definition: amvideo.idl:37
DWORD biSizeImage
Definition: amvideo.idl:36
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define DT_RASPRINTER
Definition: wingdi.h:709
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)
#define TECHNOLOGY
Definition: wingdi.h:706
unsigned char BYTE
Definition: xxhash.c:193

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}
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

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{
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
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}
static HRGN hrgn
#define stat
Definition: acwin.h:99
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define ERR(fmt,...)
Definition: debug.h:110
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
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 get_clip_hrgn(GpGraphics *graphics, HRGN *hrgn)
Definition: graphics.c:351
unsigned long DWORD
Definition: ntddk_ex.h:95
@ ImageTypeBitmap
Definition: gdiplusenums.h:195
@ ImageTypeMetafile
Definition: gdiplusenums.h:196
Status
Definition: gdiplustypes.h:25
@ OutOfMemory
Definition: gdiplustypes.h:29
@ NotImplemented
Definition: gdiplustypes.h:32
GLsizeiptr size
Definition: glext.h:5919
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
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
ImageType type
RGNDATAHEADER rdh
Definition: axextend.idl:399
char Buffer[1]
Definition: axextend.idl:400
Definition: stat.h:55
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
#define RGN_COPY
Definition: wingdi.h:357
#define RGN_AND
Definition: wingdi.h:356
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)
int WINAPI SaveDC(_In_ HDC)
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)

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

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 int state
Definition: maze.c:121
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
static GpStatus init_container(GraphicsContainerItem **container, GDIPCONST GpGraphics *graphics, GraphicsContainerType type)
Definition: graphics.c:2122
GpStatus METAFILE_SaveGraphics(GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
Definition: metafile.c:1446
GpStatus METAFILE_BeginContainerNoParams(GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
Definition: metafile.c:1400
@ InvalidParameter
Definition: gdiplustypes.h:28
struct list containers
GraphicsContainer contid
struct list entry
Definition: metafile.c:154

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}
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
#define INT
Definition: polytest.cpp:20

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}

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}
static ARGB blend_colors(ARGB start, ARGB end, REAL position)
Definition: graphics.c:571
@ WrapModeTile
Definition: gdiplusenums.h:207
GLenum GLint * range
Definition: glext.h:7539
_Check_return_ float __cdecl fmodf(_In_ float x, _In_ float y)
Definition: math.h:228
if(dx< 0)
Definition: linetemp.h:194
REAL X
Definition: gdiplustypes.h:661
REAL Width
Definition: gdiplustypes.h:663

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 {
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 }
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
#define FALSE
Definition: types.h:117
@ BrushTypeHatchFill
Definition: gdiplusenums.h:39
@ BrushTypeLinearGradient
Definition: gdiplusenums.h:42
@ BrushTypeTextureFill
Definition: gdiplusenums.h:40
@ BrushTypeSolidColor
Definition: gdiplusenums.h:38
GLuint color
Definition: glext.h:6243
GpBrushType bt

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 {
1229 case BrushTypeHatchFill:
1233 return TRUE;
1234 default:
1235 return FALSE;
1236 }
1237}
@ BrushTypePathGradient
Definition: gdiplusenums.h:41

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 {
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 {
1178 break;
1179 }
1180 if (GetClipBox(graphics->hdc, &rc) != NULLREGION)
1181 {
1183
1184 if (!hdc)
1185 {
1188 break;
1189 }
1190
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
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 {
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}
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
static HBRUSH create_gdi_brush(const GpBrush *brush)
Definition: graphics.c:231
HBITMAP ARGB2BMP(ARGB color)
Definition: gdiplus.c:272
@ GenericError
Definition: gdiplustypes.h:27
BITMAP bmp
Definition: alphablend.c:62
Definition: ps.c:97
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
#define NULLREGION
Definition: wingdi.h:361
BOOL WINAPI SelectClipPath(_In_ HDC, _In_ int)
BOOL WINAPI FillPath(_In_ HDC)

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 {
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 {
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 }
1327 {
1328 GpTexture *fill = (GpTexture*)brush;
1329 GpPointF draw_points[3];
1330 GpStatus stat;
1331 int x, y;
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 {
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 }
1430 {
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}
#define FIXME(fmt,...)
Definition: debug.h:111
#define Y(I)
static GLboolean is_identity(const GLfloat m[16])
Definition: matrix.c:402
GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result)
Definition: brush.c:262
GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpMatrix *matrix)
Definition: graphics.c:6871
GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6948
static ARGB blend_line_gradient(GpLineGradient *brush, REAL position)
Definition: graphics.c:591
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
static REAL intersect_line_scanline(const GpPointF *p1, const GpPointF *p2, REAL y)
Definition: graphics.c:1125
PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE data, UINT width, UINT height, INT stride, ColorAdjustType type, PixelFormat fmt)
Definition: graphics.c:710
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix *matrix, REAL flatness)
GpStatus WINGDIPAPI GdipClonePath(GpPath *path, GpPath **clone)
GpStatus WINGDIPAPI GdipTransformPath(GpPath *path, GpMatrix *matrix)
GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap *bitmap, GDIPCONST GpRect *rect, UINT flags, PixelFormat format, BitmapData *lockeddata)
Definition: image.c:1030
GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap *bitmap, BitmapData *lockeddata)
Definition: image.c:1176
GpStatus WINGDIPAPI GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *result)
Definition: matrix.c:512
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
Definition: matrix.c:363
GpStatus WINGDIPAPI GdipInvertMatrix(GpMatrix *matrix)
Definition: matrix.c:185
POINTL point
Definition: edittest.c:50
#define WineCoordinateSpaceGdiDevice
@ ColorAdjustTypeBitmap
@ PathPointTypePathTypeMask
Definition: gdiplusenums.h:87
@ PathPointTypeLine
Definition: gdiplusenums.h:85
@ PathPointTypeCloseSubpath
Definition: gdiplusenums.h:90
@ PathPointTypeStart
Definition: gdiplusenums.h:84
@ CoordinateSpaceWorld
Definition: gdiplusenums.h:367
@ ImageLockModeUserInputBuf
@ ImageLockModeRead
GLsizei GLsizei GLfloat distance
Definition: glext.h:11755
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
Definition: fabs.c:17
_Check_return_ _CRTIMP double __cdecl ceil(_In_ double x)
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define min(a, b)
Definition: monoChain.cc:55
PixelFormat PixelFormat
PixelOffsetMode pixeloffset
InterpolationMode interpolation
GpPathData pathdata
PointF * Points
Definition: gdiplustypes.h:655
BYTE * Types
Definition: gdiplustypes.h:656
REAL Y
Definition: gdiplustypes.h:649
REAL X
Definition: gdiplustypes.h:648
INT Width
Definition: gdiplustypes.h:671
INT Height
Definition: gdiplustypes.h:672
INT X
Definition: gdiplustypes.h:669
INT Y
Definition: gdiplustypes.h:670
Definition: uimain.c:89
uint32 width
Definition: uimain.c:91
uint32 height
Definition: uimain.c:92

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
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
#define b
Definition: ke_i.h:79

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
83 break;
85 ret = PT_LINETO;
86 break;
88 ret = PT_MOVETO;
89 break;
90 default:
91 ERR("Bad point type\n");
92 return 0;
93 }
94
97
98 return ret;
99}
@ PathPointTypeBezier
Definition: gdiplusenums.h:86
int ret
#define PT_LINETO
Definition: wingdi.h:885
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
#define PT_MOVETO
Definition: wingdi.h:884
#define PT_BEZIERTO
Definition: wingdi.h:886

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);
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 {
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
198 {
199 const GpHatch *hatch = (const GpHatch *)brush;
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}
HBITMAP hbmp
static HBITMAP create_hatch_bitmap(const GpHatch *hatch)
Definition: graphics.c:139
static COLORREF get_gdi_brush_color(const GpBrush *brush)
Definition: graphics.c:101
#define ULONG_PTR
Definition: config.h:101
COLORREF ARGB2COLORREF(ARGB color)
Definition: gdiplus.c:259
UINT lbStyle
Definition: wingdi.h:1747
ULONG_PTR lbHatch
Definition: wingdi.h:1749
COLORREF lbColor
Definition: wingdi.h:1748
#define BS_PATTERN
Definition: wingdi.h:1090
#define BS_SOLID
Definition: wingdi.h:1086

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{
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}
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define bits
Definition: infblock.c:15
GpHatchStyle hatchstyle

Referenced by create_gdi_logbrush().

◆ delete_container()

static void delete_container ( GraphicsContainerItem container)
static

Definition at line 2156 of file graphics.c.

2157{
2160}
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
Definition: region.c:571
GpRegion * clip
Definition: metafile.c:161

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;
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:
1698 size = size * (cap & LineCapNoAnchor ? ANCHOR_WIDTH : 1.0) / 2.0;
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
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++)
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
1858custend:
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 cos(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
#define ANCHOR_WIDTH
Definition: graphics.c:67
static void round_points(POINT *pti, GpPointF *ptf, INT count)
Definition: graphics.c:316
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
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:418
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: matrix.c:316
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:258
#define pt(x, y)
Definition: drawing.c:79
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
REAL gdiplus_atan2(REAL dy, REAL dx)
Definition: gdiplus.c:304
@ CustomLineCapTypeAdjustableArrow
Definition: gdiplusenums.h:79
@ LineCapTriangle
Definition: gdiplusenums.h:64
@ LineCapCustom
Definition: gdiplusenums.h:72
@ LineCapArrowAnchor
Definition: gdiplusenums.h:70
@ LineCapNoAnchor
Definition: gdiplusenums.h:66
@ LineCapSquare
Definition: gdiplusenums.h:62
@ LineCapSquareAnchor
Definition: gdiplusenums.h:67
@ LineCapRound
Definition: gdiplusenums.h:63
@ LineCapRoundAnchor
Definition: gdiplusenums.h:68
@ LineCapFlat
Definition: gdiplusenums.h:61
@ LineCapDiamondAnchor
Definition: gdiplusenums.h:69
@ MatrixOrderAppend
Definition: gdiplusenums.h:189
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLenum matrix
Definition: glext.h:9407
GLenum cap
Definition: glext.h:9639
#define M_PI
Definition: macros.h:263
#define M_PI_2
Definition: port.h:185
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
#define M_PI_4
Definition: port.h:153
GpCustomLineCap cap
GpPathData pathdata
CustomLineCapType type
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)
#define PS_GEOMETRIC
Definition: wingdi.h:583
BOOL WINAPI StrokeAndFillPath(_In_ HDC)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI PolyDraw(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_reads_(cpt) const BYTE *aj, _In_ int cpt)
BOOL WINAPI EndPath(_In_ HDC)
#define PS_JOIN_MITER
Definition: wingdi.h:598
BOOL WINAPI BeginPath(_In_ HDC hdc)
#define PS_SOLID
Definition: wingdi.h:586
#define PS_ENDCAP_FLAT
Definition: wingdi.h:596
BOOL WINAPI Pie(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)

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
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
const WCHAR * text
Definition: package.c:1799
@ DriverStringOptionsRealizedAdvance
Definition: gdiplusenums.h:49
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
Definition: mk_font.cpp:20
#define strlenW(s)
Definition: unicode.h:28

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){
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){
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
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
2079end:
2080 heap_free(pti);
2081 heap_free(ptcopy);
2082 heap_free(tp);
2083
2084 return status;
2085}
static void shorten_bezier_amt(GpPointF *pt, REAL amt, BOOL rev)
Definition: graphics.c:1923
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
static void shorten_line_amt(REAL x1, REAL y1, REAL *x2, REAL *y2, REAL amt)
Definition: graphics.c:1897
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
GpLineCap startcap
GpCustomLineCap * customend
GpLineCap endcap
GpBrush * brush
REAL width
GpCustomLineCap * customstart
Definition: cmds.c:130

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 {
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 {
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
static int end_x
Definition: maze.c:118
#define index(s, c)
Definition: various.h:29
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
GpStatus WINGDIPAPI GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height)
Definition: graphics.c:4537
@ DriverStringOptionsCmapLookup
Definition: gdiplusenums.h:47
GLuint index
Definition: glext.h:6031
#define INT_MAX
Definition: limits.h:40
REAL Y
Definition: gdiplustypes.h:662
int otmsUnderscorePosition
Definition: wingdi.h:2540
LONG cx
Definition: kdterminal.h:27
Definition: match.c:390
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)
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)

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
6014 sts = restore_container(graphics, container);
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
6029 if (graphics->image && graphics->image->type == ImageTypeMetafile) {
6030 if (type == BEGIN_CONTAINER)
6032 else
6034 }
6035
6036 return Ok;
6037}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void delete_container(GraphicsContainerItem *container)
Definition: graphics.c:2156
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
GpStatus METAFILE_EndContainer(GpMetafile *metafile, DWORD StackIndex) DECLSPEC_HIDDEN
Definition: metafile.c:1423
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
enum container_type type
Definition: metafile.c:156

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}
uint32_t ULONG_PTR
Definition: typedefs.h:65

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;
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);
7193 SetBkMode(graphics->hdc, TRANSPARENT);
7194 SetTextColor(graphics->hdc, get_gdi_brush_color(brush));
7195
7196 status = get_clip_hrgn(graphics, &hrgn);
7197
7198 if (status == Ok)
7199 {
7200 ExtSelectClipRgn(graphics->hdc, hrgn, RGN_COPY);
7202 }
7203
7204 pt = positions[0];
7206
7207 get_font_hfont(graphics, font, format, &hfont, matrix);
7208 SelectObject(graphics->hdc, hfont);
7209
7210 SetTextAlign(graphics->hdc, TA_BASELINE|TA_LEFT);
7211
7212 gdi_transform_acquire(graphics);
7213
7214 ExtTextOutW(graphics->hdc, gdip_round(pt.X), gdip_round(pt.Y), eto_flags, NULL, text, length, NULL);
7215
7216 gdi_transform_release(graphics);
7217
7218 RestoreDC(graphics->hdc, save_state);
7219
7221
7222 return Ok;
7223}
static HFONT hfont
static void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, HFONT *hfont, GDIPCONST GpMatrix *matrix)
Definition: graphics.c:2337
GpStatus gdi_transform_acquire(GpGraphics *graphics)
Definition: graphics.c:6842
GpStatus gdi_transform_release(GpGraphics *graphics)
Definition: graphics.c:6856
static INT gdip_round(REAL x)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
UINT WINAPI SetTextAlign(_In_ HDC, _In_ UINT)
Definition: text.c:883
#define TA_LEFT
Definition: wingdi.h:932
#define TRANSPARENT
Definition: wingdi.h:950
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)
#define TA_BASELINE
Definition: wingdi.h:928
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918

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
3658 ExtSelectClipRgn(graphics->hdc, hrgn, RGN_COPY);
3659
3660 gdi_transform_acquire(graphics);
3661
3662 retval = draw_poly(graphics, pen, path->pathdata.Points,
3663 path->pathdata.Types, path->pathdata.Count, TRUE);
3664
3665 gdi_transform_release(graphics);
3666
3667end:
3668 restore_dc(graphics, save_state);
3670
3671 return retval;
3672}
static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
Definition: graphics.c:244
static void restore_dc(GpGraphics *graphics, INT state)
Definition: graphics.c:310
static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *pt, GDIPCONST BYTE *types, INT count, BOOL caps)
Definition: graphics.c:1960

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
4333 if(!graphics->hdc || !brush_can_fill_path(brush, TRUE))
4334 return NotImplemented;
4335
4336 save_state = SaveDC(graphics->hdc);
4337 EndPath(graphics->hdc);
4338 SetPolyFillMode(graphics->hdc, (path->fill == FillModeAlternate ? ALTERNATE
4339 : WINDING));
4340
4341 retval = get_clip_hrgn(graphics, &hrgn);
4342
4343 if (retval != Ok)
4344 goto end;
4345
4346 ExtSelectClipRgn(graphics->hdc, hrgn, RGN_COPY);
4347
4348 gdi_transform_acquire(graphics);
4349
4350 BeginPath(graphics->hdc);
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
4360 gdi_transform_release(graphics);
4361
4362end:
4363 RestoreDC(graphics->hdc, save_state);
4365
4366 return retval;
4367}
#define WINDING
Definition: constants.h:279
#define ALTERNATE
Definition: constants.h:278
static GpStatus brush_fill_path(GpGraphics *graphics, GpBrush *brush)
Definition: graphics.c:1159
static BOOL brush_can_fill_path(GpBrush *brush, BOOL is_fill)
Definition: graphics.c:1131
@ FillModeAlternate
Definition: gdiplusenums.h:55
int WINAPI SetPolyFillMode(_In_ HDC, _In_ int)
Definition: dc.c:1167

Referenced by GdipFillPath().

◆ GDI32_GdipFillRegion()

static GpStatus GDI32_GdipFillRegion ( GpGraphics graphics,
GpBrush brush,
GpRegion region 
)
static

Definition at line 4625 of file graphics.c.

4627{
4628 INT save_state;
4630 HRGN hrgn;
4631 RECT rc;
4632
4633 if(!graphics->hdc || !brush_can_fill_path(brush, TRUE))
4634 return NotImplemented;
4635
4636 save_state = SaveDC(graphics->hdc);
4637 EndPath(graphics->hdc);
4638
4639 hrgn = NULL;
4640 status = get_clip_hrgn(graphics, &hrgn);
4641 if (status != Ok)
4642 {
4643 RestoreDC(graphics->hdc, save_state);
4644 return status;
4645 }
4646
4647 ExtSelectClipRgn(graphics->hdc, hrgn, RGN_COPY);
4649
4650 status = GdipGetRegionHRgn(region, graphics, &hrgn);
4651 if (status != Ok)
4652 {
4653 RestoreDC(graphics->hdc, save_state);
4654 return status;
4655 }
4656
4657 ExtSelectClipRgn(graphics->hdc, hrgn, RGN_AND);
4659
4660 if (GetClipBox(graphics->hdc, &rc) != NULLREGION)
4661 {
4662 BeginPath(graphics->hdc);
4663 Rectangle(graphics->hdc, rc.left, rc.top, rc.right, rc.bottom);
4664 EndPath(graphics->hdc);
4665
4666 status = brush_fill_path(graphics, brush);
4667 }
4668
4669 RestoreDC(graphics->hdc, save_state);
4670
4671
4672 return status;
4673}
GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hrgn)
Definition: region.c:1194
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by GdipFillRegion().

◆ gdi_alpha_blend()

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

Definition at line 326 of file graphics.c.

328{
329 if (GetDeviceCaps(graphics->hdc, TECHNOLOGY) == DT_RASPRINTER &&
330 GetDeviceCaps(graphics->hdc, SHADEBLENDCAPS) == SB_NONE)
331 {
332 TRACE("alpha blending not supported by device, fallback to StretchBlt\n");
333
334 StretchBlt(graphics->hdc, dst_x, dst_y, dst_width, dst_height,
335 hdc, src_x, src_y, src_width, src_height, SRCCOPY);
336 }
337 else
338 {
339 BLENDFUNCTION bf;
340
341 bf.BlendOp = AC_SRC_OVER;
342 bf.BlendFlags = 0;
343 bf.SourceConstantAlpha = 255;
345
346 GdiAlphaBlend(graphics->hdc, dst_x, dst_y, dst_width, dst_height,
347 hdc, src_x, src_y, src_width, src_height, bf);
348 }
349}
BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heightDst, HDC hdcSrc, int xSrc, int ySrc, int widthSrc, int heightSrc, BLENDFUNCTION blendFunction)
#define AC_SRC_ALPHA
Definition: alphablend.c:9
#define TRACE(s)
Definition: solgame.cpp:4
BYTE BlendOp
Definition: wingdi.h:2759
BYTE BlendFlags
Definition: wingdi.h:2760
BYTE AlphaFormat
Definition: wingdi.h:2762
BYTE SourceConstantAlpha
Definition: wingdi.h:2761
#define AC_SRC_OVER
Definition: wingdi.h:1369
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define SRCCOPY
Definition: wingdi.h:333

Referenced by alpha_blend_hdc_pixels(), brush_fill_path(), and GdipDrawImagePointsRect().

◆ gdi_transform_acquire()

GpStatus gdi_transform_acquire ( GpGraphics graphics)

Definition at line 6842 of file graphics.c.

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

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

◆ gdi_transform_release()

GpStatus gdi_transform_release ( GpGraphics graphics)

Definition at line 6856 of file graphics.c.

6857{
6858 if (graphics->gdi_transform_acquire_count <= 0)
6859 {
6860 ERR("called without matching gdi_transform_acquire\n");
6861 return GenericError;
6862 }
6863 if (graphics->gdi_transform_acquire_count == 1 && graphics->hdc)
6864 {
6865 RestoreDC(graphics->hdc, graphics->gdi_transform_save);
6866 }
6867 graphics->gdi_transform_acquire_count--;
6868 return Ok;
6869}

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

◆ gdip_format_string()

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

Definition at line 5201 of file graphics.c.

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

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

◆ gdip_transform_points()

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

◆ GdipBeginContainer()

GpStatus WINGDIPAPI GdipBeginContainer ( GpGraphics graphics,
GDIPCONST GpRectF dstrect,
GDIPCONST GpRectF srcrect,
GpUnit  unit,
GraphicsContainer state 
)

Definition at line 5924 of file graphics.c.

5925{
5928 GpStatus stat;
5929 GpRectF scaled_srcrect;
5930 REAL scale_x, scale_y;
5931
5932 TRACE("(%p, %s, %s, %d, %p)\n", graphics, debugstr_rectf(dstrect), debugstr_rectf(srcrect), unit, state);
5933
5934 if(!graphics || !dstrect || !srcrect || unit < UnitPixel || unit > UnitMillimeter || !state)
5935 return InvalidParameter;
5936
5938 if(stat != Ok)
5939 return stat;
5940
5941 list_add_head(&graphics->containers, &container->entry);
5942 *state = graphics->contid = container->contid;
5943
5944 scale_x = units_to_pixels(1.0, unit, graphics->xres);
5945 scale_y = units_to_pixels(1.0, unit, graphics->yres);
5946
5947 scaled_srcrect.X = scale_x * srcrect->X;
5948 scaled_srcrect.Y = scale_y * srcrect->Y;
5949 scaled_srcrect.Width = scale_x * srcrect->Width;
5950 scaled_srcrect.Height = scale_y * srcrect->Height;
5951
5952 transform.matrix[0] = dstrect->Width / scaled_srcrect.Width;
5953 transform.matrix[1] = 0.0;
5954 transform.matrix[2] = 0.0;
5955 transform.matrix[3] = dstrect->Height / scaled_srcrect.Height;
5956 transform.matrix[4] = dstrect->X - scaled_srcrect.X;
5957 transform.matrix[5] = dstrect->Y - scaled_srcrect.Y;
5958
5960
5961 if (graphics->image && graphics->image->type == ImageTypeMetafile) {
5962 METAFILE_BeginContainer((GpMetafile*)graphics->image, dstrect, srcrect, unit, container->contid);
5963 }
5964
5965 return Ok;
5966}
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, GpMatrixOrder order)
Definition: matrix.c:240
const char * debugstr_rectf(const RectF *rc)
Definition: gdiplus.c:476
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
Definition: gdiplus.c:327
GpStatus METAFILE_BeginContainer(GpMetafile *metafile, GDIPCONST GpRectF *dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, DWORD StackIndex) DECLSPEC_HIDDEN
Definition: metafile.c:1376
@ MatrixOrderPrepend
Definition: gdiplusenums.h:188
@ UnitMillimeter
Definition: gdiplusenums.h:33
GLuint GLenum GLenum transform
Definition: glext.h:9407
png_const_structrp png_const_inforp int * unit
Definition: png.h:2159
GpMatrix worldtrans

Referenced by GdipBeginContainerI(), test_container_rects(), and test_containers().

◆ GdipBeginContainer2()

GpStatus WINGDIPAPI GdipBeginContainer2 ( GpGraphics graphics,
GraphicsContainer state 
)

Definition at line 5917 of file graphics.c.

5919{
5920 TRACE("(%p, %p)\n", graphics, state);
5921 return begin_container(graphics, BEGIN_CONTAINER, state);
5922}
static GpStatus begin_container(GpGraphics *graphics, GraphicsContainerType type, GraphicsContainer *state)
Definition: graphics.c:5885

Referenced by GdipEnumerateMetafileSrcRectDestPoints(), GdipPlayMetafileRecord(), test_BeginContainer2(), test_containers(), and test_save_restore().

◆ GdipBeginContainerI()

GpStatus WINGDIPAPI GdipBeginContainerI ( GpGraphics graphics,
GDIPCONST GpRect dstrect,
GDIPCONST GpRect srcrect,
GpUnit  unit,
GraphicsContainer state 
)

Definition at line 5968 of file graphics.c.

5969{
5970 GpRectF dstrectf, srcrectf;
5971
5972 TRACE("(%p, %p, %p, %d, %p)\n", graphics, dstrect, srcrect, unit, state);
5973
5974 if (!dstrect || !srcrect)
5975 return InvalidParameter;
5976
5977 dstrectf.X = dstrect->X;
5978 dstrectf.Y = dstrect->Y;
5979 dstrectf.Width = dstrect->Width;
5980 dstrectf.Height = dstrect->Height;
5981
5982 srcrectf.X = srcrect->X;
5983 srcrectf.Y = srcrect->Y;
5984 srcrectf.Width = srcrect->Width;
5985 srcrectf.Height = srcrect->Height;
5986
5987 return GdipBeginContainer(graphics, &dstrectf, &srcrectf, unit, state);
5988}
GpStatus WINGDIPAPI GdipBeginContainer(GpGraphics *graphics, GDIPCONST GpRectF *dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state)
Definition: graphics.c:5924

◆ GdipComment()

GpStatus WINGDIPAPI GdipComment ( GpGraphics graphics,
UINT  sizeData,
GDIPCONST BYTE data 
)

Definition at line 5990 of file graphics.c.

5991{
5992 FIXME("(%p, %d, %p): stub\n", graphics, sizeData, data);
5993 return NotImplemented;
5994}

◆ GdipCreateFromHDC()

GpStatus WINGDIPAPI GdipCreateFromHDC ( HDC  hdc,
GpGraphics **  graphics 
)

Definition at line 2395 of file graphics.c.

2396{
2397 TRACE("(%p, %p)\n", hdc, graphics);
2398
2399 return GdipCreateFromHDC2(hdc, NULL, graphics);
2400}
GpStatus WINGDIPAPI GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **graphics)
Definition: graphics.c:2416

Referenced by check_metafile(), GdipAddPathString(), GdipCreateFromHWND(), GdipGetImageGraphicsContext(), get_path_hrgn(), test_alpha_hdc(), test_BeginContainer2(), test_bitmapfromgraphics(), test_clip_xform(), test_cliphrgn_transform(), test_clipping(), test_clipping_2(), test_constructor_destructor(), test_container_rects(), test_font_height_scaling(), test_font_metrics(), test_font_substitution(), test_font_transform(), test_fromhrgn(), test_GdipCreateRegionRgnData(), test_GdipDrawArc(), test_GdipDrawArcI(), test_GdipDrawBezierI(), test_GdipDrawCurve(), test_GdipDrawCurve2(), test_GdipDrawCurve2I(), test_GdipDrawCurve3(), test_GdipDrawCurve3I(), test_GdipDrawCurveI(), test_GdipDrawImagePointsRect(), test_GdipDrawImagePointsRectOnMemoryDC(), test_GdipDrawLineI(), test_GdipDrawLinesI(), test_GdipDrawString(), test_GdipFillClosedCurve(), test_GdipFillClosedCurve2(), test_GdipFillClosedCurve2I(), test_GdipFillClosedCurveI(), test_GdipFillPath(), test_GdipFillRectangles(), test_GdipFillRectanglesOnMemoryDCSolidBrush(), test_GdipFillRectanglesOnMemoryDCTextureBrush(), test_GdipGetNearestColor(), test_GdipGetVisibleClipBounds(), test_GdipGetVisibleClipBounds_memoryDC(), test_GdipGetVisibleClipBounds_screen(), test_GdipGetVisibleClipBounds_window(), test_GdipGraphicsSetAbort(), test_GdipIsVisiblePoint(), test_GdipIsVisibleRect(), test_Get_Release_DC(), test_get_set_clip(), test_get_set_interpolation(), test_get_set_textrenderinghint(), test_getbounds(), test_gethrgn(), test_hdc_caching(), test_isempty(), test_isequal(), test_isinfinite(), test_isvisible(), test_isvisiblepoint(), test_isvisiblerect(), test_logfont(), test_measure_string(), test_measured_extra_space(), test_save_restore(), test_string_functions(), test_textcontrast(), test_texturewrap(), test_transform(), test_transformpoints(), test_translate(), and ZoomWnd_OnDraw().

◆ GdipCreateFromHDC2()

GpStatus WINGDIPAPI GdipCreateFromHDC2 ( HDC  hdc,
HANDLE  hDevice,
GpGraphics **  graphics 
)

Definition at line 2416 of file graphics.c.

2417{
2418 GpStatus retval;
2421
2422 TRACE("(%p, %p, %p)\n", hdc, hDevice, graphics);
2423
2424 if(hDevice != NULL)
2425 FIXME("Don't know how to handle parameter hDevice\n");
2426
2427 if(hdc == NULL)
2428 return OutOfMemory;
2429
2430 if(graphics == NULL)
2431 return InvalidParameter;
2432
2433 *graphics = heap_alloc_zero(sizeof(GpGraphics));
2434 if(!*graphics) return OutOfMemory;
2435
2436 GdipSetMatrixElements(&(*graphics)->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
2437
2438 if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){
2439 heap_free(*graphics);
2440 return retval;
2441 }
2442
2444 if (hbitmap && GetObjectW(hbitmap, sizeof(dib), &