rmagick 3.2.0 → 4.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +51 -0
- data/examples/crop_with_gravity.rb +2 -1
- data/examples/histogram.rb +2 -2
- data/examples/identify.rb +4 -4
- data/examples/vignette.rb +3 -3
- data/ext/RMagick/rmagick.h +1 -16
- data/ext/RMagick/rmilist.c +0 -126
- data/ext/RMagick/rmimage.c +17 -424
- data/ext/RMagick/rminfo.c +1 -49
- data/ext/RMagick/rmkinfo.c +0 -36
- data/ext/RMagick/rmmain.c +2 -29
- data/ext/RMagick/rmpixel.c +5 -125
- data/ext/RMagick/rmstruct.c +3 -3
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +0 -9
- data/lib/rvg/rvg.rb +2 -2
- data/test/Image1.rb +1 -22
- data/test/Image2.rb +8 -26
- data/test/Image3.rb +7 -12
- data/test/ImageList2.rb +0 -31
- data/test/Image_attributes.rb +0 -31
- data/test/Import_Export.rb +0 -4
- data/test/Info.rb +0 -8
- data/test/KernelInfo.rb +0 -8
- data/test/Pixel.rb +6 -32
- data/test/Struct.rb +1 -1
- data/test/lib/internal/Draw.rb +1 -13
- metadata +2 -5
- data/lib/obsolete.rb +0 -66
- data/test/lib/Obsolete.rb +0 -30
data/ext/RMagick/rminfo.c
CHANGED
@@ -1473,8 +1473,7 @@ static struct
|
|
1473
1473
|
{ "SouthEast", "SouthEastGravity", SouthEastGravity},
|
1474
1474
|
{ "South", "SouthGravity", SouthGravity},
|
1475
1475
|
{ "SouthWest", "SouthWestGravity", SouthWestGravity},
|
1476
|
-
{ "West", "WestGravity", WestGravity}
|
1477
|
-
{ "Static", "StaticGravity", StaticGravity}
|
1476
|
+
{ "West", "WestGravity", WestGravity}
|
1478
1477
|
};
|
1479
1478
|
|
1480
1479
|
/** Number of gravity options */
|
@@ -1588,53 +1587,6 @@ Info_gravity_eq(VALUE self, VALUE grav)
|
|
1588
1587
|
}
|
1589
1588
|
|
1590
1589
|
|
1591
|
-
/**
|
1592
|
-
* Get the group attribute.
|
1593
|
-
*
|
1594
|
-
* Ruby usage:
|
1595
|
-
* - @verbatim Info#group @endverbatim
|
1596
|
-
*
|
1597
|
-
* @param self this object
|
1598
|
-
* @return the group
|
1599
|
-
* @deprecated This method has been deprecated.
|
1600
|
-
*/
|
1601
|
-
VALUE
|
1602
|
-
Info_group(VALUE self)
|
1603
|
-
{
|
1604
|
-
Info *info;
|
1605
|
-
|
1606
|
-
rb_warning("Info#group is deprecated");
|
1607
|
-
(void) rm_check_destroyed(self);
|
1608
|
-
Data_Get_Struct(self, Info, info);
|
1609
|
-
return C_long_to_R_long(info->group);
|
1610
|
-
}
|
1611
|
-
|
1612
|
-
|
1613
|
-
/**
|
1614
|
-
* Set the group attribute.
|
1615
|
-
*
|
1616
|
-
* Ruby usage:
|
1617
|
-
* - @verbatim Info#group= @endverbatim
|
1618
|
-
*
|
1619
|
-
* @param self this object
|
1620
|
-
* @param value the group
|
1621
|
-
* @return value
|
1622
|
-
* @deprecated This method has been deprecated.
|
1623
|
-
*/
|
1624
|
-
VALUE
|
1625
|
-
Info_group_eq(VALUE self, VALUE value)
|
1626
|
-
{
|
1627
|
-
Info *info;
|
1628
|
-
|
1629
|
-
rb_warning("Info#group= is deprecated");
|
1630
|
-
(void) rm_check_destroyed(self);
|
1631
|
-
rb_check_frozen(self);
|
1632
|
-
Data_Get_Struct(self, Info, info);
|
1633
|
-
info->group = R_long_to_C_long(value);
|
1634
|
-
return value;
|
1635
|
-
}
|
1636
|
-
|
1637
|
-
|
1638
1590
|
/**
|
1639
1591
|
* Get the classification type.
|
1640
1592
|
*
|
data/ext/RMagick/rmkinfo.c
CHANGED
@@ -68,26 +68,6 @@ KernelInfo_initialize(VALUE self, VALUE kernel_string)
|
|
68
68
|
return self;
|
69
69
|
}
|
70
70
|
|
71
|
-
/**
|
72
|
-
* Zero kerne NaNs.
|
73
|
-
*
|
74
|
-
* Ruby usage:
|
75
|
-
* - @verbatim KernelInfo#zero_nans @endverbatim
|
76
|
-
*
|
77
|
-
* @param self this object
|
78
|
-
* @deprecated This method has been deprecated.
|
79
|
-
*/
|
80
|
-
|
81
|
-
/* ZeroKernelNans() is private function in ImageMagick. */
|
82
|
-
MagickExport void ZeroKernelNans(KernelInfo *kernel);
|
83
|
-
|
84
|
-
VALUE
|
85
|
-
KernelInfo_zero_nans(VALUE self)
|
86
|
-
{
|
87
|
-
rb_warning("KernelInfo#zero_nans is deprecated");
|
88
|
-
ZeroKernelNans((KernelInfo*)DATA_PTR(self));
|
89
|
-
return Qnil;
|
90
|
-
}
|
91
71
|
|
92
72
|
/**
|
93
73
|
* Adds a given amount of the 'Unity' Convolution Kernel to the given pre-scaled and normalized Kernel.
|
@@ -112,22 +92,6 @@ KernelInfo_unity_add(VALUE self, VALUE scale)
|
|
112
92
|
return Qnil;
|
113
93
|
}
|
114
94
|
|
115
|
-
/**
|
116
|
-
* Dumps KernelInfo object to stderr
|
117
|
-
*
|
118
|
-
* Ruby usage:
|
119
|
-
* - @verbatim KernelInfo#show @endverbatim
|
120
|
-
*
|
121
|
-
* @param self this object
|
122
|
-
* @deprecated This method has been deprecated.
|
123
|
-
*/
|
124
|
-
VALUE
|
125
|
-
KernelInfo_show(VALUE self)
|
126
|
-
{
|
127
|
-
rb_warning("KernelInfo#show is deprecated");
|
128
|
-
ShowKernelInfo((KernelInfo*)DATA_PTR(self));
|
129
|
-
return Qnil;
|
130
|
-
}
|
131
95
|
|
132
96
|
/**
|
133
97
|
* Scales the given kernel list by the given amount, with or without normalization
|
data/ext/RMagick/rmmain.c
CHANGED
@@ -210,7 +210,6 @@ Init_RMagick2(void)
|
|
210
210
|
rb_define_alloc_func(Class_Image, Image_alloc);
|
211
211
|
rb_define_method(Class_Image, "initialize", Image_initialize, -1);
|
212
212
|
|
213
|
-
rb_define_singleton_method(Class_Image, "combine", Image_combine, -1);
|
214
213
|
rb_define_singleton_method(Class_Image, "constitute", Image_constitute, 4);
|
215
214
|
rb_define_singleton_method(Class_Image, "_load", Image__load, 1);
|
216
215
|
rb_define_singleton_method(Class_Image, "capture", Image_capture, -1);
|
@@ -219,14 +218,12 @@ Init_RMagick2(void)
|
|
219
218
|
rb_define_singleton_method(Class_Image, "read_inline", Image_read_inline, 1);
|
220
219
|
rb_define_singleton_method(Class_Image, "from_blob", Image_from_blob, 1);
|
221
220
|
|
222
|
-
DCL_ATTR_WRITER(Image, alpha)
|
223
221
|
DCL_ATTR_ACCESSOR(Image, background_color)
|
224
222
|
DCL_ATTR_READER(Image, base_columns)
|
225
223
|
DCL_ATTR_READER(Image, base_filename)
|
226
224
|
DCL_ATTR_READER(Image, base_rows)
|
227
225
|
DCL_ATTR_ACCESSOR(Image, bias)
|
228
226
|
DCL_ATTR_ACCESSOR(Image, black_point_compensation)
|
229
|
-
DCL_ATTR_ACCESSOR(Image, blur)
|
230
227
|
DCL_ATTR_ACCESSOR(Image, border_color)
|
231
228
|
DCL_ATTR_READER(Image, bounding_box)
|
232
229
|
DCL_ATTR_ACCESSOR(Image, chromaticity)
|
@@ -255,8 +252,6 @@ Init_RMagick2(void)
|
|
255
252
|
DCL_ATTR_ACCESSOR(Image, interlace)
|
256
253
|
DCL_ATTR_ACCESSOR(Image, iptc_profile)
|
257
254
|
DCL_ATTR_ACCESSOR(Image, iterations) // do not document! Only used by Image#iterations=
|
258
|
-
DCL_ATTR_WRITER(Image, mask)
|
259
|
-
DCL_ATTR_ACCESSOR(Image, matte)
|
260
255
|
DCL_ATTR_ACCESSOR(Image, matte_color)
|
261
256
|
DCL_ATTR_READER(Image, mean_error_per_pixel)
|
262
257
|
DCL_ATTR_READER(Image, mime_type)
|
@@ -266,7 +261,6 @@ Init_RMagick2(void)
|
|
266
261
|
DCL_ATTR_READER(Image, normalized_maximum_error)
|
267
262
|
DCL_ATTR_READER(Image, number_colors)
|
268
263
|
DCL_ATTR_ACCESSOR(Image, offset)
|
269
|
-
DCL_ATTR_WRITER(Image, opacity)
|
270
264
|
DCL_ATTR_ACCESSOR(Image, orientation)
|
271
265
|
DCL_ATTR_ACCESSOR(Image, page)
|
272
266
|
DCL_ATTR_ACCESSOR(Image, pixel_interpolation_method)
|
@@ -412,7 +406,6 @@ Init_RMagick2(void)
|
|
412
406
|
rb_define_method(Class_Image, "liquid_rescale", Image_liquid_rescale, -1);
|
413
407
|
rb_define_method(Class_Image, "magnify", Image_magnify, 0);
|
414
408
|
rb_define_method(Class_Image, "magnify!", Image_magnify_bang, 0);
|
415
|
-
rb_define_method(Class_Image, "map", Image_map, -1);
|
416
409
|
rb_define_method(Class_Image, "marshal_dump", Image_marshal_dump, 0);
|
417
410
|
rb_define_method(Class_Image, "marshal_load", Image_marshal_load, 1);
|
418
411
|
rb_define_method(Class_Image, "mask", Image_mask, -1);
|
@@ -484,7 +477,6 @@ Init_RMagick2(void)
|
|
484
477
|
rb_define_method(Class_Image, "strip!", Image_strip_bang, 0);
|
485
478
|
rb_define_method(Class_Image, "store_pixels", Image_store_pixels, 5);
|
486
479
|
rb_define_method(Class_Image, "swirl", Image_swirl, 1);
|
487
|
-
rb_define_method(Class_Image, "sync_profiles", Image_sync_profiles, 0);
|
488
480
|
rb_define_method(Class_Image, "texture_flood_fill", Image_texture_flood_fill, 5);
|
489
481
|
rb_define_method(Class_Image, "threshold", Image_threshold, 1);
|
490
482
|
rb_define_method(Class_Image, "thumbnail", Image_thumbnail, -1);
|
@@ -529,8 +521,6 @@ Init_RMagick2(void)
|
|
529
521
|
rb_define_method(Class_ImageList, "deconstruct", ImageList_deconstruct, 0);
|
530
522
|
rb_define_method(Class_ImageList, "display", ImageList_display, 0);
|
531
523
|
rb_define_method(Class_ImageList, "flatten_images", ImageList_flatten_images, 0);
|
532
|
-
rb_define_method(Class_ImageList, "fx", ImageList_fx, -1);
|
533
|
-
rb_define_method(Class_ImageList, "map", ImageList_map, -1);
|
534
524
|
rb_define_method(Class_ImageList, "montage", ImageList_montage, 0);
|
535
525
|
rb_define_method(Class_ImageList, "morph", ImageList_morph, 1);
|
536
526
|
rb_define_method(Class_ImageList, "mosaic", ImageList_mosaic, 0);
|
@@ -637,7 +627,6 @@ Init_RMagick2(void)
|
|
637
627
|
// and the deprecated "from_HSL".
|
638
628
|
rb_define_alloc_func(Class_Pixel, Pixel_alloc);
|
639
629
|
rb_define_singleton_method(Class_Pixel, "from_color", Pixel_from_color, 1);
|
640
|
-
rb_define_singleton_method(Class_Pixel, "from_HSL", Pixel_from_HSL, 1);
|
641
630
|
rb_define_singleton_method(Class_Pixel, "from_hsla", Pixel_from_hsla, -1);
|
642
631
|
|
643
632
|
// Define the RGBA attributes
|
@@ -645,7 +634,6 @@ Init_RMagick2(void)
|
|
645
634
|
DCL_ATTR_ACCESSOR(Pixel, green)
|
646
635
|
DCL_ATTR_ACCESSOR(Pixel, blue)
|
647
636
|
DCL_ATTR_ACCESSOR(Pixel, alpha)
|
648
|
-
DCL_ATTR_ACCESSOR(Pixel, opacity)
|
649
637
|
|
650
638
|
// Define the CMYK attributes
|
651
639
|
DCL_ATTR_ACCESSOR(Pixel, cyan)
|
@@ -668,7 +656,6 @@ Init_RMagick2(void)
|
|
668
656
|
rb_define_method(Class_Pixel, "marshal_dump", Pixel_marshal_dump, 0);
|
669
657
|
rb_define_method(Class_Pixel, "marshal_load", Pixel_marshal_load, 1);
|
670
658
|
rb_define_method(Class_Pixel, "to_color", Pixel_to_color, -1);
|
671
|
-
rb_define_method(Class_Pixel, "to_HSL", Pixel_to_HSL, 0); // deprecated
|
672
659
|
rb_define_method(Class_Pixel, "to_hsla", Pixel_to_hsla, 0);
|
673
660
|
rb_define_method(Class_Pixel, "to_s", Pixel_to_s, 0);
|
674
661
|
|
@@ -740,7 +727,6 @@ Init_RMagick2(void)
|
|
740
727
|
DCL_ATTR_ACCESSOR(Info, format)
|
741
728
|
DCL_ATTR_ACCESSOR(Info, fuzz)
|
742
729
|
DCL_ATTR_ACCESSOR(Info, gravity)
|
743
|
-
DCL_ATTR_ACCESSOR(Info, group)
|
744
730
|
DCL_ATTR_ACCESSOR(Info, image_type)
|
745
731
|
DCL_ATTR_ACCESSOR(Info, interlace)
|
746
732
|
DCL_ATTR_ACCESSOR(Info, label)
|
@@ -775,9 +761,7 @@ Init_RMagick2(void)
|
|
775
761
|
rb_define_alloc_func(Class_KernelInfo, KernelInfo_alloc);
|
776
762
|
|
777
763
|
rb_define_method(Class_KernelInfo, "initialize", KernelInfo_initialize, 1);
|
778
|
-
rb_define_method(Class_KernelInfo, "zero_nans", KernelInfo_zero_nans, 0);
|
779
764
|
rb_define_method(Class_KernelInfo, "unity_add", KernelInfo_unity_add, 1);
|
780
|
-
rb_define_method(Class_KernelInfo, "show", KernelInfo_show, 0);
|
781
765
|
rb_define_method(Class_KernelInfo, "scale", KernelInfo_scale, 2);
|
782
766
|
rb_define_method(Class_KernelInfo, "scale_geometry", KernelInfo_scale_geometry, 1);
|
783
767
|
rb_define_method(Class_KernelInfo, "clone", KernelInfo_clone, 0);
|
@@ -861,9 +845,7 @@ Init_RMagick2(void)
|
|
861
845
|
DEF_CONST(QuantumRange);
|
862
846
|
DEF_CONST(MAGICKCORE_QUANTUM_DEPTH);
|
863
847
|
DEF_CONSTV(OpaqueAlpha, QuantumRange);
|
864
|
-
DEF_CONST(OpaqueOpacity);
|
865
848
|
DEF_CONSTV(TransparentAlpha, 0);
|
866
|
-
DEF_CONST(TransparentOpacity);
|
867
849
|
|
868
850
|
version_constants();
|
869
851
|
features_constant();
|
@@ -898,7 +880,6 @@ Init_RMagick2(void)
|
|
898
880
|
ENUMERATOR(UndefinedAlphaChannel)
|
899
881
|
ENUMERATOR(ActivateAlphaChannel)
|
900
882
|
ENUMERATOR(DeactivateAlphaChannel)
|
901
|
-
ENUMERATOR(ResetAlphaChannel) /* deprecated */
|
902
883
|
ENUMERATOR(SetAlphaChannel)
|
903
884
|
ENUMERATOR(RemoveAlphaChannel)
|
904
885
|
ENUMERATOR(CopyAlphaChannel)
|
@@ -907,7 +888,6 @@ Init_RMagick2(void)
|
|
907
888
|
ENUMERATOR(ShapeAlphaChannel)
|
908
889
|
ENUMERATOR(TransparentAlphaChannel)
|
909
890
|
ENUMERATOR(BackgroundAlphaChannel)
|
910
|
-
ENUMERATOR(FlattenAlphaChannel)
|
911
891
|
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
912
892
|
ENUMERATOR(AssociateAlphaChannel)
|
913
893
|
ENUMERATOR(DisassociateAlphaChannel)
|
@@ -932,7 +912,6 @@ Init_RMagick2(void)
|
|
932
912
|
ENUMERATOR(YellowChannel)
|
933
913
|
ENUMERATOR(OpacityChannel)
|
934
914
|
ENUMERATOR(BlackChannel)
|
935
|
-
ENUMERATOR(MatteChannel)
|
936
915
|
ENUMERATOR(IndexChannel)
|
937
916
|
ENUMERATOR(GrayChannel)
|
938
917
|
ENUMERATOR(AllChannels)
|
@@ -969,9 +948,7 @@ Init_RMagick2(void)
|
|
969
948
|
ENUMERATOR(HWBColorspace)
|
970
949
|
ENUMERATOR(HSBColorspace)
|
971
950
|
ENUMERATOR(LabColorspace)
|
972
|
-
ENUMERATOR(Rec601LumaColorspace)
|
973
951
|
ENUMERATOR(Rec601YCbCrColorspace)
|
974
|
-
ENUMERATOR(Rec709LumaColorspace)
|
975
952
|
ENUMERATOR(Rec709YCbCrColorspace)
|
976
953
|
ENUMERATOR(LogColorspace)
|
977
954
|
ENUMERATOR(CMYColorspace)
|
@@ -1207,7 +1184,6 @@ Init_RMagick2(void)
|
|
1207
1184
|
ENUMERATOR(SouthWestGravity)
|
1208
1185
|
ENUMERATOR(SouthGravity)
|
1209
1186
|
ENUMERATOR(SouthEastGravity)
|
1210
|
-
ENUMERATOR(StaticGravity)
|
1211
1187
|
END_ENUM
|
1212
1188
|
|
1213
1189
|
// ImageType constants
|
@@ -1319,12 +1295,10 @@ Init_RMagick2(void)
|
|
1319
1295
|
DEF_ENUM(PixelInterpolateMethod)
|
1320
1296
|
ENUMERATOR(UndefinedInterpolatePixel)
|
1321
1297
|
ENUMERATOR(AverageInterpolatePixel)
|
1322
|
-
ENUMERATOR(BicubicInterpolatePixel)
|
1323
1298
|
ENUMERATOR(BilinearInterpolatePixel)
|
1324
|
-
ENUMERATOR(FilterInterpolatePixel)
|
1325
1299
|
ENUMERATOR(IntegerInterpolatePixel)
|
1326
1300
|
ENUMERATOR(MeshInterpolatePixel)
|
1327
|
-
|
1301
|
+
ENUMERATORV(NearestInterpolatePixel, NearestNeighborInterpolatePixel)
|
1328
1302
|
ENUMERATOR(SplineInterpolatePixel)
|
1329
1303
|
ENUMERATOR(Average9InterpolatePixel)
|
1330
1304
|
ENUMERATOR(Average16InterpolatePixel)
|
@@ -1392,6 +1366,7 @@ Init_RMagick2(void)
|
|
1392
1366
|
ENUMERATOR(PoissonNoiseQuantumOperator)
|
1393
1367
|
ENUMERATOR(UniformNoiseQuantumOperator)
|
1394
1368
|
ENUMERATOR(CosineQuantumOperator)
|
1369
|
+
ENUMERATOR(SetQuantumOperator)
|
1395
1370
|
ENUMERATOR(SineQuantumOperator)
|
1396
1371
|
ENUMERATOR(AddModulusQuantumOperator)
|
1397
1372
|
ENUMERATOR(MeanQuantumOperator)
|
@@ -1444,7 +1419,6 @@ Init_RMagick2(void)
|
|
1444
1419
|
ENUMERATOR(CharPixel)
|
1445
1420
|
ENUMERATOR(DoublePixel)
|
1446
1421
|
ENUMERATOR(FloatPixel)
|
1447
|
-
ENUMERATOR(IntegerPixel)
|
1448
1422
|
ENUMERATOR(LongPixel)
|
1449
1423
|
ENUMERATOR(QuantumPixel)
|
1450
1424
|
ENUMERATOR(ShortPixel)
|
@@ -1482,7 +1456,6 @@ Init_RMagick2(void)
|
|
1482
1456
|
ENUMERATOR(BackgroundVirtualPixelMethod)
|
1483
1457
|
ENUMERATOR(DitherVirtualPixelMethod)
|
1484
1458
|
ENUMERATOR(RandomVirtualPixelMethod)
|
1485
|
-
ENUMERATOR(ConstantVirtualPixelMethod)
|
1486
1459
|
ENUMERATOR(MaskVirtualPixelMethod)
|
1487
1460
|
ENUMERATOR(BlackVirtualPixelMethod)
|
1488
1461
|
ENUMERATOR(GrayVirtualPixelMethod)
|
data/ext/RMagick/rmpixel.c
CHANGED
@@ -127,26 +127,6 @@ Pixel_alpha(VALUE self)
|
|
127
127
|
return C_int_to_R_int(QuantumRange - pixel->opacity);
|
128
128
|
}
|
129
129
|
|
130
|
-
|
131
|
-
/**
|
132
|
-
* Get Pixel opacity attribute.
|
133
|
-
*
|
134
|
-
* Ruby usage:
|
135
|
-
* - @verbatim Pixel#opacity @endverbatim
|
136
|
-
*
|
137
|
-
* @param self this object
|
138
|
-
* @return the opacity value
|
139
|
-
* @deprecated This method has been deprecated. Please use Pixel_alpha.
|
140
|
-
*/
|
141
|
-
VALUE
|
142
|
-
Pixel_opacity(VALUE self)
|
143
|
-
{
|
144
|
-
Pixel *pixel;
|
145
|
-
rb_warning("Pixel#opacity is deprecated; use Pixel#alpha.");
|
146
|
-
Data_Get_Struct(self, Pixel, pixel);
|
147
|
-
return C_int_to_R_int(pixel->opacity);
|
148
|
-
}
|
149
|
-
|
150
130
|
/**
|
151
131
|
* Set Pixel red attribute.
|
152
132
|
*
|
@@ -226,37 +206,6 @@ Pixel_alpha_eq(VALUE self, VALUE v)
|
|
226
206
|
return QUANTUM2NUM(QuantumRange - pixel->opacity);
|
227
207
|
}
|
228
208
|
|
229
|
-
|
230
|
-
/**
|
231
|
-
* Set Pixel opacity attribute.
|
232
|
-
*
|
233
|
-
* Ruby usage:
|
234
|
-
* - @verbatim Pixel#opacity= @endverbatim
|
235
|
-
*
|
236
|
-
* Notes:
|
237
|
-
* - Pixel is Observable. Setters call changed, notify_observers
|
238
|
-
* - Setters return their argument values for backward compatibility to when
|
239
|
-
* Pixel was a Struct class.
|
240
|
-
*
|
241
|
-
* @param self this object
|
242
|
-
* @param v the opacity value
|
243
|
-
* @return self
|
244
|
-
* @deprecated This method has been deprecated. Please use Pixel_alpha_eq.
|
245
|
-
*/
|
246
|
-
VALUE
|
247
|
-
Pixel_opacity_eq(VALUE self, VALUE v)
|
248
|
-
{
|
249
|
-
Pixel *pixel;
|
250
|
-
|
251
|
-
rb_warning("Pixel#opacity= is deprecated; use Pixel#alpha=.");
|
252
|
-
rb_check_frozen(self);
|
253
|
-
Data_Get_Struct(self, Pixel, pixel);
|
254
|
-
pixel->opacity = APP2QUANTUM(v);
|
255
|
-
(void) rb_funcall(self, rm_ID_changed, 0);
|
256
|
-
(void) rb_funcall(self, rm_ID_notify_observers, 1, self);
|
257
|
-
return QUANTUM2NUM(pixel->opacity);
|
258
|
-
}
|
259
|
-
|
260
209
|
/*
|
261
210
|
* Get/set Pixel CMYK attributes.
|
262
211
|
*/
|
@@ -592,7 +541,6 @@ Pixel_from_color(VALUE class ATTRIBUTE_UNUSED, VALUE name)
|
|
592
541
|
* - 0 <= saturation <= 255 OR "0%" <= saturation <= "100%"
|
593
542
|
* - 0 <= lightness <= 255 OR "0%" <= lightness <= "100%"
|
594
543
|
* - 0 <= alpha <= 1 (0 is transparent, 1 is opaque) OR "0%" <= alpha <= "100%"
|
595
|
-
* - Replaces brain-dead Pixel_from_HSL.
|
596
544
|
*
|
597
545
|
* @param argc number of input arguments
|
598
546
|
* @param argv array of input arguments
|
@@ -663,42 +611,6 @@ Pixel_from_hsla(int argc, VALUE *argv, VALUE class ATTRIBUTE_UNUSED)
|
|
663
611
|
}
|
664
612
|
|
665
613
|
|
666
|
-
/**
|
667
|
-
* Construct an RGB pixel from the array [hue, saturation, luminosity].
|
668
|
-
*
|
669
|
-
* Ruby usage:
|
670
|
-
* - @verbatim Pixel.from_HSL @endverbatim
|
671
|
-
*
|
672
|
-
* @param class the Ruby class to use
|
673
|
-
* @param hsl the array
|
674
|
-
* @return a new Magick::Pixel object
|
675
|
-
* @deprecated This method has been deprecated. Please use Pixel_from_hsla.
|
676
|
-
*/
|
677
|
-
VALUE
|
678
|
-
Pixel_from_HSL(VALUE class ATTRIBUTE_UNUSED, VALUE hsl)
|
679
|
-
{
|
680
|
-
PixelColor rgb;
|
681
|
-
double hue, saturation, luminosity;
|
682
|
-
|
683
|
-
memset(&rgb, 0, sizeof(rgb));
|
684
|
-
|
685
|
-
hsl = rb_Array(hsl); // Ensure array
|
686
|
-
if (RARRAY_LEN(hsl) < 3)
|
687
|
-
{
|
688
|
-
rb_raise(rb_eArgError, "array argument must have at least 3 elements");
|
689
|
-
}
|
690
|
-
|
691
|
-
hue = NUM2DBL(rb_ary_entry(hsl, 0));
|
692
|
-
saturation = NUM2DBL(rb_ary_entry(hsl, 1));
|
693
|
-
luminosity = NUM2DBL(rb_ary_entry(hsl, 2));
|
694
|
-
|
695
|
-
rb_warning("Pixel#from_HSL is deprecated; use from_hsla");
|
696
|
-
ConvertHSLToRGB(hue, saturation, luminosity,
|
697
|
-
&rgb.red, &rgb.green, &rgb.blue);
|
698
|
-
return Pixel_from_PixelColor(&rgb);
|
699
|
-
}
|
700
|
-
|
701
|
-
|
702
614
|
/**
|
703
615
|
* Create a Magick::Pixel object from a MagickPixel structure.
|
704
616
|
*
|
@@ -799,7 +711,7 @@ Pixel_hash(VALUE self)
|
|
799
711
|
hash = ScaleQuantumToChar(pixel->red) << 24;
|
800
712
|
hash += ScaleQuantumToChar(pixel->green) << 16;
|
801
713
|
hash += ScaleQuantumToChar(pixel->blue) << 8;
|
802
|
-
hash += ScaleQuantumToChar(pixel->opacity);
|
714
|
+
hash += ScaleQuantumToChar(QuantumRange - pixel->opacity);
|
803
715
|
|
804
716
|
return UINT2NUM(hash >> 1);
|
805
717
|
}
|
@@ -999,7 +911,7 @@ Pixel_spaceship(VALUE self, VALUE other)
|
|
999
911
|
}
|
1000
912
|
else if(this->opacity != that->opacity)
|
1001
913
|
{
|
1002
|
-
return INT2NUM((this->opacity - that->opacity)/abs(this->opacity - that->opacity));
|
914
|
+
return INT2NUM(((QuantumRange - this->opacity) - (QuantumRange - that->opacity))/abs((QuantumRange - this->opacity) - (QuantumRange - that->opacity)));
|
1003
915
|
}
|
1004
916
|
|
1005
917
|
// Values are equal, check class.
|
@@ -1017,9 +929,6 @@ Pixel_spaceship(VALUE self, VALUE other)
|
|
1017
929
|
* Ruby usage:
|
1018
930
|
* - @verbatim Pixel#to_hsla @endverbatim
|
1019
931
|
*
|
1020
|
-
* Notes:
|
1021
|
-
* - Replace brain-dead Pixel_to_HSL.
|
1022
|
-
*
|
1023
932
|
* @param self this object
|
1024
933
|
* @return an array with hsla data
|
1025
934
|
* @see Pixel_from_hsla
|
@@ -1058,36 +967,6 @@ Pixel_to_hsla(VALUE self)
|
|
1058
967
|
return hsla;
|
1059
968
|
}
|
1060
969
|
|
1061
|
-
/**
|
1062
|
-
* Convert an RGB pixel to the array [hue, saturation, luminosity].
|
1063
|
-
*
|
1064
|
-
* Ruby usage:
|
1065
|
-
* - @verbatim Pixel#to_HSL @endverbatim
|
1066
|
-
*
|
1067
|
-
* @param self this object
|
1068
|
-
* @return an array with hsl data
|
1069
|
-
* @deprecated This method has been deprecated. Please use Pixel_to_hsla.
|
1070
|
-
*/
|
1071
|
-
VALUE
|
1072
|
-
Pixel_to_HSL(VALUE self)
|
1073
|
-
{
|
1074
|
-
Pixel *pixel;
|
1075
|
-
double hue, saturation, luminosity;
|
1076
|
-
VALUE hsl;
|
1077
|
-
|
1078
|
-
Data_Get_Struct(self, Pixel, pixel);
|
1079
|
-
|
1080
|
-
rb_warning("Pixel#to_HSL is deprecated; use to_hsla");
|
1081
|
-
ConvertRGBToHSL(pixel->red, pixel->green, pixel->blue, &hue, &saturation, &luminosity);
|
1082
|
-
|
1083
|
-
hsl = rb_ary_new3(3, rb_float_new(hue), rb_float_new(saturation),
|
1084
|
-
rb_float_new(luminosity));
|
1085
|
-
|
1086
|
-
RB_GC_GUARD(hsl);
|
1087
|
-
|
1088
|
-
return hsl;
|
1089
|
-
}
|
1090
|
-
|
1091
970
|
|
1092
971
|
/**
|
1093
972
|
* Convert a Pixel to a MagickPixel.
|
@@ -1239,8 +1118,9 @@ Pixel_to_s(VALUE self)
|
|
1239
1118
|
char buff[100];
|
1240
1119
|
|
1241
1120
|
Data_Get_Struct(self, Pixel, pixel);
|
1242
|
-
sprintf(buff, "red=" QuantumFormat ", green=" QuantumFormat ", blue=" QuantumFormat ",
|
1243
|
-
|
1121
|
+
sprintf(buff, "red=" QuantumFormat ", green=" QuantumFormat ", blue=" QuantumFormat ", alpha=" QuantumFormat,
|
1122
|
+
pixel->red, pixel->green, pixel->blue,
|
1123
|
+
(QuantumRange - pixel->opacity));
|
1244
1124
|
return rb_str_new2(buff);
|
1245
1125
|
}
|
1246
1126
|
|