Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 6b9163b

Browse files
committed
[[ Graphics ]] Paint Objects
This patch changes the distinct paint attributes in MCGContextRef to be a new MCGPaintRef type. The MCGPaintRef type inherits from an ref-counted MCGObjectRef type which is implemented as a partially concrete C++ class. There are specific paint types for solid color, patterns and gradients. Filling or stroking can be disabled by setting the relevant paint to none.
1 parent d0da592 commit 6b9163b

10 files changed

Lines changed: 1438 additions & 1525 deletions

File tree

libgraphics/include/graphics.h

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,11 @@ enum MCGGradientFunction
450450
static const intenum_t kMCGGradientFunctionCount = 7;
451451

452452

453-
enum MCGGradientTileMode
453+
enum MCGGradientSpreadMethod
454454
{
455-
kMCGGradientTileModeClamp,
456-
kMCGGradientTileModeRepeat,
457-
kMCGGradientTileModeMirror,
455+
kMCGGradientSpreadMethodPad,
456+
kMCGGradientSpreadMethodReflect,
457+
kMCGGradientSpreadMethodRepeat,
458458
};
459459

460460
enum MCGMaskFormat
@@ -926,13 +926,15 @@ void MCGContextClipToRegion(MCGContextRef self, MCGRegionRef p_region);
926926
// Fill attributes
927927
void MCGContextSetFillRule(MCGContextRef context, MCGFillRule rule);
928928
void MCGContextSetFillOpacity(MCGContextRef context, MCGFloat opacity);
929+
void MCGContextSetFillNone(MCGContextRef context);
929930
void MCGContextSetFillRGBAColor(MCGContextRef context, MCGFloat red, MCGFloat green, MCGFloat blue, MCGFloat alpha);
930931
void MCGContextSetFillPattern(MCGContextRef context, MCGImageRef image, MCGAffineTransform transform, MCGImageFilter filter);
931932
void MCGContextSetFillGradient(MCGContextRef context, MCGGradientFunction function, const MCGFloat* stops, const MCGColor* colors, uindex_t ramp_length, bool mirror, bool wrap, uint32_t repeats, MCGAffineTransform transform, MCGImageFilter filter);
932933
void MCGContextSetFillPaintStyle(MCGContextRef context, MCGPaintStyle style);
933934

934935
// Stroke attributes
935936
void MCGContextSetStrokeOpacity(MCGContextRef context, MCGFloat opacity);
937+
void MCGContextSetStrokeNone(MCGContextRef context);
936938
void MCGContextSetStrokeRGBAColor(MCGContextRef context, MCGFloat red, MCGFloat green, MCGFloat blue, MCGFloat alpha);
937939
void MCGContextSetStrokePattern(MCGContextRef context, MCGImageRef image, MCGAffineTransform transform, MCGImageFilter filter);
938940
void MCGContextSetStrokeGradient(MCGContextRef context, MCGGradientFunction function, const MCGFloat* stops, const MCGColor* colors, uindex_t ramp_length, bool mirror, bool wrap, uint32_t repeats, MCGAffineTransform transform, MCGImageFilter filter);
@@ -997,24 +999,14 @@ void MCGContextFillAndStroke(MCGContextRef context);
997999
// Intersects the current clipping path with the current path; the inside of the current
9981000
// path is determined with the current fill rule. This discards the path.
9991001
void MCGContextClip(MCGContextRef context);
1000-
// Replace the current path by one thickened using the current stroke attributes.
1001-
void MCGContextThicken(MCGContextRef context);
1002-
// Replace the current path by one entirely consisting of moveto, lineto and close commands.
1003-
void MCGContextFlatten(MCGContextRef context);
1004-
// Replace the current path by one consisting of no overlapping subpaths or self
1005-
// intersections. Interior is determined by current fill rule.
1006-
void MCGContextSimplify(MCGContextRef context);
10071002

10081003
void MCGContextDrawPixels(MCGContextRef context, const MCGRaster& raster, MCGRectangle dst_rect, MCGImageFilter filter);
10091004
void MCGContextDrawImage(MCGContextRef context, MCGImageRef image, MCGRectangle dst_rect, MCGImageFilter filter);
10101005
void MCGContextDrawImageWithCenter(MCGContextRef context, MCGImageRef image, MCGRectangle image_center, MCGRectangle dst_rect, MCGImageFilter filter);
10111006
void MCGContextDrawRectOfImage(MCGContextRef self, MCGImageRef p_image, MCGRectangle p_src, MCGRectangle p_dst, MCGImageFilter p_filter);
1012-
void MCGContextDrawDeviceMask(MCGContextRef context, MCGMaskRef mask, int32_t tx, int32_t ty);
10131007

10141008
bool MCGContextCopyImage(MCGContextRef context, MCGImageRef &r_image);
10151009

1016-
void MCGContextDrawText(MCGContextRef context, const char* text, uindex_t length, MCGPoint location, uint32_t font_size, void *typeface);
1017-
MCGFloat MCGContextMeasureText(MCGContextRef context, const char *text, uindex_t length, uint32_t font_size, void *typeface);
10181010
void MCGContextDrawPlatformText(MCGContextRef context, const unichar_t *text, uindex_t length, MCGPoint location, const MCGFont &font, bool p_rtl);
10191011
// MM-2014-04-16: [[ Bug 11964 ]] Updated prototype to take transform parameter.
10201012
MCGFloat MCGContextMeasurePlatformText(MCGContextRef context, const unichar_t *text, uindex_t length, const MCGFont &p_font, const MCGAffineTransform &p_transform);

0 commit comments

Comments
 (0)