-
Notifications
You must be signed in to change notification settings - Fork 140
/
struct.html
1308 lines (951 loc) · 36.3 KB
/
struct.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
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
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
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
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
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
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
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
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
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
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
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
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
<title>RMagick 0.0.0: Miscellaneous classes</title>
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii" />
<meta name="GENERATOR" content="Quanta Plus" />
<meta name="Copyright" content=
"Copyright (C) 2006 by Timothy P. Hunter" />
<link rel="stylesheet" type="text/css" href="css/doc.css" />
<link rel="stylesheet" type="text/css" href="css/ref.css" />
<script type="text/javascript" src="scripts/doc.js">
</script>
<style type="text/css">
/*<![CDATA[*/
/* Styles local to this page. */
/*]]>*/
</style>
</head>
<body>
<h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
<div class="nav">
« <a href="draw.html">Prev</a> | <a href=
"index.html">Contents</a> | <a href=
"info.html">Next</a> »
</div>
<h1>Miscellaneous classes</h1>
<div id="toc">
<h2>Table of Contents</h2>
<h3><a href="#view">The Image::View class</a></h3>
<ul>
<li><a href="#view">Image::View</a></li>
</ul>
<h3><a href="#Geometry">The Geometry class</a></h3>
<ul>
<li><a href="#Geometry">Geometry</a></li>
</ul>
<h3><a href="#Pixel">The Pixel class</a></h3>
<ul>
<li><a href="#Pixel">Pixel</a></li>
</ul>
<h3><a href="#struct">Struct classes</a></h3>
<ul>
<li><a href="#AffineMatrix">AffineMatrix</a></li>
<li><a href="#Chromaticity">Chromaticity</a></li>
<li><a href="#Pixel">Pixel</a></li>
<li><a href="#Point">Point</a></li>
<li><a href="#Primary">Primary</a></li>
<li><a href="#Rectangle">Rectangle</a></li>
<li><a href="#Segment">Segment</a></li>
</ul>
<h3><a href="#fill">Fill classes</a></h3>
<ul>
<li><a href="#GradientFill">GradientFill</a></li>
<li><a href="#HatchFill">HatchFill</a></li>
<li><a href="#TextureFill">TextureFill</a></li>
</ul>
<h3><a href="#exception">Exception classes</a></h3>
<ul>
<li><a href="#MagickError">ImageMagickError</a></li>
<li><a href=
"#DestroyedImageError">DestroyedImageError</a></li>
</ul>
</div>
<div class="subhd">
<h2 id="view">The Image::View class</h2>
<div class="intro">
<h3>Introduction</h3>
<p>A view is a rectangle in an image. Within the view pixels
can be addressed by specifying their <code>[i][j]</code>
coordinates. The <span class="arg">i</span>, <span class=
"arg">j</span> index values can identify a single pixel or
multiple pixels. Pixels can be accessed or modified
individually or collectively. Pixel <em>channels</em> (that
is, the red, green, blue, and opacity components) can be
accessed or modified individually or collectively. The
<a href="#view_sync">sync</a> method stores modified pixels
back into the image.</p>
</div>
<h3>class Image::View <span class="superclass"><
Object</span></h3>
<div class="sig">
<h4>new</h4>
<p>Image::View.new(<span class="arg">img</span>, <span class=
"arg">x</span>, <span class="arg">y</span>, <span class=
"arg">width</span>, <span class="arg">height</span>) ->
<em>view</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>The easiest way to use an <code>Image::View</code> object
is to create it with the <a href=
"image3.html#view">Image#view</a> method, which provides a
block-scoped view and automatic syncing. You probably won't
want to create a view by calling <code>new</code>.</p>
<h5>Arguments</h5>
<dl>
<dt>img</dt>
<dd>The image from which the view is taken.</dd>
<dt>x, y</dt>
<dd>The x- and y-offsets of the view relative to the
top-left corner of the image. Within the view, pixel
addresses are relative to the top-left corner of the
view.</dd>
<dt>width, height</dt>
<dd>The number of columns and the number of rows in the
view.</dd>
</dl>
<p>It is an error to specify a view that exceeds the
boundaries of the image.</p>
</div>
<div class="sig">
<h4>[][]</h4>
<p><span class="arg">view</span>[<span class=
"arg">i</span>][<span class="arg">j</span>] ->
<em>pixel</em> or <em>array</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Return one or more pixels in the view. If i and j are each
a single integer value, returns a single pixel. For any other
indexes, returns an array of one or more pixels. If any index
exceeds the boundaries of the view, raises
<code>IndexError</code>.</p>
<h5>Arguments</h5>
<p>The <span class="arg">i</span> index identifies a set of
rows in the view. The <span class="arg">j</span> index
identifies a set of columns in the view. The pixels that are
returned are the intersection of these two sets. The indexes
can be:</p>
<dl>
<dt>omitted</dt>
<dd>If <span class="arg">i</span> is omitted, all the rows
are used. If <code>j</code> is omitted, all the columns are
used.</dd>
<dt>an integer</dt>
<dd>or an object that can be converted to an integer. A
single integer identifies a single row or column. Identify
a single pixel by specifying integers for both indexes. If
the index is negative, counts from the bottom row or right
column of the view.</dd>
<dt>start, length</dt>
<dd>Identifies the set of <code>length</code> rows or
columns starting with <code>start</code>. If
<code>start</code> is negative, starts at the bottom row or
right column of the view.</dd>
<dt>an object that responds to <code>each</code></dt>
<dd>The index may be any object that responds to
<code>each</code> by returning a sequence of objects that
can be converted to integers. An array with integer values
or a range of integers are two examples.</dd>
</dl>
<h5>Examples</h5>
<pre>
# Get the 2nd pixel in the 4th row of the view.
pixel = view[3][1] # returns a pixel
# Returns an array with only one value
pixels = view[[3]][[1]]
# Get all the pixels in the 4th row
pixels = view[3][]
# Use arrays to specify a non-contiguous set of rows and columns
pixels = view[[1,3,5]][[2,4,6]]
# Use ranges to specify a contiguous set of rows and columns
pixels = view[1..5][2..6]
</pre>
</div>
<div class="sig">
<h4>[][].red<br />
[][].green<br />
[][].blue<br />
[][].opacity</h4>
<p>[<span class="arg">i</span>][<span class=
"arg">j</span>].red -> <em>integer</em> or
<em>array</em><br />
[<span class="arg">i</span>][<span class=
"arg">j</span>].green -> <em>integer</em> or
<em>array</em><br />
[<span class="arg">i</span>][<span class="arg">j</span>].blue
-> <em>integer</em> or <em>array</em><br />
[<span class="arg">i</span>][<span class=
"arg">j</span>].opacity -> <em>integer</em> or
<em>array</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>If the indexes identify a single pixel, these methods
return the value of the red, green, blue, or opacity channel
of that pixel. If the indexes identify more than one pixel,
these methods return an array of values. See
<code>[][]</code> for a description of possible index
arguments.</p>
<h5>Examples</h5>
<pre>
# Get the value of the green channel of
# the top-left pixel in the view.
view[0][0] = Pixel(0,128,255)
g = view[0][0].green # returns 128
# Get the maximum value of the red channel
# for all the pixels in the top row of the view.
m = view[0][].red.max
</pre>
</div>
<div class="sig">
<h4>[][]=</h4>
<p><span class="arg">view</span>[<span class=
"arg">i</span>][<span class="arg">j</span>] =
<em>rvalue</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Replaces each pixel identified by the indexes with a
duplicate of <span class="arg">rvalue</span>. The rvalue is
either a <a href="#Pixel">Pixel</a> object or a <a href=
"imusage.html#color_name">color name</a>. If
<code>rvalue</code> is a color name, calls
<code>Pixel.from_color</code> to create a pixel.</p>
<h5>Arguments</h5>
<p>The indexes are the same as <code>[][]</code>, above.</p>
<dl>
<dt>rvalue</dt>
<dd>Either a pixel or a color name.</dd>
</dl>
</div>
<div class="sig">
<h4>[][].red=<br />
[][].green=<br />
[][].blue=<br />
[][].opacity=</h4>
<p>[<span class="arg">i</span>][<span class=
"arg">j</span>].red = <em>integer</em><br />
[<span class="arg">i</span>][<span class=
"arg">j</span>].green = <em>integer</em><br />
[<span class="arg">i</span>][<span class="arg">j</span>].blue
= <em>integer</em><br />
[<span class="arg">i</span>][<span class=
"arg">j</span>].opacity = <em>integer</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Assigns <em>integer</em> to the red, green, blue, or
opacity channel of the pixel or pixels identified by the
indexes.</p>
<h5>Examples</h5>
<pre>
# Set the red channel of all the pixels in the 2nd
# row of the view to QuantumRange
view[1][].red = QuantumRange
# Set the green channel of the pixel at [20][30] to
# half that of its left-hand neighbor.
view[20][30].green = view[20][29].green * 0.5
</pre>
</div>
<div id="view_sync" class="sig">
<h4>sync</h4>
<p><span class="arg">view</span>.sync(<span class=
"arg">force</span>=<code>false</code>) ->
<code>true</code> or <code>false</code></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>If any of the pixels in the view have been modified, this
method stores them in the image. If no pixels have been
modified, this method has no effect.</p>
<h5>Arguments</h5>
<dl>
<dt>force</dt>
<dd>If <code>true</code>, forces the view pixels to be
stored in the image even if none have been modified.</dd>
</dl>
<h5>Returns</h5>Returns <code>true</code> if the pixels were
stored in the image either because the <code>dirty</code>
flag was <code>true</code> or <code>force</code> was
<code>true</code>, <code>false</code> otherwise.
</div>
<div class="sig">
<h4>dirty<br />
dirty=</h4>
<p>view.dirty -> <code>true</code> or
<code>false</code><br />
view.dirty = <code>true</code> or <code>false</code></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Any modification to a pixel in the view causes the
<code>dirty</code> attribute to be set to <code>true</code>.
You can (although normally you don't need to) set
<code>dirty=true</code> to force <code>sync</code> to store
the pixels in the image, or set <code>dirty=false</code> to
keep <code>sync</code> from storing the pixels.</p>
</div>
<div class="sig">
<h4>x<br />
y<br />
width<br />
height</h4>
<p>x -> integer<br />
y -> integer<br />
width -> integer<br />
height -> integer</p>
</div>
<div class="desc">
<h5>Description</h5>
<p>The <span class="arg">x</span>, <span class=
"arg">y</span>, <span class="arg">width</span>, and
<span class="arg">height</span> arguments specified when the
view was created.</p>
</div>
</div>
<div class="subhd" id="Geometry">
<h2>The Geometry class</h2>
<div class="intro">
<h3>Introduction</h3>
<p>The Geometry class contains the same information as an
ImageMagick <a href="imusage.html#geometry">geometry
string</a>. Geometry objects are interchangeable with
geometry strings.</p>
</div>
<h3>class Geometry <span class="superclass"><
Object</span></h3>
<div class="sig">
<h4>new</h4>
<p>Geometry.new(<span class="arg">width</span>=nil,
<span class="arg">height</span>=nil, <span class=
"arg">x</span>=nil, <span class="arg">y</span>=nil,
<span class="arg">flag</span>=nil) ->
<em>geometry</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Constructs a new <code>Geometry</code> object.</p>
<h5>Attributes</h5>
<p>A geometry string has the general form
"WxH+x+y[!@%<>]. In a <code>Geometry</code> object,</p>
<dl>
<dt>width</dt>
<dd>specifies the W value</dd>
<dt>height</dt>
<dd>specifies the H value</dd>
<dt>x, y</dt>
<dd>specify the x and y values, respectively</dd>
<dt>flag</dt>
<dd>one of the constants shown in this table:</dd>
</dl>
<table summary="geometry flag constants" class=
"simple_table">
<caption>
<strong>Geometry flag constants</strong>
</caption>
<tr>
<td align="center"><strong>Constant<br />
name</strong></td>
<td align="center"><strong>Geometry<br />
string flag</strong></td>
<td align="center"><strong>Explanation</strong></td>
</tr>
<tr>
<td>PercentGeometry</td>
<td align="center">%</td>
<td>Normally the attributes are treated as pixels. Use
this flag when the <code>width</code> and
<code>height</code> attributes represent
<em>percentages</em>. For example, 125x75 means 125% of
the height and 75% of the width. The <code>x</code> and
<code>y</code> attributes are not affected by this
flag.</td>
</tr>
<tr>
<td>AspectGeometry</td>
<td align="center">!</td>
<td>Use this flag when you want to force the new image to
have exactly the size specified by the the
<code>width</code> and <code>height</code>
attributes.</td>
</tr>
<tr>
<td>LessGeometry</td>
<td align="center"><</td>
<td>Use this flag when you want to change the size of the
image only if both its width and height are smaller the
values specified by those attributes. The image size is
changed proportionally.</td>
</tr>
<tr>
<td>GreaterGeometry</td>
<td align="center">></td>
<td>Use this flag when you want to change the size of the
image if either its width and height exceed the values
specified by those attributes. The image size is changed
proportionally.</td>
</tr>
<tr>
<td>AreaGeometry</td>
<td align="center">@</td>
<td>This flag is useful only with a single
<code>width</code> attribute. When present, it means the
<code>width</code> attribute represents the total area of
the image in pixels.</td>
</tr>
</table>
<p>If any attribute is omitted the default is nil or 0.</p>
<h5>Example</h5>
<pre>
g = Magick::Geometry.new(100,200,nil,nil,Magick::AspectGeometry)
</pre>
</div>
</div>
<div class="sig">
<h4>from_s</h4>
<p>Geometry.<span class="arg">from_s</span>(<span class=
"arg">string</span>) -> <em>geometry</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Constructs a new <code>Geometry</code> object from a
<a href="imusage.html#geometry">geometry string</a>.</p>
</div>
<div class="sig">
<h4>to_s</h4>
<p><span class="arg">geom.</span>to_s() ->
<em>string</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Returns the string equivalent of the <code>Geometry</code>
object..</p>
</div>
<div class="subhd" id="Pixel">
<h2>The Pixel class</h2>
<div class="intro">
<h3>Introduction</h3>
<p>A pixel describes the smallest individually addressable
part of an image. In the RGB <a href=
"constants.html#ColorspaceType">colorspace</a>, a pixel's
color is described by its intensity in the red, green, and
blue channels. Its opacity is described by its intensity in
the opacity (also called alpha, or matte) channel. In the
CMYK colorspace a pixel's color is described by its intensity
in the cyan, magenta, yellow and black (K) channels.
Intensity is a value between 0 and <a href=
"constants.html#QuantumRange">QuantumRange</a>.</p>
<p>Usually, RMagick methods operate on entire images or on
groups of pixels that have been selected by their position or
color. Some methods, such as <a href=
"image2.html#pixel_color">pixel_color</a> and <a href=
"image3.html#view">view</a>, operate on individual pixels or
even on the RGBA (or CMYK) components thereof.</p>
</div>
<h3>class Pixel <span class="superclass"><
Object</span><br />
<span class="mixin">mixes in Comparable, Observable</span></h3>
<div class="sig">
<h4>new</h4>
<p>Pixel.new(<span class="arg">red</span>, <span class=
"arg">green</span>, <span class="arg">blue</span>,
<span class="arg">opacity</span>) -> <em>pixel</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Constructs a pixel object from the specified red, green,
blue, and opacity intensities. The intensity is a number
between 0 and <a href=
"constants.html#Miscellaneous_constants">QuantumRange</a>.</p>
<h5>Attributes</h5>
<dl>
<dt>red, green, blue</dt>
<dd>The red, green, and blue intensities of the pixel,
respectively. If the colorspace is <a href=
"constants.html#ColorspaceType">CMYKColorspace</a>, these
attributes are interpreted as the cyan, magenta, and yellow
intensities.</dd>
<dt>opacity</dt>
<dd>The opacity level. Higher intensities are more
transparent. If the colorspace is CMYKColorspace, this
attribute is interpreted as the black intensity.</dd>
<dt>cyan, magenta, yellow, black</dt>
<dd>These attributes are aliases for <code>red</code>,
<code>green</code>, <code>blue</code>, and
<code>opacity</code>, respectively.</dd>
</dl>
</div>
<div class="sig">
<h4>from_color</h4>
<p>Pixel.from_color(<span class="arg">color_name</span>)
-> <em>pixel</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Constructs a new Pixel object from the <a href=
"imusage.html#color_names">color name</a>. Raises
ArgumentError if the name is unknown.</p>
</div>
<div class="sig">
<h4 id="from_hsla">from_hsla</h4>
<p>Pixel.from_hsla(<span class="arg">hue</span>, <span class=
"arg">saturation</span>, <span class="arg">lightness</span>,
<span class="arg">alpha</span>=1.0) -> <em>pixel</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Constructs a pixel object from the specified
arguments.</p>
<h5>Arguments</h5>
<dl>
<dt>hue</dt>
<dd>A value in the range [0.0, 360.0).</dd>
<dt>saturation</dt>
<dd>A value in the range [0.0, 100.0].</dd>
<dt>lightness</dt>
<dd>A value in the range 0.0, 100.0].</dd>
<dt>alpha</dt>
<dd>A value in the range [0.0, 1.0], where 1.0 is fully
opaque and 0.0 is fully transparent. This argument may be
omitted. The default is 1.0.</dd>
</dl>
<h5>See also</h5>
<p><a href="#to_hsla">to_hsla</a></p>
</div>
<div class="sig">
<h4 id="spaceship"><=></h4>
<p><span class="arg">pixel1</span> <=> <span class=
"arg">pixel2</span> -> -1, 0, <em>or</em> 1</p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Returns -1, 0, or 1 depending on if <span class=
"arg">pixel1</span> is "less than," equal, or "greater than"
the <span class="arg">pixel2</span>.</p>
<p>Since there is no way to rank order pixels, and thus
determine if one pixel is "greater than" or "less than"
another, this method uses an arbitrary algorithm that ensures
these two conditions:</p>
<ol>
<li>pixels with equal RGBA (or CMYK) values compare equal,
and</li>
<li>comparing the same two unequal pixels always returns
the same result.</li>
</ol>
<h5>Returns</h5>
<p>-1, 0, or 1</p>
<h5>See also</h5>
<p><a href="#fcmp">fcmp</a></p>
</div>
<div class="sig">
<h4 id="fcmp">fcmp</h4>
<p><span class="arg">pixel</span>.fcmp(<span class=
"arg">pixel</span>, <span class="arg">fuzz</span>=0.0,
<span class="arg">colorspace</span>=RGBColorspace) ->
<code>true</code> <em>or</em> <code>false</code></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Returns true if the argument is the same color as
<span class="arg">pixel</span>.</p>
<h5>Arguments</h5>
<dl>
<dt>pixel</dt>
<dd>The pixel to which the receiver is compared.</dd>
<dt>fuzz</dt>
<dd>The amount of fuzz to allow before the colors are
considered to be different.</dd>
<dt>colorspace</dt>
<dd>If the pixels are in the CMYK colorspace, specify
<a href=
"constants.html#ColorspaceType">Magick::CMYKColorspace</a>.</dd>
</dl>
<h5>Returns</h5>
<p><code>true</code> or <code>false</code></p>
<h5>See also</h5>
<p><a href="#spaceship"><=></a></p>
</div>
<div class="sig">
<h4>intensity</h4>
<p><span class="arg">pixel</span>.intensity() ->
integer</p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Returns the intensity of the pixel. The intensity is
computed as 0.299*R+0.587*G+0.114*B.</p>
</div>
<div class="sig">
<h4>to_color</h4>
<p><span class="arg">pixel</span>.to_color(<span class=
"arg">compliance</span>=AllCompliance, <span class=
"arg">matte</span>=<code>false</code>, <span class=
"arg">depth</span>=<code>QuantumDepth</code>, <span class=
"arg">hex</span>=<code>false</code>) ->
<em>string</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Returns the <a href="imusage.html#color_names">color
name</a> corresponding the the pixel values. If there is no
such named color in the specified color standard, returns a
string in the form "rgb(r,g,b,a)".</p>
<h5>Arguments</h5>
<dl>
<dt>compliance</dt>
<dd>A <a href=
"constants.html#ComplianceType">ComplianceType</a>
constant. The default value of AllCompliance causes
<code>to_color</code> to search for a color name in any of
the 3 defined color standards.</dd>
<dt>matte</dt>
<dd>If false, the pixel's opacity attribute is
ignored.</dd>
<dt>depth</dt>
<dd>An image depth. The default is the quantum depth used
when ImageMagick was compiled. The values 16 and 32 can be
used only when ImageMagick was compiled with the
appropriate QuantumDepth.</dd>
<dt>hex</dt>
<dd>If true, represent the color name in hex (#rrggbbaa or
#rrrrggggbbbbaaaa) format. In this case <span class=
"arg">compliance</span> is meaningless.</dd>
</dl>
<h5>See also</h5>
<p>Compare this method to <a href=
"image3.html#to_color">Image#to_color</a>, in which the
<span class="arg">matte</span> and <span class=
"arg">depth</span> values are taken from an image.</p>
</div>
<div class="sig">
<h4 id="to_hsla">to_hsla</h4>
<p><span class="arg">pixel</span>.to_HSL ->
<em>array</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Converts the RGB representation of the pixel to hue,
saturation, lightness, and alpha values.</p>
<h5>Returns</h5>
<p>An array of the form <code>[hue, saturation, lightness,
alpha]</code>. Each value is in the range specified for it,
as described in <a href="#from_hsla">from_hsla</a>,
above.</p>
</div>
</div>
<div class="subhd">
<h2 id="struct">Struct classes</h2>
<div class="intro">
<h3>Introduction</h3>
<p>These classes are created by the Struct class and are used
to create objects used as attribute and argument values in
other RMagick classes. Like all the classes created by
Struct, these classes define both getter and setter methods
for their attributes. That is, for an attribute <em>x</em>
both the <code>x</code> and <code>x=</code> methods are
defined.</p>
<p>The <code>Pixel</code> and <code>Geometry</code> classes
define additional constructors and conversion methods.</p>
</div>
<h3 id="AffineMatrix">class AffineMatrix <span class=
"superclass">< Struct</span></h3>
<div class="sig">
<h4>new</h4>
<p>AffineMatrix.new(<span class="arg">sx</span>, <span class=
"arg">rx</span>, <span class="arg">ry</span>, <span class=
"arg">sy</span>, <span class="arg">tx</span>, <span class=
"arg">ty</span>) -> <em>matrix</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>An AffineMatrix object describes a coordinate
transformation. This object is used as an argument to the
<a href=
"image1.html#affine_transform">Image#affine_transform</a>,
<a href=
"image1.html#composite_affine">Image#composite_affine</a>,
and <a href="draw.html#affine_eq">Draw#affine</a>
methods.</p>
<h5>Attributes</h5>
<dl>
<dt>sx, sy</dt>
<dd>The amount of scaling on the x- and y- axes.</dd>
<dt>rx, ry</dt>
<dd>The amount of rotation on the x- and y-axes, in
radians.</dd>
<dt>tx, ty</dt>
<dd>The amount of translation on the x- and y-axes, in
pixels.</dd>
</dl>
</div>
<h3 id="Chromaticity">class Chromaticity <span class=
"superclass">< Struct</span></h3>
<div class="sig">
<h4>new</h4>
<p>Chromaticity.new(<span class="arg">red_primary</span>,
<span class="arg">green_primary</span>, <span class=
"arg">blue_primary</span>, <span class=
"arg">white_point</span>) -> <em>chromaticity</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>A Chromaticity object represents chromaticity values for
the <a href=
"imageattrs.html#chromaticity">Image#chromaticity</a>
attribute.</p>
<h5>Attributes</h5>
<p>The attribute values are <a href="#Primary">Primary</a>
objects.</p>
<dl>
<dt>red_primary</dt>
<dd>Red primary point (e.g. red_primary.x=0.64,
red_primary.y=0.33)</dd>
<dt>green_primary</dt>
<dd>Green primary point (e.g. green_primary.x=0.3,
green_primary.y=0.6)</dd>
<dt>blue_primary</dt>
<dd>Blue primary point (e.g. blue_primary.x=0.15,
blue_primary.y=0.06)</dd>
<dt>white_point</dt>
<dd>White point (e.g. white_point.x=0.3127,
white_point.y=0.329)</dd>
</dl>
</div>
<h3 id="Point">class Point <span class="superclass"><
Struct</span></h3>
<div class="sig">
<h4>new</h4>
<p>Point.new(<span class="arg">x</span>, <span class=
"arg">y</span>) -> <em>point</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>The value of the <code>pixels_per_em</code> attribute in
the TypeMetric struct returned by <a href=
"draw.html#get_type_metrics">Draw#get_type_metrics</a> is a
<code>Point</code> object..</p>
<h5>Attributes</h5>