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

Commit b50fbd1

Browse files
committed
[[ CanvasPathArcTo ]] Implement MCGPathArcTo function compatible with svg elliptical arc path command.
[[ CanvasPathArcTo ]] Swap names of incorrectly named MCGPathAddSegment, MCGPathAddSector functions. [[ CanvasPathArcTo ]] Implement rotation parameter of MCGPathAddEllipse, MCGPathAddArc, MCGPathAddSector, MCGPathAddSegment functions
1 parent 67c53bc commit b50fbd1

File tree

3 files changed

+306
-35
lines changed

3 files changed

+306
-35
lines changed

engine/src/image_rep_mutable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ MCRectangle MCMutableImageRep::drawoval()
14491449
if (MCarcangle != 0 && MCarcangle % 360 == 0)
14501450
MCGPathAddArc(t_path, t_center, t_radii, 0.0, 360 - (MCstartangle + MCarcangle), 360 - MCstartangle);
14511451
else
1452-
MCGPathAddSegment(t_path, t_center, t_radii, 0.0, 360 - (MCstartangle + MCarcangle), 360 - MCstartangle);
1452+
MCGPathAddSector(t_path, t_center, t_radii, 0.0, 360 - (MCstartangle + MCarcangle), 360 - MCstartangle);
14531453

14541454
draw_path(t_path);
14551455

libgraphics/include/graphics.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,21 @@ inline MCGPoint MCGPointMake(MCGFloat p_x, MCGFloat p_y)
621621
return t_point;
622622
}
623623

624+
inline MCGPoint MCGPointTranslate(const MCGPoint &p_point, MCGFloat p_dx, MCGFloat p_dy)
625+
{
626+
return MCGPointMake(p_point.x + p_dx, p_point.y + p_dy);
627+
}
628+
629+
inline MCGPoint MCGPointScale(const MCGPoint &p_point, MCGFloat p_h_scale, MCGFloat p_v_scale)
630+
{
631+
return MCGPointMake(p_point.x * p_h_scale, p_point.y * p_v_scale);
632+
}
633+
634+
inline MCGPoint MCGPointScale(const MCGPoint &p_point, MCGFloat p_scale)
635+
{
636+
return MCGPointScale(p_point, p_scale, p_scale);
637+
}
638+
624639
inline MCGSize MCGSizeMake(MCGFloat p_w, MCGFloat p_h)
625640
{
626641
MCGSize t_size;
@@ -775,6 +790,7 @@ void MCGPathSimplify(MCGPathRef path, MCGPathRef& r_simple_path);
775790

776791
bool MCGPathTransform(MCGPathRef path, const MCGAffineTransform &p_transform);
777792

793+
bool MCGPathGetLastPoint(MCGPathRef self, MCGPoint &r_last);
778794
bool MCGPathGetBoundingBox(MCGPathRef path, MCGRectangle &r_bounds);
779795

780796
typedef bool (*MCGPathIterateCallback)(void *p_context, MCGPathCommand p_command, MCGPoint *p_points, uint32_t p_point_count);

0 commit comments

Comments
 (0)