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

Commit 7f6b1db

Browse files
author
Monte Goulding
authored
Merge pull request #6212 from runrevmark/feature-svg_revision_1
[[ SVG ]] Revisions
2 parents 3171d01 + fb03d95 commit 7f6b1db

File tree

9 files changed

+1087
-484
lines changed

9 files changed

+1087
-484
lines changed

engine/src/graphicscontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ void MCGraphicsContext::drawpict(uint1 *data, uint4 length, bool embed, const MC
12341234
{
12351235
MCGContextSave(m_gcontext);
12361236
MCGContextClipToRect(m_gcontext, MCRectangleToMCGRectangle(crect));
1237-
MCGContextPlayback(m_gcontext, MCRectangleToMCGRectangle(drect), data, length);
1237+
MCGContextPlayback(m_gcontext, MCRectangleToMCGRectangle(drect), MCMakeSpan(static_cast<const byte_t*>(data), length));
12381238
MCGContextRestore(m_gcontext);
12391239
}
12401240

extensions/libraries/canvas/canvas.lcb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,19 @@ public handler canvasApplyToImage(in pObjectId as String) returns nothing
129129
set property "imageData" of tObject to the pixel data of sCanvas
130130
end handler
131131

132+
/*
133+
Summary: Returns the bounding box of an SVG path.
134+
pPath: The SVG Path string to process
135+
Description:
136+
Parses the SVG path string and computes the tight bounding box.
137+
*/
138+
public handler canvasComputeBoundingBoxOfPath(in pPathString as String) returns Array
139+
variable tPath as Path
140+
put path pPathString into tPath
141+
142+
variable tBBox as Rectangle
143+
put the bounding box of tPath into tBBox
144+
return { "left": the left of tBBox, "top": the top of tBBox, "right": the right of tBBox, "bottom": the bottom of tBBox }
145+
end handler
146+
132147
end library

extensions/script-libraries/drawing/drawing-svg-specification.txt

Lines changed: 78 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
element
2-
property fill <paint>|inherit default black
3-
property fill-rule nonzero|evenodd|inherit default nonzero
4-
property fill-opacity <opacity>|inherit default 1
5-
property stroke <paint>|inherit default none
6-
property stroke-width <length>|inherit default 1
7-
property stroke-linecap butt|round|square|inherit default butt
8-
property stroke-linejoin miter|round|bevel|inherit default miter
9-
property stroke-miterlimit <miterlimit>|inherit default 4
10-
property stroke-dasharray <dasharray>|inherit default none
11-
property stroke-dashoffset <length>|inherit default 0
12-
property stroke-opacity <opacity>|inherit default 1
2+
property fill <paint>|inherit default black inheritable
3+
property fill-rule nonzero|evenodd|inherit default nonzero inheritable
4+
property fill-opacity <opacity>|inherit default 1 inheritable
5+
property stroke <paint>|inherit default none inheritable
6+
property stroke-width <length>|inherit default 1 inheritable
7+
property stroke-linecap butt|round|square|inherit default butt inheritable
8+
property stroke-linejoin miter|round|bevel|inherit default miter inheritable
9+
property stroke-miterlimit <miterlimit>|inherit default 4 inheritable
10+
property stroke-dasharray <dasharray>|inherit default none inheritable
11+
property stroke-dashoffset <length>|inherit default 0 inheritable
12+
property stroke-opacity <opacity>|inherit default 1 inheritable
13+
property solid-color <color>|inherit default black
14+
property solid-opacity <opacity>|inherit default 1
15+
property stop-color <color>|inherit default black
16+
property stop-opacity <opacity>|inherit default 1
1317

1418
element svg
1519
attribute id <identifier> nullable
20+
attribute xml:id <identifier> nullable
1621
attribute style <text> nullable
1722
attribute version 1.0|1.1|1.2 nullable
1823
attribute baseProfile none|full|basic|tiny default none
@@ -25,26 +30,30 @@ element svg
2530

2631
element defs
2732
attribute id <identifier> nullable
33+
attribute xml:id <identifier> nullable
2834
attribute style <text> nullable
2935

3036
element use
3137
attribute id <identifier> nullable
38+
attribute xml:id <identifier> nullable
3239
attribute style <text> nullable
33-
attribute transform <transform> nullable
40+
attribute transform <transform> default ""
3441
attribute x <coordinate> default 0
3542
attribute y <coordinate> default 0
3643
attribute href <reference> nullable
3744
attribute xlink:href <reference> nullable
3845

3946
element g
4047
attribute id <identifier> nullable
48+
attribute xml:id <identifier> nullable
4149
attribute style <text> nullable
42-
attribute transform <transform> nullable
50+
attribute transform <transform> default ""
4351

4452
element rect
4553
attribute id <identifier> nullable
54+
attribute xml:id <identifier> nullable
4655
attribute style <text> nullable
47-
attribute transform <transform> nullable
56+
attribute transform <transform> default ""
4857
attribute x <coordinate> default 0
4958
attribute y <coordinate> default 0
5059
attribute width <nonnegative-length> default 0
@@ -65,8 +74,9 @@ element rect
6574

6675
element circle
6776
attribute id <identifier> nullable
77+
attribute xml:id <identifier> nullable
6878
attribute style <text> nullable
69-
attribute transform <transform> nullable
79+
attribute transform <transform> default ""
7080
attribute cx <coordinate> default 0
7181
attribute cy <coordinate> default 0
7282
attribute r <nonnegative-length> default 0
@@ -84,8 +94,9 @@ element circle
8494

8595
element ellipse
8696
attribute id <identifier> nullable
97+
attribute xml:id <identifier> nullable
8798
attribute style <text> nullable
88-
attribute transform <transform> nullable
99+
attribute transform <transform> default ""
89100
attribute cx <coordinate> default 0
90101
attribute cy <coordinate> default 0
91102
attribute rx <nonnegative-length> default 0
@@ -104,8 +115,9 @@ element ellipse
104115

105116
element line
106117
attribute id <identifier> nullable
118+
attribute xml:id <identifier> nullable
107119
attribute style <text> nullable
108-
attribute transform <transform> nullable
120+
attribute transform <transform> default ""
109121
attribute x1 <coordinate> default 0
110122
attribute y1 <coordinate> default 0
111123
attribute x2 <coordinate> default 0
@@ -124,8 +136,9 @@ element line
124136

125137
element polyline
126138
attribute id <identifier> nullable
139+
attribute xml:id <identifier> nullable
127140
attribute style <text> nullable
128-
attribute transform <transform> nullable
141+
attribute transform <transform> default ""
129142
attribute points <points> default ""
130143
apply fill
131144
apply fill-rule
@@ -141,8 +154,9 @@ element polyline
141154

142155
element polygon
143156
attribute id <identifier> nullable
157+
attribute xml:id <identifier> nullable
144158
attribute style <text> nullable
145-
attribute transform <transform> nullable
159+
attribute transform <transform> default ""
146160
attribute points <points> default ""
147161
apply fill
148162
apply fill-rule
@@ -158,8 +172,9 @@ element polygon
158172

159173
element path
160174
attribute id <identifier> nullable
175+
attribute xml:id <identifier> nullable
161176
attribute style <text> nullable
162-
attribute transform <transform> nullable
177+
attribute transform <transform> default ""
163178
attribute d <path> default ""
164179
attribute pathLength <nonnegative-length> nullable
165180
apply fill
@@ -174,3 +189,46 @@ element path
174189
apply stroke-dashoffset
175190
apply stroke-opacity
176191

192+
element solidColor
193+
attribute id <identifier> nullable
194+
attribute xml:id <identifier> nullable
195+
attribute style <text> nullable
196+
apply solid-opacity
197+
apply solid-color
198+
199+
element linearGradient
200+
attribute id <identifier> nullable
201+
attribute xml:id <identifier> nullable
202+
attribute style <text> nullable
203+
attribute x1 <coordinate> nullable
204+
attribute y1 <coordinate> nullable
205+
attribute x2 <coordinate> nullable
206+
attribute y2 <coordinate> nullable
207+
attribute gradientTransform <transform> nullable
208+
attribute gradientUnits userSpaceOnUse|objectBoundingBox nullable
209+
attribute spreadMethod pad|reflect|repeat nullable
210+
attribute href <reference> nullable
211+
attribute xlink:href <reference> nullable
212+
213+
element radialGradient
214+
attribute id <identifier> nullable
215+
attribute xml:id <identifier> nullable
216+
attribute style <text> nullable
217+
attribute cx <coordinate> nullable
218+
attribute cy <coordinate> nullable
219+
attribute r <length> nullable
220+
attribute gradientTransform <transform> nullable
221+
attribute gradientUnits userSpaceOnUse|objectBoundingBox nullable
222+
attribute spreadMethod pad|reflect|repeat nullable
223+
attribute href <reference> nullable
224+
attribute xlink:href <reference> nullable
225+
226+
element stop
227+
attribute id <identifier> nullable
228+
attribute xml:id <identifier> nullable
229+
attribute style <text> nullable
230+
attribute offset <opacity> nullable
231+
apply stop-color
232+
apply stop-opacity
233+
234+

0 commit comments

Comments
 (0)