|
1 | 1 | using System; |
2 | | -using System.Collections.Generic; |
3 | 2 | using System.Diagnostics; |
4 | 3 | using System.IO; |
5 | | -using System.Linq; |
6 | 4 | using System.Numerics; |
7 | 5 | using Pchp.Core; |
8 | 6 | using Pchp.Library.Streams; |
9 | 7 | using SixLabors.Fonts; |
10 | 8 | using SixLabors.ImageSharp; |
11 | | -using SixLabors.ImageSharp.Advanced; |
12 | 9 | using SixLabors.ImageSharp.Drawing; |
13 | 10 | using SixLabors.ImageSharp.Drawing.Processing; |
14 | 11 | using SixLabors.ImageSharp.Formats; |
@@ -53,7 +50,7 @@ public static class PhpGd2 |
53 | 50 | public const string GD_EXTRA_VERSION = ""; //"beta"; |
54 | 51 |
|
55 | 52 | /// <summary> |
56 | | - /// When the bundled version of GD is used this is 1 otherwise its set to 0. |
| 53 | + /// When the bundled version of GD is used, this is 1 otherwise it's set to 0. |
57 | 54 | /// </summary> |
58 | 55 | public const int GD_BUNDLED = 1; |
59 | 56 |
|
@@ -186,12 +183,12 @@ public enum FilledArcStyles |
186 | 183 | public enum ColorValues |
187 | 184 | { |
188 | 185 | /// <summary> |
189 | | - /// Special color option which can be used in stead of color allocated with <see cref="imagecolorallocate"/> or <see cref="imagecolorallocatealpha"/>. |
| 186 | + /// Special color option which can be used instead of color allocated with <see cref="imagecolorallocate"/> or <see cref="imagecolorallocatealpha"/>. |
190 | 187 | /// </summary> |
191 | 188 | STYLED = -2, |
192 | 189 |
|
193 | 190 | /// <summary> |
194 | | - /// Special color option which can be used in stead of color allocated with <see cref="imagecolorallocate"/> or <see cref="imagecolorallocatealpha"/>. |
| 191 | + /// Special color option which can be used instead of color allocated with <see cref="imagecolorallocate"/> or <see cref="imagecolorallocatealpha"/>. |
195 | 192 | /// </summary> |
196 | 193 | BRUSHED = -3, |
197 | 194 |
|
@@ -227,51 +224,51 @@ public enum ColorValues |
227 | 224 | public enum FilterTypes |
228 | 225 | { |
229 | 226 | /// <summary> |
230 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 227 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
231 | 228 | /// </summary> |
232 | 229 | NEGATE, |
233 | 230 | /// <summary> |
234 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 231 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
235 | 232 | /// </summary> |
236 | 233 | GRAYSCALE, |
237 | 234 | /// <summary> |
238 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 235 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
239 | 236 | /// </summary> |
240 | 237 | BRIGHTNESS, |
241 | 238 | /// <summary> |
242 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 239 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
243 | 240 | /// </summary> |
244 | 241 | CONTRAST, |
245 | 242 | /// <summary> |
246 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 243 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
247 | 244 | /// </summary> |
248 | 245 | COLORIZE, |
249 | 246 | /// <summary> |
250 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 247 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
251 | 248 | /// </summary> |
252 | 249 | EDGEDETECT, |
253 | 250 | /// <summary> |
254 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 251 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
255 | 252 | /// </summary> |
256 | 253 | EMBOSS, |
257 | 254 | /// <summary> |
258 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 255 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
259 | 256 | /// </summary> |
260 | 257 | GAUSSIAN_BLUR, |
261 | 258 | /// <summary> |
262 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 259 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
263 | 260 | /// </summary> |
264 | 261 | SELECTIVE_BLUR, |
265 | 262 | /// <summary> |
266 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 263 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
267 | 264 | /// </summary> |
268 | 265 | MEAN_REMOVAL, |
269 | 266 | /// <summary> |
270 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 267 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
271 | 268 | /// </summary> |
272 | 269 | SMOOTH, |
273 | 270 | /// <summary> |
274 | | - /// Special GD filter used by the <see cref="imagefilter(PhpResource,int)"/> function. |
| 271 | + /// Special GD filter used by the <see cref="imagefilter"/> function. |
275 | 272 | /// </summary> |
276 | 273 | PIXELATE, |
277 | 274 | } |
@@ -1032,8 +1029,13 @@ public static bool imagerectangle(PhpResource im, int x1, int y1, int x2, int y2 |
1032 | 1029 |
|
1033 | 1030 | var rect = new RectangleF(x1, y1, x2 - x1, y2 - y1); |
1034 | 1031 |
|
1035 | | - var opt = new DrawingOptions(); |
1036 | | - opt.GraphicsOptions.Antialias = img.AntiAlias; |
| 1032 | + var opt = new DrawingOptions |
| 1033 | + { |
| 1034 | + GraphicsOptions = |
| 1035 | + { |
| 1036 | + Antialias = img.AntiAlias |
| 1037 | + } |
| 1038 | + }; |
1037 | 1039 |
|
1038 | 1040 | img.Image.Mutate(o => o.Draw(opt, FromRGBA(col), 1.0f, rect)); |
1039 | 1041 |
|
@@ -1356,8 +1358,8 @@ public static bool imagegd(PhpResource im) |
1356 | 1358 | /// </summary> |
1357 | 1359 | /// <param name="ctx">Runtime context.</param> |
1358 | 1360 | /// <param name="im">Image resource.</param> |
1359 | | - /// <param name="to">Optional. Filename or stream. If not specified the function saves the image to output stream.</param> |
1360 | | - /// <param name="saveaction">Callback that actually save the image to given stream. Called when all checks pass.</param> |
| 1361 | + /// <param name="to">Optional. Filename or stream. If not specified, the function saves the image to output stream.</param> |
| 1362 | + /// <param name="saveaction">Callback that actually saves the image to given stream. Called when all checks pass.</param> |
1361 | 1363 | /// <returns>True if save succeeded.</returns> |
1362 | 1364 | static bool imagesave(Context ctx, PhpResource im, PhpValue to/* = null*/, Action<Image<Rgba32>, Stream> saveaction) |
1363 | 1365 | { |
|
0 commit comments