rmagick 2.8.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- data/ChangeLog +10 -2
- data/README.html +7 -7
- data/doc/comtasks.html +2 -2
- data/doc/constants.html +5 -5
- data/doc/draw.html +131 -20
- data/doc/ex/InitialCoords.rb +1 -1
- data/doc/ex/NewCoordSys.rb +2 -2
- data/doc/ex/OrigCoordSys.rb +1 -1
- data/doc/ex/RotateScale.rb +2 -2
- data/doc/ex/Skew.rb +2 -2
- data/doc/ex/ViewBox.rb +1 -1
- data/doc/ex/arc.rb +4 -2
- data/doc/ex/arcs02.rb +1 -1
- data/doc/ex/bounding_box.rb +3 -0
- data/doc/ex/cbezier1.rb +2 -0
- data/doc/ex/cbezier2.rb +2 -0
- data/doc/ex/cbezier3.rb +2 -0
- data/doc/ex/cbezier4.rb +2 -0
- data/doc/ex/cbezier5.rb +2 -0
- data/doc/ex/cbezier6.rb +2 -0
- data/doc/ex/channel.rb +1 -0
- data/doc/ex/circle.rb +2 -0
- data/doc/ex/cubic01.rb +1 -1
- data/doc/ex/cubic02.rb +1 -1
- data/doc/ex/ellipse.rb +2 -0
- data/doc/ex/font_styles.rb +12 -10
- data/doc/ex/get_type_metrics.rb +2 -0
- data/doc/ex/grav.rb +2 -0
- data/doc/ex/image.rb +1 -1
- data/doc/ex/line.rb +2 -0
- data/doc/ex/opacity.rb +6 -4
- data/doc/ex/path.rb +2 -0
- data/doc/ex/polaroid.rb +2 -0
- data/doc/ex/qbezierpath.rb +3 -0
- data/doc/ex/rectangle.rb +2 -0
- data/doc/ex/rotate.rb +2 -0
- data/doc/ex/roundrect.rb +2 -0
- data/doc/ex/skewx.rb +2 -0
- data/doc/ex/skewy.rb +2 -0
- data/doc/ex/stroke_dasharray.rb +2 -0
- data/doc/ex/stroke_width.rb +2 -0
- data/doc/ex/text.rb +3 -2
- data/doc/ex/text01.rb +1 -1
- data/doc/ex/text_styles.rb +1 -1
- data/doc/ex/text_undercolor.rb +2 -0
- data/doc/ex/translate.rb +3 -1
- data/doc/ilist.html +2 -2
- data/doc/image1.html +2 -2
- data/doc/image2.html +2 -2
- data/doc/image3.html +37 -6
- data/doc/imageattrs.html +2 -2
- data/doc/imusage.html +3 -3
- data/doc/index.html +3 -3
- data/doc/info.html +2 -2
- data/doc/magick.html +2 -2
- data/doc/optequiv.html +24 -2
- data/doc/rvg.html +2 -2
- data/doc/rvgclip.html +2 -2
- data/doc/rvggroup.html +2 -2
- data/doc/rvgimage.html +2 -2
- data/doc/rvgpattern.html +2 -2
- data/doc/rvgshape.html +2 -2
- data/doc/rvgstyle.html +2 -2
- data/doc/rvgtext.html +2 -2
- data/doc/rvgtspan.html +2 -2
- data/doc/rvgtut.html +2 -2
- data/doc/rvguse.html +2 -2
- data/doc/rvgxform.html +2 -2
- data/doc/struct.html +2 -2
- data/doc/usage.html +6 -4
- data/ext/RMagick/MANIFEST +6 -1
- data/ext/RMagick/extconf.rb +18 -2
- data/ext/RMagick/rmagick.c +312 -0
- data/ext/RMagick/rmagick.h +137 -61
- data/ext/RMagick/rmdraw.c +271 -377
- data/ext/RMagick/rmenum.c +1016 -0
- data/ext/RMagick/rmimage.c +172 -16
- data/ext/RMagick/rminfo.c +5 -5
- data/ext/RMagick/rmmain.c +50 -303
- data/ext/RMagick/rmmontage.c +386 -0
- data/ext/RMagick/rmpixel.c +816 -0
- data/ext/RMagick/rmstruct.c +887 -0
- data/ext/RMagick/rmutil.c +25 -2634
- data/lib/RMagick.rb +46 -2
- data/lib/rvg/misc.rb +5 -4
- data/lib/rvg/stylable.rb +7 -1
- data/rmagick.gemspec +1 -1
- metadata +7 -2
data/ext/RMagick/rmdraw.c
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
/* $Id: rmdraw.c,v 1.
|
1
|
+
/* $Id: rmdraw.c,v 1.75 2008/12/31 00:46:45 rmagick Exp $ */
|
2
2
|
/*============================================================================\
|
3
3
|
| Copyright (C) 2008 by Timothy P. Hunter
|
4
4
|
| Name: rmdraw.c
|
5
5
|
| Author: Tim Hunter
|
6
6
|
| Purpose: Contains Draw class methods.
|
7
|
-
| Contains Montage class methods.
|
8
7
|
\============================================================================*/
|
9
8
|
|
10
9
|
#include "rmagick.h"
|
@@ -12,7 +11,6 @@
|
|
12
11
|
|
13
12
|
static void mark_Draw(void *);
|
14
13
|
static void destroy_Draw(void *);
|
15
|
-
static void destroy_Montage(void *);
|
16
14
|
static VALUE new_DrawOptions(void);
|
17
15
|
|
18
16
|
typedef MagickBooleanType (get_type_metrics_func_t)(Image *, const DrawInfo *, TypeMetric *);
|
@@ -30,7 +28,7 @@ Draw_affine_eq(VALUE self, VALUE matrix)
|
|
30
28
|
|
31
29
|
rb_check_frozen(self);
|
32
30
|
Data_Get_Struct(self, Draw, draw);
|
33
|
-
|
31
|
+
Export_AffineMatrix(&draw->info->affine, matrix);
|
34
32
|
return self;
|
35
33
|
}
|
36
34
|
|
@@ -300,6 +298,274 @@ Draw_gravity_eq(VALUE self, VALUE grav)
|
|
300
298
|
}
|
301
299
|
|
302
300
|
|
301
|
+
/*
|
302
|
+
Method: Draw#kerning=float
|
303
|
+
Purpose: space between two letters
|
304
|
+
Notes: new for 6.4.7-8
|
305
|
+
*/
|
306
|
+
VALUE
|
307
|
+
Draw_kerning_eq(VALUE self, VALUE kerning)
|
308
|
+
{
|
309
|
+
#if defined(HAVE_ST_KERNING)
|
310
|
+
Draw *draw;
|
311
|
+
|
312
|
+
rb_check_frozen(self);
|
313
|
+
Data_Get_Struct(self, Draw, draw);
|
314
|
+
draw->info->kerning = NUM2DBL(kerning);
|
315
|
+
return self;
|
316
|
+
#else
|
317
|
+
rm_not_implemented();
|
318
|
+
return (VALUE)0;
|
319
|
+
self = self;
|
320
|
+
kerning = kerning;
|
321
|
+
#endif
|
322
|
+
}
|
323
|
+
|
324
|
+
|
325
|
+
/*
|
326
|
+
Method: Draw#interword_spacing
|
327
|
+
Purpose: space between two words
|
328
|
+
Notes: new for 6.4.8-0
|
329
|
+
*/
|
330
|
+
VALUE
|
331
|
+
Draw_interword_spacing_eq(VALUE self, VALUE spacing)
|
332
|
+
{
|
333
|
+
#if defined(HAVE_ST_INTERWORD_SPACING)
|
334
|
+
Draw *draw;
|
335
|
+
|
336
|
+
rb_check_frozen(self);
|
337
|
+
Data_Get_Struct(self, Draw, draw);
|
338
|
+
draw->info->interword_spacing = NUM2DBL(spacing);
|
339
|
+
return self;
|
340
|
+
#else
|
341
|
+
rm_not_implemented();
|
342
|
+
return (VALUE)0;
|
343
|
+
self = self;
|
344
|
+
spacing = spacing;
|
345
|
+
#endif
|
346
|
+
}
|
347
|
+
|
348
|
+
|
349
|
+
/*
|
350
|
+
Static: image_to_str
|
351
|
+
Purpose: Convert an image to a blob and the blob to a String
|
352
|
+
Notes: Returns Qnil if there is no image
|
353
|
+
*/
|
354
|
+
static VALUE
|
355
|
+
image_to_str(Image *image)
|
356
|
+
{
|
357
|
+
volatile VALUE dimg = Qnil;
|
358
|
+
unsigned char *blob;
|
359
|
+
size_t length;
|
360
|
+
Info *info;
|
361
|
+
ExceptionInfo exception;
|
362
|
+
|
363
|
+
if (image)
|
364
|
+
{
|
365
|
+
info = CloneImageInfo(NULL);
|
366
|
+
GetExceptionInfo(&exception);
|
367
|
+
blob = ImageToBlob(info, image, &length, &exception);
|
368
|
+
DestroyImageInfo(info);
|
369
|
+
CHECK_EXCEPTION();
|
370
|
+
DestroyExceptionInfo(&exception);
|
371
|
+
dimg = rb_str_new((char *)blob, (long)length);
|
372
|
+
magick_free((void*)blob);
|
373
|
+
}
|
374
|
+
|
375
|
+
return dimg;
|
376
|
+
}
|
377
|
+
|
378
|
+
|
379
|
+
/*
|
380
|
+
Static: str_to_image
|
381
|
+
Purpose: Undo the image_to_str, above.
|
382
|
+
Notes: Returns NULL if the argument is Qnil
|
383
|
+
*/
|
384
|
+
static
|
385
|
+
Image *str_to_image(VALUE str)
|
386
|
+
{
|
387
|
+
Image *image = NULL;
|
388
|
+
Info *info;
|
389
|
+
ExceptionInfo exception;
|
390
|
+
|
391
|
+
if (str != Qnil)
|
392
|
+
{
|
393
|
+
info = CloneImageInfo(NULL);
|
394
|
+
GetExceptionInfo(&exception);
|
395
|
+
image = BlobToImage(info, RSTRING_PTR(str), RSTRING_LEN(str), &exception);
|
396
|
+
DestroyImageInfo(info);
|
397
|
+
CHECK_EXCEPTION();
|
398
|
+
DestroyExceptionInfo(&exception);
|
399
|
+
}
|
400
|
+
|
401
|
+
return image;
|
402
|
+
}
|
403
|
+
|
404
|
+
|
405
|
+
/*
|
406
|
+
Method: Draw#marshal_dump
|
407
|
+
Purpose: Custom marshal for Draw objects
|
408
|
+
Notes: Instead of trying to replicate Ruby's support for cross-system
|
409
|
+
marshalling, exploit it. Convert the Draw fields to Ruby objects
|
410
|
+
and store them in a hash. Let Ruby marshal the hash.
|
411
|
+
|
412
|
+
Commented out code that dumps/loads fields that are used internally
|
413
|
+
by ImageMagick and shouldn't be marshaled. I left the code as
|
414
|
+
placeholders so I'll know which fields have been deliberately
|
415
|
+
omitted.
|
416
|
+
To do: Handle gradients when christy gets the new gradient support added (23Dec08)
|
417
|
+
*/
|
418
|
+
VALUE
|
419
|
+
Draw_marshal_dump(VALUE self)
|
420
|
+
{
|
421
|
+
Draw *draw;
|
422
|
+
VALUE ddraw;
|
423
|
+
|
424
|
+
Data_Get_Struct(self, Draw, draw);
|
425
|
+
|
426
|
+
// Raise an exception if the Draw has a non-NULL gradient or element_reference field
|
427
|
+
if (draw->info->element_reference.type != UndefinedReference
|
428
|
+
|| draw->info->gradient.type != UndefinedGradient)
|
429
|
+
{
|
430
|
+
rb_raise(rb_eTypeError, "can't dump gradient definition");
|
431
|
+
}
|
432
|
+
|
433
|
+
ddraw = rb_hash_new();
|
434
|
+
|
435
|
+
// rb_hash_aset(ddraw, CSTR2SYM("primitive"), MAGICK_STRING_TO_OBJ(draw->info->primitive)); internal
|
436
|
+
// rb_hash_aset(ddraw, CSTR2SYM("geometry"), MAGICK_STRING_TO_OBJ(draw->info->geometry)); set by "text" primitive
|
437
|
+
// rb_hash_aset(ddraw, CSTR2SYM("viewbox"), Import_RectangleInfo(&draw->info->viewbox)); internal
|
438
|
+
rb_hash_aset(ddraw, CSTR2SYM("affine"), Import_AffineMatrix(&draw->info->affine));
|
439
|
+
rb_hash_aset(ddraw, CSTR2SYM("gravity"), INT2FIX(draw->info->gravity));
|
440
|
+
rb_hash_aset(ddraw, CSTR2SYM("fill"), Pixel_from_PixelPacket(&draw->info->fill));
|
441
|
+
rb_hash_aset(ddraw, CSTR2SYM("stroke"), Pixel_from_PixelPacket(&draw->info->stroke));
|
442
|
+
rb_hash_aset(ddraw, CSTR2SYM("stroke_width"), rb_float_new(draw->info->stroke_width));
|
443
|
+
// rb_hash_aset(ddraw, CSTR2SYM("gradient"), Qnil); // not used yet
|
444
|
+
rb_hash_aset(ddraw, CSTR2SYM("fill_pattern"), image_to_str(draw->info->fill_pattern));
|
445
|
+
rb_hash_aset(ddraw, CSTR2SYM("tile"), Qnil); // deprecated
|
446
|
+
rb_hash_aset(ddraw, CSTR2SYM("stroke_pattern"), image_to_str(draw->info->stroke_pattern));
|
447
|
+
rb_hash_aset(ddraw, CSTR2SYM("stroke_antialias"), draw->info->stroke_antialias ? Qtrue : Qfalse);
|
448
|
+
rb_hash_aset(ddraw, CSTR2SYM("text_antialias"), draw->info->text_antialias ? Qtrue : Qfalse);
|
449
|
+
// rb_hash_aset(ddraw, CSTR2SYM("fill_rule"), INT2FIX(draw->info->fill_rule)); internal
|
450
|
+
// rb_hash_aset(ddraw, CSTR2SYM("linecap"), INT2FIX(draw->info->linecap));
|
451
|
+
// rb_hash_aset(ddraw, CSTR2SYM("linejoin"), INT2FIX(draw->info->linejoin));
|
452
|
+
// rb_hash_aset(ddraw, CSTR2SYM("miterlimit"), ULONG2NUM(draw->info->miterlimit));
|
453
|
+
// rb_hash_aset(ddraw, CSTR2SYM("dash_offset"), rb_float_new(draw->info->dash_offset));
|
454
|
+
rb_hash_aset(ddraw, CSTR2SYM("decorate"), INT2FIX(draw->info->decorate));
|
455
|
+
// rb_hash_aset(ddraw, CSTR2SYM("compose"), INT2FIX(draw->info->compose)); set via "image" primitive
|
456
|
+
// rb_hash_aset(ddraw, CSTR2SYM("text"), MAGICK_STRING_TO_OBJ(draw->info->text)); set via "text" primitive
|
457
|
+
// rb_hash_aset(ddraw, CSTR2SYM("face"), Qnil); internal
|
458
|
+
rb_hash_aset(ddraw, CSTR2SYM("font"), MAGICK_STRING_TO_OBJ(draw->info->font));
|
459
|
+
// rb_hash_aset(ddraw, CSTR2SYM("metrics"), Qnil); internal
|
460
|
+
rb_hash_aset(ddraw, CSTR2SYM("family"), MAGICK_STRING_TO_OBJ(draw->info->family));
|
461
|
+
rb_hash_aset(ddraw, CSTR2SYM("style"), INT2FIX(draw->info->style));
|
462
|
+
rb_hash_aset(ddraw, CSTR2SYM("stretch"), INT2FIX(draw->info->stretch));
|
463
|
+
rb_hash_aset(ddraw, CSTR2SYM("weight"), ULONG2NUM(draw->info->weight));
|
464
|
+
rb_hash_aset(ddraw, CSTR2SYM("encoding"), MAGICK_STRING_TO_OBJ(draw->info->encoding));
|
465
|
+
rb_hash_aset(ddraw, CSTR2SYM("pointsize"), rb_float_new(draw->info->pointsize));
|
466
|
+
rb_hash_aset(ddraw, CSTR2SYM("density"), MAGICK_STRING_TO_OBJ(draw->info->density));
|
467
|
+
rb_hash_aset(ddraw, CSTR2SYM("align"), INT2FIX(draw->info->align));
|
468
|
+
rb_hash_aset(ddraw, CSTR2SYM("undercolor"), Pixel_from_PixelPacket(&draw->info->undercolor));
|
469
|
+
// rb_hash_aset(ddraw, CSTR2SYM("border_color"), Pixel_from_PixelPacket(&draw->info->border_color)); Montage and Polaroid
|
470
|
+
// rb_hash_aset(ddraw, CSTR2SYM("server_name"), MAGICK_STRING_TO_OBJ(draw->info->server_name));
|
471
|
+
// rb_hash_aset(ddraw, CSTR2SYM("dash_pattern"), dash_pattern_to_array(draw->info->dash_pattern)); internal
|
472
|
+
// rb_hash_aset(ddraw, CSTR2SYM("clip_mask"), MAGICK_STRING_TO_OBJ(draw->info->clip_mask)); internal
|
473
|
+
// rb_hash_aset(ddraw, CSTR2SYM("bounds"), Import_SegmentInfo(&draw->info->bounds)); internal
|
474
|
+
rb_hash_aset(ddraw, CSTR2SYM("clip_units"), INT2FIX(draw->info->clip_units));
|
475
|
+
rb_hash_aset(ddraw, CSTR2SYM("opacity"), QUANTUM2NUM(draw->info->opacity));
|
476
|
+
// rb_hash_aset(ddraw, CSTR2SYM("render"), draw->info->render ? Qtrue : Qfalse); internal
|
477
|
+
// rb_hash_aset(ddraw, CSTR2SYM("element_reference"), Qnil); // not used yet
|
478
|
+
// rb_hash_aset(ddraw, CSTR2SYM("debug"), draw->info->debug ? Qtrue : Qfalse);
|
479
|
+
#if defined(HAVE_ST_KERNING)
|
480
|
+
rb_hash_aset(ddraw, CSTR2SYM("kerning"), rb_float_new(draw->info->kerning));
|
481
|
+
#endif
|
482
|
+
#if defined(HAVE_ST_INTERWORD_SPACING)
|
483
|
+
rb_hash_aset(ddraw, CSTR2SYM("interword_spacing"), rb_float_new(draw->info->interword_spacing));
|
484
|
+
#endif
|
485
|
+
|
486
|
+
// Non-DrawInfo fields
|
487
|
+
rb_hash_aset(ddraw, CSTR2SYM("primitives"), draw->primitives);
|
488
|
+
// rb_hash_aset(ddraw, CSTR2SYM("shadow_color"), Pixel_from_PixelPacket(&draw->shadow_color)); Polaroid-only
|
489
|
+
|
490
|
+
return ddraw;
|
491
|
+
}
|
492
|
+
|
493
|
+
|
494
|
+
/*
|
495
|
+
Method: Draw#marshal_load
|
496
|
+
Purpose: Support Marsal.load
|
497
|
+
Notes: On entry all fields are all-bits-0
|
498
|
+
*/
|
499
|
+
VALUE
|
500
|
+
Draw_marshal_load(VALUE self, VALUE ddraw)
|
501
|
+
{
|
502
|
+
Draw *draw;
|
503
|
+
Pixel *pixel;
|
504
|
+
volatile VALUE val;
|
505
|
+
|
506
|
+
Data_Get_Struct(self, Draw, draw);
|
507
|
+
|
508
|
+
draw->info = magick_malloc(sizeof(DrawInfo));
|
509
|
+
if (!draw->info)
|
510
|
+
{
|
511
|
+
rb_raise(rb_eNoMemError, "not enough memory to continue");
|
512
|
+
}
|
513
|
+
GetDrawInfo(NULL, draw->info);
|
514
|
+
|
515
|
+
OBJ_TO_MAGICK_STRING(draw->info->geometry, rb_hash_aref(ddraw, CSTR2SYM("geometry")));
|
516
|
+
|
517
|
+
//val = rb_hash_aref(ddraw, CSTR2SYM("viewbox"));
|
518
|
+
//Export_RectangleInfo(&draw->info->viewbox, val);
|
519
|
+
|
520
|
+
val = rb_hash_aref(ddraw, CSTR2SYM("affine"));
|
521
|
+
Export_AffineMatrix(&draw->info->affine, val);
|
522
|
+
|
523
|
+
draw->info->gravity = (GravityType) FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("gravity")));
|
524
|
+
|
525
|
+
val = rb_hash_aref(ddraw, CSTR2SYM("fill"));
|
526
|
+
Data_Get_Struct(val, Pixel, pixel);
|
527
|
+
draw->info->fill = *pixel;
|
528
|
+
|
529
|
+
val = rb_hash_aref(ddraw, CSTR2SYM("stroke"));
|
530
|
+
Data_Get_Struct(val, Pixel, pixel);
|
531
|
+
draw->info->stroke = *pixel;
|
532
|
+
|
533
|
+
draw->info->stroke_width = NUM2DBL(rb_hash_aref(ddraw, CSTR2SYM("stroke_width")));
|
534
|
+
draw->info->fill_pattern = str_to_image(rb_hash_aref(ddraw, CSTR2SYM("fill_pattern")));
|
535
|
+
draw->info->stroke_pattern = str_to_image(rb_hash_aref(ddraw, CSTR2SYM("stroke_pattern")));
|
536
|
+
draw->info->stroke_antialias = RTEST(rb_hash_aref(ddraw, CSTR2SYM("stroke_antialias")));
|
537
|
+
draw->info->text_antialias = RTEST(rb_hash_aref(ddraw, CSTR2SYM("text_antialias")));
|
538
|
+
draw->info->decorate = (DecorationType) FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("decorate")));
|
539
|
+
OBJ_TO_MAGICK_STRING(draw->info->font, rb_hash_aref(ddraw, CSTR2SYM("font")));
|
540
|
+
OBJ_TO_MAGICK_STRING(draw->info->family, rb_hash_aref(ddraw, CSTR2SYM("family")));
|
541
|
+
|
542
|
+
draw->info->style = (StyleType) FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("style")));
|
543
|
+
draw->info->stretch = (StretchType) FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("stretch")));
|
544
|
+
draw->info->weight = NUM2ULONG(rb_hash_aref(ddraw, CSTR2SYM("weight")));
|
545
|
+
OBJ_TO_MAGICK_STRING(draw->info->encoding, rb_hash_aref(ddraw, CSTR2SYM("encoding")));
|
546
|
+
draw->info->pointsize = NUM2DBL(rb_hash_aref(ddraw, CSTR2SYM("pointsize")));
|
547
|
+
OBJ_TO_MAGICK_STRING(draw->info->density, rb_hash_aref(ddraw, CSTR2SYM("density")));
|
548
|
+
draw->info->align = (AlignType) FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("align")));
|
549
|
+
|
550
|
+
val = rb_hash_aref(ddraw, CSTR2SYM("undercolor"));
|
551
|
+
Data_Get_Struct(val, Pixel, pixel);
|
552
|
+
draw->info->undercolor = *pixel;
|
553
|
+
|
554
|
+
draw->info->clip_units = FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("clip_units")));
|
555
|
+
draw->info->opacity = NUM2QUANTUM(rb_hash_aref(ddraw, CSTR2SYM("opacity")));
|
556
|
+
#if defined(HAVE_ST_KERNING)
|
557
|
+
draw->info->kerning = NUM2DBL(rb_hash_aref(ddraw, CSTR2SYM("kerning")));
|
558
|
+
#endif
|
559
|
+
#if defined(HAVE_ST_INTERWORD_SPACING)
|
560
|
+
draw->info->interword_spacing = NUM2DBL(rb_hash_aref(ddraw, CSTR2SYM("interword_spacing")));
|
561
|
+
#endif
|
562
|
+
|
563
|
+
draw->primitives = rb_hash_aref(ddraw, CSTR2SYM("primitives"));
|
564
|
+
|
565
|
+
return self;
|
566
|
+
}
|
567
|
+
|
568
|
+
|
303
569
|
/*
|
304
570
|
Method: Draw#pointsize=
|
305
571
|
Purpose: pointsize attribute writer
|
@@ -989,378 +1255,6 @@ DrawOptions_initialize(VALUE self)
|
|
989
1255
|
}
|
990
1256
|
|
991
1257
|
|
992
|
-
/*
|
993
|
-
Method: Magick::Montage#background_color(color-name)
|
994
|
-
Purpose: set background_color value
|
995
|
-
*/
|
996
|
-
VALUE
|
997
|
-
Montage_background_color_eq(VALUE self, VALUE color)
|
998
|
-
{
|
999
|
-
Montage *montage;
|
1000
|
-
|
1001
|
-
Data_Get_Struct(self, Montage, montage);
|
1002
|
-
Color_to_PixelPacket(&montage->info->background_color, color);
|
1003
|
-
return self;
|
1004
|
-
}
|
1005
|
-
|
1006
|
-
|
1007
|
-
/*
|
1008
|
-
Method: Magick::Montage#border_color(color-name)
|
1009
|
-
Purpose: set border_color value
|
1010
|
-
*/
|
1011
|
-
VALUE
|
1012
|
-
Montage_border_color_eq(VALUE self, VALUE color)
|
1013
|
-
{
|
1014
|
-
Montage *montage;
|
1015
|
-
|
1016
|
-
Data_Get_Struct(self, Montage, montage);
|
1017
|
-
Color_to_PixelPacket(&montage->info->border_color, color);
|
1018
|
-
return self;
|
1019
|
-
}
|
1020
|
-
|
1021
|
-
|
1022
|
-
/*
|
1023
|
-
Method: Magick::Montage#border_width(width)
|
1024
|
-
Purpose: set border_width value
|
1025
|
-
*/
|
1026
|
-
VALUE
|
1027
|
-
Montage_border_width_eq(VALUE self, VALUE width)
|
1028
|
-
{
|
1029
|
-
Montage *montage;
|
1030
|
-
|
1031
|
-
Data_Get_Struct(self, Montage, montage);
|
1032
|
-
montage->info->border_width = NUM2ULONG(width);
|
1033
|
-
return self;
|
1034
|
-
}
|
1035
|
-
|
1036
|
-
|
1037
|
-
/*
|
1038
|
-
Method: Magick::Montage#compose(width)
|
1039
|
-
Purpose: set a composition operator
|
1040
|
-
*/
|
1041
|
-
VALUE
|
1042
|
-
Montage_compose_eq(VALUE self, VALUE compose)
|
1043
|
-
{
|
1044
|
-
Montage *montage;
|
1045
|
-
|
1046
|
-
Data_Get_Struct(self, Montage, montage);
|
1047
|
-
VALUE_TO_ENUM(compose, montage->compose, CompositeOperator);
|
1048
|
-
return self;
|
1049
|
-
}
|
1050
|
-
|
1051
|
-
|
1052
|
-
/*
|
1053
|
-
Method: Magick::Montage#filename(name)
|
1054
|
-
Purpose: set filename value
|
1055
|
-
*/
|
1056
|
-
VALUE
|
1057
|
-
Montage_filename_eq(VALUE self, VALUE filename)
|
1058
|
-
{
|
1059
|
-
Montage *montage;
|
1060
|
-
|
1061
|
-
Data_Get_Struct(self, Montage, montage);
|
1062
|
-
strncpy(montage->info->filename, StringValuePtr(filename), MaxTextExtent-1);
|
1063
|
-
return self;
|
1064
|
-
}
|
1065
|
-
|
1066
|
-
|
1067
|
-
/*
|
1068
|
-
Method: Magick::Montage#fill(color-name)
|
1069
|
-
Purpose: set fill value
|
1070
|
-
*/
|
1071
|
-
VALUE
|
1072
|
-
Montage_fill_eq(VALUE self, VALUE color)
|
1073
|
-
{
|
1074
|
-
Montage *montage;
|
1075
|
-
|
1076
|
-
Data_Get_Struct(self, Montage, montage);
|
1077
|
-
Color_to_PixelPacket(&montage->info->fill, color);
|
1078
|
-
return self;
|
1079
|
-
}
|
1080
|
-
|
1081
|
-
|
1082
|
-
/*
|
1083
|
-
Method: Magick::Montage#font(font-name)
|
1084
|
-
Purpose: set font value
|
1085
|
-
*/
|
1086
|
-
VALUE
|
1087
|
-
Montage_font_eq(VALUE self, VALUE font)
|
1088
|
-
{
|
1089
|
-
Montage *montage;
|
1090
|
-
|
1091
|
-
Data_Get_Struct(self, Montage, montage);
|
1092
|
-
magick_clone_string(&montage->info->font, StringValuePtr(font));
|
1093
|
-
|
1094
|
-
return self;
|
1095
|
-
}
|
1096
|
-
|
1097
|
-
|
1098
|
-
/*
|
1099
|
-
Method: Magick::Montage#frame(frame-geometry)
|
1100
|
-
Purpose: set frame value
|
1101
|
-
Notes: The geometry is a string in the form:
|
1102
|
-
<width>x<height>+<outer-bevel-width>+<inner-bevel-width>
|
1103
|
-
or a Geometry object
|
1104
|
-
*/
|
1105
|
-
VALUE
|
1106
|
-
Montage_frame_eq(VALUE self, VALUE frame_arg)
|
1107
|
-
{
|
1108
|
-
Montage *montage;
|
1109
|
-
volatile VALUE frame;
|
1110
|
-
|
1111
|
-
Data_Get_Struct(self, Montage, montage);
|
1112
|
-
frame = rm_to_s(frame_arg);
|
1113
|
-
magick_clone_string(&montage->info->frame, StringValuePtr(frame));
|
1114
|
-
|
1115
|
-
return self;
|
1116
|
-
}
|
1117
|
-
|
1118
|
-
|
1119
|
-
/*
|
1120
|
-
Method: Magick::Montage#geometry(geometry)
|
1121
|
-
Purpose: set geometry value
|
1122
|
-
*/
|
1123
|
-
VALUE
|
1124
|
-
Montage_geometry_eq(VALUE self, VALUE geometry_arg)
|
1125
|
-
{
|
1126
|
-
Montage *montage;
|
1127
|
-
volatile VALUE geometry;
|
1128
|
-
|
1129
|
-
Data_Get_Struct(self, Montage, montage);
|
1130
|
-
geometry = rm_to_s(geometry_arg);
|
1131
|
-
magick_clone_string(&montage->info->geometry, StringValuePtr(geometry));
|
1132
|
-
|
1133
|
-
return self;
|
1134
|
-
}
|
1135
|
-
|
1136
|
-
|
1137
|
-
/*
|
1138
|
-
Method: Magick::Montage#gravity(gravity-type)
|
1139
|
-
Purpose: set gravity value
|
1140
|
-
*/
|
1141
|
-
VALUE
|
1142
|
-
Montage_gravity_eq(VALUE self, VALUE gravity)
|
1143
|
-
{
|
1144
|
-
Montage *montage;
|
1145
|
-
|
1146
|
-
Data_Get_Struct(self, Montage, montage);
|
1147
|
-
VALUE_TO_ENUM(gravity, montage->info->gravity, GravityType);
|
1148
|
-
return self;
|
1149
|
-
}
|
1150
|
-
|
1151
|
-
|
1152
|
-
/*
|
1153
|
-
Method: Magick::Montage#initialize
|
1154
|
-
Purpose: Place-holder
|
1155
|
-
*/
|
1156
|
-
VALUE
|
1157
|
-
Montage_initialize(VALUE self)
|
1158
|
-
{
|
1159
|
-
// Nothing to do!
|
1160
|
-
return self;
|
1161
|
-
}
|
1162
|
-
|
1163
|
-
|
1164
|
-
/*
|
1165
|
-
Method: Magick::Montage#matte_color(color-name)
|
1166
|
-
Purpose: set matte_color value
|
1167
|
-
*/
|
1168
|
-
VALUE
|
1169
|
-
Montage_matte_color_eq(VALUE self, VALUE color)
|
1170
|
-
{
|
1171
|
-
Montage *montage;
|
1172
|
-
|
1173
|
-
Data_Get_Struct(self, Montage, montage);
|
1174
|
-
Color_to_PixelPacket(&montage->info->matte_color, color);
|
1175
|
-
return self;
|
1176
|
-
}
|
1177
|
-
|
1178
|
-
|
1179
|
-
/*
|
1180
|
-
Method: Montage.new
|
1181
|
-
Purpose: Create a new Montage object
|
1182
|
-
*/
|
1183
|
-
VALUE
|
1184
|
-
Montage_alloc(VALUE class)
|
1185
|
-
{
|
1186
|
-
MontageInfo *montage_info;
|
1187
|
-
Montage *montage;
|
1188
|
-
Info *image_info;
|
1189
|
-
volatile VALUE montage_obj;
|
1190
|
-
|
1191
|
-
// DO NOT call rm_info_new - we don't want to support an Info parm block.
|
1192
|
-
image_info = CloneImageInfo(NULL);
|
1193
|
-
if (!image_info)
|
1194
|
-
{
|
1195
|
-
rb_raise(rb_eNoMemError, "not enough memory to initialize Info object");
|
1196
|
-
}
|
1197
|
-
|
1198
|
-
montage_info = CloneMontageInfo(image_info, NULL);
|
1199
|
-
(void) (void) DestroyImageInfo(image_info);
|
1200
|
-
|
1201
|
-
if (!montage_info)
|
1202
|
-
{
|
1203
|
-
rb_raise(rb_eNoMemError, "not enough memory to initialize Magick::Montage object");
|
1204
|
-
}
|
1205
|
-
|
1206
|
-
montage = ALLOC(Montage);
|
1207
|
-
montage->info = montage_info;
|
1208
|
-
montage->compose = OverCompositeOp;
|
1209
|
-
montage_obj = Data_Wrap_Struct(class, NULL, destroy_Montage, montage);
|
1210
|
-
|
1211
|
-
return montage_obj;
|
1212
|
-
}
|
1213
|
-
|
1214
|
-
|
1215
|
-
/*
|
1216
|
-
Extern: rm_montage_new()
|
1217
|
-
Purpose: Return a new Magick::Montage object
|
1218
|
-
*/
|
1219
|
-
|
1220
|
-
VALUE
|
1221
|
-
rm_montage_new(void)
|
1222
|
-
{
|
1223
|
-
return Montage_initialize(Montage_alloc(Class_Montage));
|
1224
|
-
}
|
1225
|
-
|
1226
|
-
/*
|
1227
|
-
Static: destroy_Montage
|
1228
|
-
Purpose: destory the MontageInfo struct and free the Montage struct
|
1229
|
-
Notes: if the Magick::Montage#texture method wrote a texture file,
|
1230
|
-
the file is deleted here.
|
1231
|
-
*/
|
1232
|
-
static void
|
1233
|
-
destroy_Montage(void *obj)
|
1234
|
-
{
|
1235
|
-
Montage *montage = obj;
|
1236
|
-
|
1237
|
-
// If we saved a temporary texture image, delete it now.
|
1238
|
-
if (montage->info && montage->info->texture != NULL)
|
1239
|
-
{
|
1240
|
-
rm_delete_temp_image(montage->info->texture);
|
1241
|
-
magick_free(montage->info->texture);
|
1242
|
-
montage->info->texture = NULL;
|
1243
|
-
}
|
1244
|
-
if (montage->info)
|
1245
|
-
{
|
1246
|
-
(void) DestroyMontageInfo(montage->info);
|
1247
|
-
montage->info = NULL;
|
1248
|
-
}
|
1249
|
-
xfree(montage);
|
1250
|
-
}
|
1251
|
-
|
1252
|
-
|
1253
|
-
/*
|
1254
|
-
Method: Magick::Montage#pointsize=size
|
1255
|
-
Purpose: set pointsize value
|
1256
|
-
*/
|
1257
|
-
VALUE
|
1258
|
-
Montage_pointsize_eq(VALUE self, VALUE size)
|
1259
|
-
{
|
1260
|
-
Montage *montage;
|
1261
|
-
|
1262
|
-
Data_Get_Struct(self, Montage, montage);
|
1263
|
-
montage->info->pointsize = NUM2DBL(size);
|
1264
|
-
return self;
|
1265
|
-
}
|
1266
|
-
|
1267
|
-
|
1268
|
-
/*
|
1269
|
-
Method: Magick::Montage#shadow=shadow
|
1270
|
-
Purpose: set shadow value
|
1271
|
-
*/
|
1272
|
-
VALUE
|
1273
|
-
Montage_shadow_eq(VALUE self, VALUE shadow)
|
1274
|
-
{
|
1275
|
-
Montage *montage;
|
1276
|
-
|
1277
|
-
Data_Get_Struct(self, Montage, montage);
|
1278
|
-
montage->info->shadow = (MagickBooleanType) RTEST(shadow);
|
1279
|
-
return self;
|
1280
|
-
}
|
1281
|
-
|
1282
|
-
|
1283
|
-
/*
|
1284
|
-
Method: Magick::Montage#stroke(color-name)
|
1285
|
-
Purpose: set stroke value
|
1286
|
-
*/
|
1287
|
-
VALUE
|
1288
|
-
Montage_stroke_eq(VALUE self, VALUE color)
|
1289
|
-
{
|
1290
|
-
Montage *montage;
|
1291
|
-
|
1292
|
-
Data_Get_Struct(self, Montage, montage);
|
1293
|
-
Color_to_PixelPacket(&montage->info->stroke, color);
|
1294
|
-
return self;
|
1295
|
-
}
|
1296
|
-
|
1297
|
-
|
1298
|
-
/*
|
1299
|
-
Method: Montage#texture(texture-image)
|
1300
|
-
Purpose: set texture value
|
1301
|
-
*/
|
1302
|
-
VALUE
|
1303
|
-
Montage_texture_eq(VALUE self, VALUE texture)
|
1304
|
-
{
|
1305
|
-
Montage *montage;
|
1306
|
-
Image *texture_image;
|
1307
|
-
char temp_name[MaxTextExtent];
|
1308
|
-
|
1309
|
-
Data_Get_Struct(self, Montage, montage);
|
1310
|
-
|
1311
|
-
// If we had a previously defined temp texture image,
|
1312
|
-
// remove it now in preparation for this new one.
|
1313
|
-
if (montage->info->texture)
|
1314
|
-
{
|
1315
|
-
rm_delete_temp_image(montage->info->texture);
|
1316
|
-
magick_free(montage->info->texture);
|
1317
|
-
montage->info->texture = NULL;
|
1318
|
-
}
|
1319
|
-
|
1320
|
-
texture = rm_cur_image(texture);
|
1321
|
-
texture_image = rm_check_destroyed(texture);
|
1322
|
-
|
1323
|
-
// Write a temp copy of the image & save its name.
|
1324
|
-
rm_write_temp_image(texture_image, temp_name);
|
1325
|
-
magick_clone_string(&montage->info->texture, temp_name);
|
1326
|
-
|
1327
|
-
return self;
|
1328
|
-
}
|
1329
|
-
|
1330
|
-
|
1331
|
-
/*
|
1332
|
-
Method: Magick::Montage#tile(tile)
|
1333
|
-
Purpose: set tile value
|
1334
|
-
*/
|
1335
|
-
VALUE
|
1336
|
-
Montage_tile_eq(VALUE self, VALUE tile_arg)
|
1337
|
-
{
|
1338
|
-
Montage *montage;
|
1339
|
-
volatile VALUE tile;
|
1340
|
-
|
1341
|
-
Data_Get_Struct(self, Montage, montage);
|
1342
|
-
tile = rm_to_s(tile_arg);
|
1343
|
-
magick_clone_string(&montage->info->tile, StringValuePtr(tile));
|
1344
|
-
|
1345
|
-
return self;
|
1346
|
-
}
|
1347
|
-
|
1348
|
-
|
1349
|
-
/*
|
1350
|
-
Method: Magick::Montage#title(title)
|
1351
|
-
Purpose: set title value
|
1352
|
-
*/
|
1353
|
-
VALUE
|
1354
|
-
Montage_title_eq(VALUE self, VALUE title)
|
1355
|
-
{
|
1356
|
-
Montage *montage;
|
1357
|
-
|
1358
|
-
Data_Get_Struct(self, Montage, montage);
|
1359
|
-
magick_clone_string(&montage->info->title, StringValuePtr(title));
|
1360
|
-
return self;
|
1361
|
-
}
|
1362
|
-
|
1363
|
-
|
1364
1258
|
/*
|
1365
1259
|
Extern: PolaroidOptions_alloc()
|
1366
1260
|
Purpose: Allocate a new Magick::PolaroidOptions object
|
@@ -1579,5 +1473,5 @@ get_type_metrics(
|
|
1579
1473
|
rb_raise(rb_eRuntimeError, "Can't measure text. Are the fonts installed? "
|
1580
1474
|
"Is the FreeType library installed?");
|
1581
1475
|
}
|
1582
|
-
return
|
1476
|
+
return Import_TypeMetric(&metrics);
|
1583
1477
|
}
|