Class: Magick::Image::Info

Inherits:
Object
  • Object
show all
Defined in:
ext/RMagick/rmmain.cpp

Instance Method Summary collapse

Constructor Details

#initializeObject #initialize {|info| ... } ⇒ Object

If an initializer block is present, run it.

Overloads:

  • #initialize {|info| ... } ⇒ Object

    Yields:

    • (info)

    Yield Parameters:



2409
2410
2411
2412
2413
2414
2415
2416
2417
# File 'ext/RMagick/rminfo.cpp', line 2409

VALUE
Info_initialize(VALUE self)
{
    if (rb_block_given_p())
    {
        rb_yield(self);
    }
    return self;
}

Instance Method Details

#[](format, key) ⇒ String #[](key) ⇒ String

Get the value of the specified option for the specified format.

  • The 2 argument form is the original form. Added support for a single argument after ImageMagick started using Set/GetImageOption for options that aren’t represented by fields in the ImageInfo structure.

Overloads:

  • #[](format, key) ⇒ String

    Parameters:

    • format (String)

      An image format name such as “ps” or “tiff”.

    • key (String)

      A string that identifies the option.

  • #[](key) ⇒ String

    Parameters:

    • key (String)

      A string that identifies the option.

Returns:

  • (String)

    The value of the option.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'ext/RMagick/rminfo.cpp', line 253

VALUE
Info_aref(int argc, VALUE *argv, VALUE self)
{
    Info *info;
    char *format_p, *key_p;
    size_t format_l, key_l;
    const char *value;
    char fkey[MaxTextExtent];

    switch (argc)
    {
        case 2:
            format_p = rm_str2cstr(argv[0], &format_l);
            key_p = rm_str2cstr(argv[1], &key_l);
            if (format_l > MAX_FORMAT_LEN || format_l + key_l > MaxTextExtent-1)
            {
                rb_raise(rb_eArgError, "can't reference %.60s:%.1024s - too long", format_p, key_p);
            }

            snprintf(fkey, sizeof(fkey), "%.60s:%.*s", format_p, (int)(MaxTextExtent-61), key_p);
            break;

        case 1:
            strlcpy(fkey, StringValueCStr(argv[0]), sizeof(fkey));
            break;

        default:
            rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
            break;

    }

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    value = GetImageOption(info, fkey);
    if (!value)
    {
        return Qnil;
    }

    return rb_str_new2(value);
}

#[]=(format, key) ⇒ Magick::Image::Info #[]=(key) ⇒ Magick::Image::Info

Define an option. An alternative to #define. Use this method to set options for reading or writing certain image formats.

  • Essentially the same function as #define but paired with #[]

  • If the value is nil it is equivalent to #undefine.

Overloads:

  • #[]=(format, key) ⇒ Magick::Image::Info

    Parameters:

    • format (String)

      An image format name such as “ps” or “tiff”.

    • key (String)

      A string that identifies the option.

  • #[]=(key) ⇒ Magick::Image::Info

    Parameters:

    • key (String)

      A string that identifies the option.

Returns:

See Also:



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'ext/RMagick/rminfo.cpp', line 315

VALUE
Info_aset(int argc, VALUE *argv, VALUE self)
{
    Info *info;
    VALUE value;
    char *format_p, *key_p, *value_p = NULL;
    size_t format_l, key_l;
    char ckey[MaxTextExtent];

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    switch (argc)
    {
        case 3:
            format_p = rm_str2cstr(argv[0], &format_l);
            key_p = rm_str2cstr(argv[1], &key_l);

            if (format_l > MAX_FORMAT_LEN || format_l+key_l > MaxTextExtent-1)
            {
                rb_raise(rb_eArgError, "%.60s:%.1024s not defined - too long", format_p, key_p);
            }

            snprintf(ckey, sizeof(ckey), "%.60s:%.*s", format_p, (int)(sizeof(ckey)-MAX_FORMAT_LEN), key_p);

            value = argv[2];
            break;

        case 2:
            strlcpy(ckey, StringValueCStr(argv[0]), sizeof(ckey));

            value = argv[1];
            break;

        default:
            rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
            break;
    }

    if (NIL_P(value))
    {
        DeleteImageOption(info, ckey);
    }
    else
    {
        unsigned int okay;

        /* Allow any argument that supports to_s */
        value = rb_String(value);
        value_p = StringValueCStr(value);

        okay = SetImageOption(info, ckey, value_p);
        if (!okay)
        {
            rb_warn("`%s' not defined - SetImageOption failed.", ckey);
            return Qnil;
        }
    }

    RB_GC_GUARD(value);

    return self;
}

#antialiasBoolean

Get antialias value

Returns:

  • (Boolean)

    true if antialias is enabled



216
217
218
219
220
# File 'ext/RMagick/rminfo.cpp', line 216

VALUE
Info_antialias(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, antialias, boolean, &rm_info_data_type);
}

#antialias=(val) ⇒ Boolean

Set antialias value

Parameters:

  • val (Boolean)

    true or false

Returns:

  • (Boolean)

    the given value



228
229
230
231
232
# File 'ext/RMagick/rminfo.cpp', line 228

VALUE
Info_antialias_eq(VALUE self, VALUE val)
{
    IMPLEMENT_TYPED_ATTR_WRITER(Info, antialias, boolean, &rm_info_data_type);
}

#attenuateFloat

Get the attenuate value.

Returns:

  • (Float)

    the attenuate



384
385
386
387
388
# File 'ext/RMagick/rminfo.cpp', line 384

VALUE
Info_attenuate(VALUE self)
{
    return get_dbl_option(self, "attenuate");
}

#attenuate=(value) ⇒ Float

Set the attenuate value.

Parameters:

  • value (Float)

    the attenuate

Returns:

  • (Float)

    the attenuate



397
398
399
400
401
# File 'ext/RMagick/rminfo.cpp', line 397

VALUE
Info_attenuate_eq(VALUE self, VALUE value)
{
    return set_dbl_option(self, "attenuate", value);
}

#authenticateString

Get the authenticate value.

Returns:

  • (String)

    the authenticate



409
410
411
412
413
414
415
416
417
418
419
420
# File 'ext/RMagick/rminfo.cpp', line 409

VALUE
Info_authenticate(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
#if defined(IMAGEMAGICK_7)
    return C_str_to_R_str(GetImageOption(info, "authenticate"));
#else
    return C_str_to_R_str(info->authenticate);
#endif
}

#authenticate=(passwd_arg) ⇒ String

Set the authenticate value.

Parameters:

  • passwd_arg (String)

    the authenticating password

Returns:

  • (String)

    the given value



429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'ext/RMagick/rminfo.cpp', line 429

VALUE
Info_authenticate_eq(VALUE self, VALUE passwd_arg)
{
    Info *info;
    char *passwd = NULL;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (!NIL_P(passwd_arg))
    {
        passwd = StringValueCStr(passwd_arg);
    }

#if defined(IMAGEMAGICK_7)
    if (passwd)
    {
        SetImageOption(info, "authenticate", passwd);
    }
    else
    {
        RemoveImageOption(info, "authenticate");
    }
#else
    if (info->authenticate)
    {
        magick_free(info->authenticate);
        info->authenticate = NULL;
    }
    if (passwd)
    {
        magick_clone_string(&info->authenticate, passwd);
    }
#endif

    return passwd_arg;
}

#background_colorString

Return the name of the background color as a String

Returns:

  • (String)

    the name of the background color

See Also:



473
474
475
476
477
478
479
480
# File 'ext/RMagick/rminfo.cpp', line 473

VALUE
Info_background_color(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return rm_pixelcolor_to_color_name_info(info, &info->background_color);
}

#background_color=(bc_arg) ⇒ Magick::Pixel, String

Set the background color.

Parameters:

Returns:



489
490
491
492
493
494
495
496
497
498
# File 'ext/RMagick/rminfo.cpp', line 489

VALUE
Info_background_color_eq(VALUE self, VALUE bc_arg)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    Color_to_PixelColor(&info->background_color, bc_arg);

    return bc_arg;
}

#border_colorString

Return the name of the border color as a String.

Returns:

  • (String)

    the border color name

See Also:



506
507
508
509
510
511
512
513
# File 'ext/RMagick/rminfo.cpp', line 506

VALUE
Info_border_color(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return rm_pixelcolor_to_color_name_info(info, &info->border_color);
}

#border_color=(bc_arg) ⇒ Magick::Pixel, String

set the border color

Parameters:

Returns:



521
522
523
524
525
526
527
528
529
530
# File 'ext/RMagick/rminfo.cpp', line 521

VALUE
Info_border_color_eq(VALUE self, VALUE bc_arg)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    Color_to_PixelColor(&info->border_color, bc_arg);

    return bc_arg;
}

#captionString

Get a caption of image

Returns:

  • (String)

    the caption



539
540
541
542
543
# File 'ext/RMagick/rminfo.cpp', line 539

VALUE
Info_caption(VALUE self)
{
    return get_option(self, "caption");
}

#caption=(caption) ⇒ String

Assigns a caption to an image.

Parameters:

  • caption (String)

    the caption

Returns:

  • (String)

    the given value



553
554
555
556
557
# File 'ext/RMagick/rminfo.cpp', line 553

VALUE
Info_caption_eq(VALUE self, VALUE caption)
{
    return set_option(self, "caption", caption);
}

#channel(channel = Magick::AllChannels) ⇒ Magick::Image::Info #channel(*channels) ⇒ Magick::Image::Info

Set the channels

Overloads:

  • #channel(channel = Magick::AllChannels) ⇒ Magick::Image::Info

    Parameters:

    • channel (Magick::ChannelType) (defaults to: Magick::AllChannels)

      the channel

  • #channel(*channels) ⇒ Magick::Image::Info

    Parameters:

    • channels (Magick::ChannelType)

      the multiple arguments of channel

Returns:



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'ext/RMagick/rminfo.cpp', line 571

VALUE
Info_channel(int argc, VALUE *argv, VALUE self)
{
    Info *info;
    ChannelType channels;

    channels = extract_channels(&argc, argv);

    // Ensure all arguments consumed.
    if (argc > 0)
    {
        raise_ChannelType_error(argv[argc-1]);
    }

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    info->channel = channels;
    return self;
}

#colorspaceMagick::ColorspaceType

Get the colorspace type.

Returns:

  • (Magick::ColorspaceType)

    the colorspace type



597
598
599
600
601
602
603
604
# File 'ext/RMagick/rminfo.cpp', line 597

VALUE
Info_colorspace(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return ColorspaceType_find(info->colorspace);
}

#colorspace=(colorspace) ⇒ Magick::ColorspaceType

Set the colorspace type

Parameters:

  • colorspace (Magick::ColorspaceType)

    the colorspace type

Returns:

  • (Magick::ColorspaceType)

    the given colorspace



612
613
614
615
616
617
618
619
620
# File 'ext/RMagick/rminfo.cpp', line 612

VALUE
Info_colorspace_eq(VALUE self, VALUE colorspace)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    VALUE_TO_ENUM(colorspace, info->colorspace, ColorspaceType);
    return colorspace;
}

#commentString

Get the comment.

Returns:

  • (String)

    the comment



627
628
629
630
# File 'ext/RMagick/rminfo.cpp', line 627

VALUE Info_comment(VALUE self)
{
    return get_option(self, "Comment");
}

#comment=(string) ⇒ String

Set the comment

Parameters:

  • string (String)

    the comment

Returns:

  • (String)

    the given comment



638
639
640
641
# File 'ext/RMagick/rminfo.cpp', line 638

VALUE Info_comment_eq(VALUE self, VALUE string)
{
    return set_option(self, "Comment", string);
}

#compressionMagick::CompressionType

Get the compression type.

Returns:

  • (Magick::CompressionType)

    the compression type



648
649
650
651
652
653
654
655
# File 'ext/RMagick/rminfo.cpp', line 648

VALUE
Info_compression(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return CompressionType_find(info->compression);
}

#compression=(type) ⇒ Magick::CompressionType

Set the compression type

Parameters:

  • type (Magick::CompressionType)

    the compression type

Returns:

  • (Magick::CompressionType)

    the given type



663
664
665
666
667
668
669
670
671
# File 'ext/RMagick/rminfo.cpp', line 663

VALUE
Info_compression_eq(VALUE self, VALUE type)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    VALUE_TO_ENUM(type, info->compression, CompressionType);
    return type;
}

#InfoMagick::Image::Info

Define an option.

Parameters:

  • format (String)

    An image format name such as “ps” or “tiff”.

  • key (String)

    A string that identifies the option.

  • value (String)

    A value of option

Returns:



683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
# File 'ext/RMagick/rminfo.cpp', line 683

VALUE
Info_define(int argc, VALUE *argv, VALUE self)
{
    Info *info;
    char *format, *key;
    const char *value = "";
    size_t format_l, key_l;
    char ckey[100];
    unsigned int okay;
    VALUE fmt_arg;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    switch (argc)
    {
        case 3:
            /* Allow any argument that supports to_s */
            fmt_arg = rb_String(argv[2]);
            value = (const char *)StringValueCStr(fmt_arg);
        case 2:
            key = rm_str2cstr(argv[1], &key_l);
            format = rm_str2cstr(argv[0], &format_l);
            break;
        default:
            rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
    }

    if (2 + format_l + key_l > (long)sizeof(ckey))
    {
        rb_raise(rb_eArgError, "%.20s:%.20s not defined - format or key too long", format, key);
    }
    snprintf(ckey, sizeof(ckey), "%s:%s", format, key);

    DeleteImageOption(info, ckey);
    okay = SetImageOption(info, ckey, value);
    if (!okay)
    {
        rb_warn("%.20s=\"%.78s\" not defined - SetImageOption failed.", ckey, value);
        return Qnil;
    }

    RB_GC_GUARD(fmt_arg);

    return self;
}

#delayNumeric?

Get the delay value.

Returns:

  • (Numeric, nil)

    the delay



734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
# File 'ext/RMagick/rminfo.cpp', line 734

VALUE
Info_delay(VALUE self)
{
    Info *info;
    const char *delay;
    char *p;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    delay = GetImageOption(info, "delay");
    if (delay)
    {
        long d;

        d = strtol(delay, &p, 10);
        if (*p != '\0')
        {
            rb_raise(rb_eRangeError, "failed to convert %s to Numeric", delay);
        }
        return LONG2NUM(d);
    }
    return Qnil;
}

#delay=(string) ⇒ String

Set the delay value.

Parameters:

  • string (String)

    the delay

Returns:

  • (String)

    the given value



778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'ext/RMagick/rminfo.cpp', line 778

VALUE
Info_delay_eq(VALUE self, VALUE string)
{
    Info *info;
    int not_num;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (NIL_P(string))
    {
        DeleteImageOption(info, "delay");
    }
    else
    {
        char dstr[20];
        int delay;

        not_num = 0;
        rb_protect(arg_is_integer, string, &not_num);
        if (not_num)
        {
            rb_raise(rb_eTypeError, "failed to convert %s into Integer", rb_class2name(CLASS_OF(string)));
        }
        delay = NUM2INT(string);
        snprintf(dstr, sizeof(dstr), "%d", delay);
        SetImageOption(info, "delay", dstr);
    }
    return string;
}

#densityString

Get the density value

Returns:

  • (String)

    the density



813
814
815
816
817
# File 'ext/RMagick/rminfo.cpp', line 813

VALUE
Info_density(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, density, str, &rm_info_data_type);
}

#density=(density_arg) ⇒ Magick::Geometry, String

Set the text rendering density geometry

Parameters:

Returns:

See Also:



826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
# File 'ext/RMagick/rminfo.cpp', line 826

VALUE
Info_density_eq(VALUE self, VALUE density_arg)
{
    Info *info;
    VALUE density;
    char *dens;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (NIL_P(density_arg))
    {
        magick_free(info->density);
        info->density = NULL;
        return density_arg;
    }

    density = rb_String(density_arg);
    dens = StringValueCStr(density);
    if (!IsGeometry(dens))
    {
        rb_raise(rb_eArgError, "invalid density geometry: %s", dens);
    }

    magick_clone_string(&info->density, dens);

    RB_GC_GUARD(density);

    return density_arg;
}

#depthNumeric

Get the depth value

Returns:

  • (Numeric)

    the depth



861
862
863
864
865
# File 'ext/RMagick/rminfo.cpp', line 861

VALUE
Info_depth(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, depth, int, &rm_info_data_type);
}

#depth=(depth) ⇒ Numeric

Set the depth (8, 16, 32, 64).

Parameters:

  • depth (Numeric)

    the depth

Returns:

  • (Numeric)

    the given depth



873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
# File 'ext/RMagick/rminfo.cpp', line 873

VALUE
Info_depth_eq(VALUE self, VALUE depth)
{
    Info *info;
    unsigned long d;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    d = NUM2ULONG(depth);
    switch (d)
    {
        case 8:                     // always okay
#if MAGICKCORE_QUANTUM_DEPTH == 16 || MAGICKCORE_QUANTUM_DEPTH == 32 || MAGICKCORE_QUANTUM_DEPTH == 64
        case 16:
#if MAGICKCORE_QUANTUM_DEPTH == 32 || MAGICKCORE_QUANTUM_DEPTH == 64
        case 32:
#if MAGICKCORE_QUANTUM_DEPTH == 64
        case 64:
#endif
#endif
#endif
            break;
        default:
            rb_raise(rb_eArgError, "invalid depth (%lu)", d);
            break;
    }

    info->depth = d;
    return depth;
}

#disposeMagick::DisposeType

Retrieve the dispose option string and convert it to a DisposeType enumerator.

Returns:

  • (Magick::DisposeType)

    a DisposeType enumerator



956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
# File 'ext/RMagick/rminfo.cpp', line 956

VALUE
Info_dispose(VALUE self)
{
    Info *info;
    ID dispose_id;
    const char *dispose;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    dispose_id = rb_intern("UndefinedDispose");

    // Map the dispose option string to a DisposeType enumerator.
    dispose = GetImageOption(info, "dispose");
    if (dispose)
    {
        for (int x = 0; x < N_DISPOSE_OPTIONS; x++)
        {
            if (strcmp(dispose, Dispose_Option[x].string) == 0)
            {
                dispose_id = rb_intern(Dispose_Option[x].enum_name);
                break;
            }
        }
    }

    return rb_const_get(Module_Magick, dispose_id);
}

#dispose=(disp) ⇒ Magic::DisposeType

Convert a DisposeType enumerator into the equivalent dispose option string.

Parameters:

  • disp (Magic::DisposeType)

    the DisposeType enumerator

Returns:

  • (Magic::DisposeType)

    the given value



990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
# File 'ext/RMagick/rminfo.cpp', line 990

VALUE
Info_dispose_eq(VALUE self, VALUE disp)
{
    Info *info;
    DisposeType dispose;
    const char *option;
    int x;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (NIL_P(disp))
    {
        DeleteImageOption(info, "dispose");
        return disp;
    }

    VALUE_TO_ENUM(disp, dispose, DisposeType);
    option = "Undefined";

    for (x = 0; x < N_DISPOSE_OPTIONS; x++)
    {
        if (dispose == Dispose_Option[x].enumerator)
        {
            option = Dispose_Option[x].string;
            break;
        }
    }

    SetImageOption(info, "dispose", option);
    return disp;
}

#ditherBoolean

Get dither value

Returns:

  • (Boolean)

    true if dither is enabled



1027
1028
1029
1030
1031
# File 'ext/RMagick/rminfo.cpp', line 1027

VALUE
Info_dither(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, dither, boolean, &rm_info_data_type);
}

#dither=(val) ⇒ Boolean

Set dither value

Parameters:

  • val (Boolean)

    true if dither will be enabled

Returns:

  • (Boolean)

    true if dither is enabled



1039
1040
1041
1042
1043
# File 'ext/RMagick/rminfo.cpp', line 1039

VALUE
Info_dither_eq(VALUE self, VALUE val)
{
    IMPLEMENT_TYPED_ATTR_WRITER(Info, dither, boolean, &rm_info_data_type);
}

#endianMagick::EndianType

Get the endian value.

Returns:

  • (Magick::EndianType)

    the endian



1051
1052
1053
1054
1055
1056
1057
1058
# File 'ext/RMagick/rminfo.cpp', line 1051

VALUE
Info_endian(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return EndianType_find(info->endian);
}

#endian=(endian) ⇒ Magick::EndianType

Set the endian value.

Parameters:

  • endian (Magick::EndianType)

    the endian

Returns:

  • (Magick::EndianType)

    the given endian



1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
# File 'ext/RMagick/rminfo.cpp', line 1067

VALUE
Info_endian_eq(VALUE self, VALUE endian)
{
    Info *info;
    EndianType type = UndefinedEndian;

    if (endian != Qnil)
    {
        VALUE_TO_ENUM(endian, type, EndianType);
    }

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    info->endian = type;
    return endian;
}

#extractString

Get the extract geometry, e.g. “200x200+100+100”

Returns:

  • (String)

    the extract string

See Also:



1090
1091
1092
1093
1094
# File 'ext/RMagick/rminfo.cpp', line 1090

VALUE
Info_extract(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, extract, str, &rm_info_data_type);
}

#extract=(extract_arg) ⇒ Magick::Geometry, String

Set the extract geometry.

Parameters:

Returns:

See Also:



1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
# File 'ext/RMagick/rminfo.cpp', line 1103

VALUE
Info_extract_eq(VALUE self, VALUE extract_arg)
{
    Info *info;
    char *extr;
    VALUE extract;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (NIL_P(extract_arg))
    {
        magick_free(info->extract);
        info->extract = NULL;
        return extract_arg;
    }

    extract = rb_String(extract_arg);
    extr = StringValueCStr(extract);
    if (!IsGeometry(extr))
    {
        rb_raise(rb_eArgError, "invalid extract geometry: %s", extr);
    }

    magick_clone_string(&info->extract, extr);

    RB_GC_GUARD(extract);

    return extract_arg;
}

#filenameString

Note:

Only used for Image#capture

Get the “filename” value.

Returns:

  • (String)

    the file name (“” if filename not set)

See Also:

  • Image#capture


1141
1142
1143
1144
1145
1146
1147
1148
# File 'ext/RMagick/rminfo.cpp', line 1141

VALUE
Info_filename(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return rb_str_new2(info->filename);
}

#filename=(filename) ⇒ String

Note:

Only used for Image#capture

Set the “filename” value.

Parameters:

  • filename (String)

    the file name

Returns:

  • (String)

    the given file name

See Also:

  • Image#capture


1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
# File 'ext/RMagick/rminfo.cpp', line 1158

VALUE
Info_filename_eq(VALUE self, VALUE filename)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    // Allow "nil" - remove current filename
    if (NIL_P(filename) || StringValueCStr(filename) == NULL)
    {
        info->filename[0] = '\0';
    }
    else
    {
        char *fname;

        // Otherwise copy in filename
        fname = StringValueCStr(filename);
        strlcpy(info->filename, fname, sizeof(info->filename));
    }
    return filename;
}

#fillString

Return the fill color as a String.

Returns:

  • (String)

    the fill color



1187
1188
1189
1190
1191
# File 'ext/RMagick/rminfo.cpp', line 1187

VALUE
Info_fill(VALUE self)
{
    return get_option(self, "fill");
}

#fill=(color) ⇒ String

Set the fill color

Parameters:

  • color (String)

    the fill color

Returns:

  • (String)

    the given value



1199
1200
1201
1202
1203
# File 'ext/RMagick/rminfo.cpp', line 1199

VALUE
Info_fill_eq(VALUE self, VALUE color)
{
    return set_color_option(self, "fill", color);
}

#fontString

Get the text font.

Returns:

  • (String)

    the font



1211
1212
1213
1214
1215
# File 'ext/RMagick/rminfo.cpp', line 1211

VALUE
Info_font(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, font, str, &rm_info_data_type);
}

#font=(font_arg) ⇒ String

Set the text font.

Parameters:

  • font_arg (String)

    the font

Returns:

  • (String)

    the given font



1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
# File 'ext/RMagick/rminfo.cpp', line 1223

VALUE
Info_font_eq(VALUE self, VALUE font_arg)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    if (NIL_P(font_arg) || StringValueCStr(font_arg) == NULL)
    {
        magick_free(info->font);
        info->font = NULL;
    }
    else
    {
        char *font;

        font = StringValueCStr(font_arg);
        magick_clone_string(&info->font, font);
    }
    return font_arg;
}

#formatString?

Return the image encoding format.

Returns:

  • (String, nil)

    the encoding format



1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
# File 'ext/RMagick/rminfo.cpp', line 1249

VALUE Info_format(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    if (*info->magick)
    {
        const MagickInfo *magick_info;
        ExceptionInfo *exception;

        exception = AcquireExceptionInfo();
        magick_info = GetMagickInfo(info->magick, exception);
        DestroyExceptionInfo(exception);

        return magick_info ? rb_str_new2(magick_info->name) : Qnil;
    }

    return Qnil;
}

#format=(magick) ⇒ String

Set the image encoding format.

Parameters:

  • magick (String)

    the encoding format

Returns:

  • (String)

    the given format



1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
# File 'ext/RMagick/rminfo.cpp', line 1275

VALUE
Info_format_eq(VALUE self, VALUE magick)
{
    Info *info;
    const MagickInfo *m;
    char *mgk;
    ExceptionInfo *exception;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    mgk = StringValueCStr(magick);

    exception = AcquireExceptionInfo();
    m = GetMagickInfo(mgk, exception);
    CHECK_EXCEPTION();
    DestroyExceptionInfo(exception);

    if (!m)
    {
        rb_raise(rb_eArgError, "unknown format: %s", mgk);
    }

    strlcpy(info->magick, m->name, sizeof(info->magick));
    return magick;
}

#freezeObject

Overrides freeze in classes that can’t be frozen.

No Ruby usage (internal function)

Raises:

  • (TypeError)


314
315
316
317
318
# File 'ext/RMagick/rmutil.cpp', line 314

VALUE
rm_no_freeze(VALUE obj)
{
    rb_raise(rb_eTypeError, "can't freeze %s", rb_class2name(CLASS_OF(obj)));
}

#fuzzFloat

Get the fuzz.

Returns:

  • (Float)

    the fuzz

See Also:



1307
1308
1309
1310
1311
# File 'ext/RMagick/rminfo.cpp', line 1307

VALUE
Info_fuzz(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, fuzz, dbl, &rm_info_data_type);
}

#fuzz=(fuzz) ⇒ Float, String

Set the fuzz.

Parameters:

  • fuzz (Float, String)

    the fuzz with Float or percent format “xx%” with String

Returns:

  • (Float, String)

    the given value

See Also:



1321
1322
1323
1324
1325
1326
1327
1328
1329
# File 'ext/RMagick/rminfo.cpp', line 1321

VALUE
Info_fuzz_eq(VALUE self, VALUE fuzz)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    info->fuzz = rm_fuzz_to_dbl(fuzz);
    return fuzz;
}

#gravityMagick::GravityType

Return the value of the gravity option as a GravityType enumerator.

Returns:

  • (Magick::GravityType)

    the gravity enumerator



1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
# File 'ext/RMagick/rminfo.cpp', line 1387

VALUE Info_gravity(VALUE self)
{
    Info *info;
    const char *gravity;
    ID gravity_id;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    gravity_id = rb_intern("UndefinedGravity");

    // Map the gravity option string to a GravityType enumerator.
    gravity = GetImageOption(info, "gravity");
    if (gravity)
    {
        for (int x = 0; x < N_GRAVITY_OPTIONS; x++)
        {
            if (strcmp(gravity, Gravity_Option[x].string) == 0)
            {
                gravity_id = rb_intern(Gravity_Option[x].enum_name);
                break;
            }
        }
    }

    return rb_const_get(Module_Magick, gravity_id);
}

#gravity=(grav) ⇒ Magick::GravityType

Convert a GravityType enum to a gravity option name and store in the Info structure.

Parameters:

  • grav (Magick::GravityType)

    the gravity enumerator

Returns:

  • (Magick::GravityType)

    the given gravity



1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
# File 'ext/RMagick/rminfo.cpp', line 1421

VALUE
Info_gravity_eq(VALUE self, VALUE grav)
{
    Info *info;
    GravityType gravity;
    const char *option;
    int x;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (NIL_P(grav))
    {
        DeleteImageOption(info, "gravity");
        return grav;
    }

    VALUE_TO_ENUM(grav, gravity, GravityType);
    option = "Undefined";

    for (x = 0; x < N_GRAVITY_OPTIONS; x++)
    {
        if (gravity == Gravity_Option[x].enumerator)
        {
            option = Gravity_Option[x].string;
            break;
        }
    }

    SetImageOption(info, "gravity", option);
    return grav;
}

#image_typeMagick::ImageType

Get the classification type.

Returns:

  • (Magick::ImageType)

    the classification type



1459
1460
1461
1462
1463
1464
1465
1466
# File 'ext/RMagick/rminfo.cpp', line 1459

VALUE
Info_image_type(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return ImageType_find(info->type);
}

#image_type=(type) ⇒ Magick::ImageType

Set the classification type.

Parameters:

  • type (Magick::ImageType)

    the classification type

Returns:

  • (Magick::ImageType)

    the given type



1474
1475
1476
1477
1478
1479
1480
1481
1482
# File 'ext/RMagick/rminfo.cpp', line 1474

VALUE
Info_image_type_eq(VALUE self, VALUE type)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    VALUE_TO_ENUM(type, info->type, ImageType);
    return type;
}

#interlaceMagick::InterlaceType

Get the interlace type.

Returns:

  • (Magick::InterlaceType)

    the interlace type



1489
1490
1491
1492
1493
1494
1495
1496
# File 'ext/RMagick/rminfo.cpp', line 1489

VALUE
Info_interlace(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return InterlaceType_find(info->interlace);
}

#interlace=(inter) ⇒ Magick::InterlaceType

Set the interlace type

Parameters:

  • inter (Magick::InterlaceType)

    the interlace type

Returns:

  • (Magick::InterlaceType)

    the given interlace



1504
1505
1506
1507
1508
1509
1510
1511
1512
# File 'ext/RMagick/rminfo.cpp', line 1504

VALUE
Info_interlace_eq(VALUE self, VALUE inter)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    VALUE_TO_ENUM(inter, info->interlace, InterlaceType);
    return inter;
}

#labelString

Get the label.

Returns:

  • (String)

    the label



1519
1520
1521
1522
# File 'ext/RMagick/rminfo.cpp', line 1519

VALUE Info_label(VALUE self)
{
    return get_option(self, "Label");
}

#label=(string) ⇒ String

Set the label.

Parameters:

  • string (String)

    the label

Returns:

  • (String)

    the given label



1530
1531
1532
1533
# File 'ext/RMagick/rminfo.cpp', line 1530

VALUE Info_label_eq(VALUE self, VALUE string)
{
    return set_option(self, "Label", string);
}

#matte_colorString

Return the name of the matte color as a String.

Returns:

  • (String)

    the name of the matte color

See Also:



1541
1542
1543
1544
1545
1546
1547
1548
# File 'ext/RMagick/rminfo.cpp', line 1541

VALUE
Info_matte_color(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return rm_pixelcolor_to_color_name_info(info, &info->matte_color);
}

#matte_color=(matte_arg) ⇒ Magick::Pixel, String

Set the matte color.

Parameters:

  • matte_arg (Magick::Pixel, String)

    the name of the matte as a String

Returns:



1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
# File 'ext/RMagick/rminfo.cpp', line 1556

VALUE
Info_matte_color_eq(VALUE self, VALUE matte_arg)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    Color_to_PixelColor(&info->matte_color, matte_arg);

    return matte_arg;
}

#monochromeBoolean

Get the monochrome value.

Returns:

  • (Boolean)

    true or false



1572
1573
1574
1575
1576
# File 'ext/RMagick/rminfo.cpp', line 1572

VALUE
Info_monochrome(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, monochrome, boolean, &rm_info_data_type);
}

#monochrome=(val) ⇒ Boolean

Set the monochrome value.

Parameters:

  • val (Boolean)

    true or false

Returns:

  • (Boolean)

    the given value



1584
1585
1586
1587
1588
# File 'ext/RMagick/rminfo.cpp', line 1584

VALUE
Info_monochrome_eq(VALUE self, VALUE val)
{
    IMPLEMENT_TYPED_ATTR_WRITER(Info, monochrome, boolean, &rm_info_data_type);
}

#number_scenesNumeric

Get the scene number of an image or the first image in a sequence.

Returns:

  • (Numeric)

    the scene number



1595
1596
1597
1598
1599
# File 'ext/RMagick/rminfo.cpp', line 1595

VALUE
Info_number_scenes(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, number_scenes, ulong, &rm_info_data_type);
}

#number_scenes=(val) ⇒ Numeric

Set the scene number of an image or the first image in a sequence.

Parameters:

  • val (Numeric)

    the scene number

Returns:

  • (Numeric)

    the given value



1607
1608
1609
1610
1611
# File 'ext/RMagick/rminfo.cpp', line 1607

VALUE
Info_number_scenes_eq(VALUE self, VALUE val)
{
    IMPLEMENT_TYPED_ATTR_WRITER(Info, number_scenes, ulong, &rm_info_data_type);
}

#orientationMagick::OrientationType

Return the orientation attribute as an OrientationType enum value.

Returns:

  • (Magick::OrientationType)

    the orientation



1618
1619
1620
1621
1622
1623
1624
1625
# File 'ext/RMagick/rminfo.cpp', line 1618

VALUE
Info_orientation(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return OrientationType_find(info->orientation);
}

#orientation=(inter) ⇒ Magick::OrientationType

Set the Orientation type.

Parameters:

  • inter (Magick::OrientationType)

    the orientation type as an OrientationType enum value

Returns:

  • (Magick::OrientationType)

    the given value



1634
1635
1636
1637
1638
1639
1640
1641
1642
# File 'ext/RMagick/rminfo.cpp', line 1634

VALUE
Info_orientation_eq(VALUE self, VALUE inter)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    VALUE_TO_ENUM(inter, info->orientation, OrientationType);
    return inter;
}

#originString

Return origin geometry.

Returns:

  • (String)

    the origin geometry

See Also:



1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
# File 'ext/RMagick/rminfo.cpp', line 1651

VALUE
Info_origin(VALUE self)
{
    Info *info;
    const char *origin;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    origin = GetImageOption(info, "origin");
    return origin ? rb_str_new2(origin) : Qnil;
}

#origin=(origin_arg) ⇒ Magick::Geometry, String

Set origin geometry. Argument may be a Geometry object as well as a geometry string.

The geometry format is

+-x+-y

Parameters:

Returns:

See Also:



1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
# File 'ext/RMagick/rminfo.cpp', line 1675

VALUE
Info_origin_eq(VALUE self, VALUE origin_arg)
{
    Info *info;
    VALUE origin_str;
    char *origin;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (NIL_P(origin_arg))
    {
        DeleteImageOption(info, "origin");
        return origin_arg;
    }

    origin_str = rb_String(origin_arg);
    origin = GetPageGeometry(StringValueCStr(origin_str));

    if (IsGeometry(origin) == MagickFalse)
    {
        magick_free(origin);
        rb_raise(rb_eArgError, "invalid origin geometry");
    }

    SetImageOption(info, "origin", origin);
    magick_free(origin);

    RB_GC_GUARD(origin_str);

    return origin_arg;
}

#pageString

Get the Postscript page geometry.

Returns:

  • (String)

    the page geometry



1713
1714
1715
1716
1717
1718
1719
1720
1721
# File 'ext/RMagick/rminfo.cpp', line 1713

VALUE
Info_page(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return info->page ? rb_str_new2(info->page) : Qnil;

}

#page=(page_arg) ⇒ Magick::Geometry, String

Store the Postscript page geometry. Argument may be a Geometry object as well as a geometry string.

Parameters:

Returns:

See Also:



1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
# File 'ext/RMagick/rminfo.cpp', line 1731

VALUE
Info_page_eq(VALUE self, VALUE page_arg)
{
    Info *info;
    VALUE geom_str;
    char *geometry;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    if (NIL_P(page_arg))
    {
        magick_free(info->page);
        info->page = NULL;
        return page_arg;
    }
    geom_str = rb_String(page_arg);
    geometry = GetPageGeometry(StringValueCStr(geom_str));
    if (*geometry == '\0')
    {
        magick_free(info->page);
        info->page = NULL;
        return page_arg;
    }
    info->page = geometry;

    RB_GC_GUARD(geom_str);

    return page_arg;
}

#pointsizeFloat

Get the point size.

Returns:

  • (Float)

    the point size



1765
1766
1767
1768
1769
# File 'ext/RMagick/rminfo.cpp', line 1765

VALUE
Info_pointsize(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, pointsize, dbl, &rm_info_data_type);
}

#pointsize=(val) ⇒ Float

Set the point size.

Parameters:

  • val (Float)

    the point size

Returns:

  • (Float)

    the given value



1777
1778
1779
1780
1781
# File 'ext/RMagick/rminfo.cpp', line 1777

VALUE
Info_pointsize_eq(VALUE self, VALUE val)
{
    IMPLEMENT_TYPED_ATTR_WRITER(Info, pointsize, dbl, &rm_info_data_type);
}

#qualityNumeric

Get the compression level for JPEG, etc.

Returns:

  • (Numeric)

    the compression level



1788
1789
1790
1791
1792
# File 'ext/RMagick/rminfo.cpp', line 1788

VALUE
Info_quality(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, quality, ulong, &rm_info_data_type);
}

#quality=(val) ⇒ Numeric

Get the compression level for JPEG, etc.

Parameters:

  • val (Numeric)

    the compression level

Returns:

  • (Numeric)

    the given value



1800
1801
1802
1803
1804
# File 'ext/RMagick/rminfo.cpp', line 1800

VALUE
Info_quality_eq(VALUE self, VALUE val)
{
    IMPLEMENT_TYPED_ATTR_WRITER(Info, quality, ulong, &rm_info_data_type);
}

#sampling_factorString?

Get sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.

Returns:

  • (String, nil)

    the sampling factors



1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
# File 'ext/RMagick/rminfo.cpp', line 1811

VALUE
Info_sampling_factor(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    if (info->sampling_factor)
    {
        return rb_str_new2(info->sampling_factor);
    }
    else
    {
        return Qnil;
    }
}

#sampling_factor=(sampling_factor) ⇒ String

Set sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.

Parameters:

  • sampling_factor (String)

    the sampling factors

Returns:

  • (String)

    the given value



1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
# File 'ext/RMagick/rminfo.cpp', line 1833

VALUE
Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
{
    Info *info;
    char *sampling_factor_p = NULL;
    size_t sampling_factor_len = 0;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (!NIL_P(sampling_factor))
    {
        sampling_factor_p = rm_str2cstr(sampling_factor, &sampling_factor_len);
    }

    if (info->sampling_factor)
    {
        magick_free(info->sampling_factor);
        info->sampling_factor = NULL;
    }
    if (sampling_factor_len > 0)
    {
        magick_clone_string(&info->sampling_factor, sampling_factor_p);
    }

    return sampling_factor;
}

#sceneNumeric

Get the scene number.

Returns:

  • (Numeric)

    the scene number



1866
1867
1868
1869
1870
1871
1872
1873
# File 'ext/RMagick/rminfo.cpp', line 1866

VALUE
Info_scene(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return  ULONG2NUM(info->scene);
}

#scene=(scene) ⇒ Numeric

Set the scene number.

Parameters:

  • scene (Numeric)

    the scene number

Returns:

  • (Numeric)

    the given value



1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
# File 'ext/RMagick/rminfo.cpp', line 1882

VALUE
Info_scene_eq(VALUE self, VALUE scene)
{
    Info *info;
    char buf[25];

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    info->scene = NUM2ULONG(scene);

    snprintf(buf, sizeof(buf), "%" RMIuSIZE "", info->scene);
    SetImageOption(info, "scene", buf);

    return scene;
}

#server_nameString

Get the server name.

Returns:

  • (String)

    the server name



1903
1904
1905
1906
1907
# File 'ext/RMagick/rminfo.cpp', line 1903

VALUE
Info_server_name(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, server_name, str, &rm_info_data_type);
}

#server_name=(server_arg) ⇒ String

Set the server name.

Parameters:

  • server_arg (String)

    the server name

Returns:

  • (String)

    the given value



1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
# File 'ext/RMagick/rminfo.cpp', line 1916

VALUE
Info_server_name_eq(VALUE self, VALUE server_arg)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    if (NIL_P(server_arg) || StringValueCStr(server_arg) == NULL)
    {
        magick_free(info->server_name);
        info->server_name = NULL;
    }
    else
    {
        char *server;

        server = StringValueCStr(server_arg);
        magick_clone_string(&info->server_name, server);
    }
    return server_arg;
}

#sizeString

Get ths size

Returns:

  • (String)

    the size as a Geometry object

See Also:



1943
1944
1945
1946
1947
# File 'ext/RMagick/rminfo.cpp', line 1943

VALUE
Info_size(VALUE self)
{
    IMPLEMENT_TYPED_ATTR_READER(Info, size, str, &rm_info_data_type);
}

#size=(size_arg) ⇒ Magick::Geometry, String

Set the size (either as a Geometry object or a Geometry string

Parameters:

Returns:

See Also:



1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
# File 'ext/RMagick/rminfo.cpp', line 1956

VALUE
Info_size_eq(VALUE self, VALUE size_arg)
{
    Info *info;
    VALUE size;
    char *sz;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (NIL_P(size_arg))
    {
        magick_free(info->size);
        info->size = NULL;
        return size_arg;
    }

    size = rb_String(size_arg);
    sz = StringValueCStr(size);
    if (!IsGeometry(sz))
    {
        rb_raise(rb_eArgError, "invalid size geometry: %s", sz);
    }

    magick_clone_string(&info->size, sz);

    RB_GC_GUARD(size);

    return size_arg;
}

#strokeString

Return the stroke color as a String.

Returns:

  • (String)

    the stroke color



1992
1993
1994
1995
1996
# File 'ext/RMagick/rminfo.cpp', line 1992

VALUE
Info_stroke(VALUE self)
{
    return get_option(self, "stroke");
}

#stroke=(color) ⇒ String

Set the stroke color

Parameters:

  • color (String)

    the stroke color

Returns:

  • (String)

    the given value



2004
2005
2006
2007
2008
# File 'ext/RMagick/rminfo.cpp', line 2004

VALUE
Info_stroke_eq(VALUE self, VALUE color)
{
    return set_color_option(self, "stroke", color);
}

#stroke_widthFloat

Get stroke width.

Returns:

  • (Float)

    the stroke width



2016
2017
2018
2019
2020
# File 'ext/RMagick/rminfo.cpp', line 2016

VALUE
Info_stroke_width(VALUE self)
{
    return get_dbl_option(self, "strokewidth");
}

#stroke_width=(stroke_width) ⇒ Float

Set stroke width.

Parameters:

  • stroke_width (Float)

    the stroke width

Returns:

  • (Float)

    the given value



2029
2030
2031
2032
2033
# File 'ext/RMagick/rminfo.cpp', line 2029

VALUE
Info_stroke_width_eq(VALUE self, VALUE stroke_width)
{
    return set_dbl_option(self, "strokewidth", stroke_width);
}

#texture=(texture) ⇒ Magick::Image

Set name of texture to tile onto the image background.

Parameters:

Returns:



2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
# File 'ext/RMagick/rminfo.cpp', line 2042

VALUE
Info_texture_eq(VALUE self, VALUE texture)
{
    Info *info;
    Image *image;
    char name[MaxTextExtent];

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    // Delete any existing texture file
    if (info->texture)
    {
        rm_delete_temp_image(info->texture);
        magick_free(info->texture);
        info->texture = NULL;
    }

    // If argument is nil we're done
    if (texture == Qnil)
    {
        return texture;
    }

    // Create a temp copy of the texture and store its name in the texture field
    image = rm_check_destroyed(texture);
    rm_write_temp_image(image, name, sizeof(name));

    magick_clone_string(&info->texture, name);

    return texture;
}

#tile_offsetString?

Return tile_offset geometry.

Returns:

  • (String, nil)

    the tile offset

See Also:



2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
# File 'ext/RMagick/rminfo.cpp', line 2081

VALUE
Info_tile_offset(VALUE self)
{
    Info *info;
    const char *tile_offset;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    tile_offset = GetImageOption(info, "tile-offset");

    if (!tile_offset)
    {
        return Qnil;
    }

    return rb_str_new2(tile_offset);
}

#tile_offset=(offset) ⇒ Magick::Geometry, String

Set tile offset geometry.

Parameters:

Returns:

See Also:



2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
# File 'ext/RMagick/rminfo.cpp', line 2107

VALUE
Info_tile_offset_eq(VALUE self, VALUE offset)
{
    Info *info;
    VALUE offset_str;
    char *tile_offset;

    offset_str = rb_String(offset);
    tile_offset = StringValueCStr(offset_str);
    if (!IsGeometry(tile_offset))
    {
        rb_raise(rb_eArgError, "invalid tile offset geometry: %s", tile_offset);
    }

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    DeleteImageOption(info, "tile-offset");
    SetImageOption(info, "tile-offset", tile_offset);

    RB_GC_GUARD(offset_str);

    return offset;
}

#transparent_colorString

Return the name of the transparent color.

Returns:

  • (String)

    the name of the transparent color

See Also:



2138
2139
2140
2141
2142
2143
2144
2145
# File 'ext/RMagick/rminfo.cpp', line 2138

VALUE
Info_transparent_color(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return rm_pixelcolor_to_color_name_info(info, &info->transparent_color);
}

#transparent_color=(tc_arg) ⇒ Magick::Pixel, String

Set the transparent color.

Parameters:

  • tc_arg (String)

    the transparent color

Returns:



2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
# File 'ext/RMagick/rminfo.cpp', line 2154

VALUE
Info_transparent_color_eq(VALUE self, VALUE tc_arg)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    Color_to_PixelColor(&info->transparent_color, tc_arg);

    return tc_arg;
}

#undefine(format, key) ⇒ Magick::Info

Undefine image option.

Parameters:

  • format (String)

    the format

  • key (String)

    the key

Returns:

  • (Magick::Info)

    self



2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
# File 'ext/RMagick/rminfo.cpp', line 2173

VALUE
Info_undefine(VALUE self, VALUE format, VALUE key)
{
    Info *info;
    char *format_p, *key_p;
    size_t format_l, key_l;
    char fkey[MaxTextExtent];

    format_p = rm_str2cstr(format, &format_l);
    key_p = rm_str2cstr(key, &key_l);

    if (format_l > MAX_FORMAT_LEN || format_l + key_l > MaxTextExtent)
    {
        rb_raise(rb_eArgError, "can't undefine %.60s:%.1024s - too long", format_p, key_p);
    }

    snprintf(fkey, sizeof(fkey), "%.60s:%.*s", format_p, (int)(MaxTextExtent-61), key_p);

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    DeleteImageOption(info, fkey);

    return self;
}

#undercolorString

Return the undercolor color.

Returns:

  • (String)

    the undercolor



2203
2204
2205
2206
2207
# File 'ext/RMagick/rminfo.cpp', line 2203

VALUE
Info_undercolor(VALUE self)
{
    return get_option(self, "undercolor");
}

#undercolor=(color) ⇒ String

Set the undercolor color.

Parameters:

  • color (String)

    the undercolor color

Returns:

  • (String)

    the given value



2215
2216
2217
2218
2219
# File 'ext/RMagick/rminfo.cpp', line 2215

VALUE
Info_undercolor_eq(VALUE self, VALUE color)
{
    return set_color_option(self, "undercolor", color);
}

#unitsMagick::ResolutionType

Get the resolution type.

Returns:

  • (Magick::ResolutionType)

    the resolution type



2226
2227
2228
2229
2230
2231
2232
2233
# File 'ext/RMagick/rminfo.cpp', line 2226

VALUE
Info_units(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    return ResolutionType_find(info->units);
}

#units=(units) ⇒ Magick::ResolutionType

Set the resolution type

Parameters:

  • units (Magick::ResolutionType)

    the resolution type

Returns:

  • (Magick::ResolutionType)

    the given value



2241
2242
2243
2244
2245
2246
2247
2248
2249
# File 'ext/RMagick/rminfo.cpp', line 2241

VALUE
Info_units_eq(VALUE self, VALUE units)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
    VALUE_TO_ENUM(units, info->units, ResolutionType);
    return units;
}

#viewString

Get FlashPix viewing parameters.

Returns:

  • (String)

    the viewing parameters



2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
# File 'ext/RMagick/rminfo.cpp', line 2256

VALUE
Info_view(VALUE self)
{
    Info *info;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
#if defined(IMAGEMAGICK_7)
    return C_str_to_R_str(GetImageOption(info, "fpx:view"));
#else
    return C_str_to_R_str(info->view);
#endif
}

#view=(view_arg) ⇒ String

Set FlashPix viewing parameters.

Parameters:

  • view_arg (String)

    the viewing parameters

Returns:

  • (String)

    the given value



2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
# File 'ext/RMagick/rminfo.cpp', line 2275

VALUE
Info_view_eq(VALUE self, VALUE view_arg)
{
    Info *info;
    char *view = NULL;

    TypedData_Get_Struct(self, Info, &rm_info_data_type, info);

    if (!NIL_P(view_arg))
    {
        view = StringValueCStr(view_arg);
    }

#if defined(IMAGEMAGICK_7)
    if (view)
    {
        SetImageOption(info, "fpx:view", view);
    }
    else
    {
        RemoveImageOption(info, "fpx:view");
    }
#else
    if (info->view)
    {
        magick_free(info->view);
        info->view = NULL;
    }
    if (view)
    {
        magick_clone_string(&info->view, view);
    }
#endif
    return view_arg;
}