File: struct.html

package info (click to toggle)
librmagick-ruby 1.13.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,700 kB
  • ctags: 1,466
  • sloc: ansic: 13,688; ruby: 8,953; makefile: 40; sh: 32
file content (1278 lines) | stat: -rw-r--r-- 36,619 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
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
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
<!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 1st March 2005), see www.w3.org" />

  <title>RMagick: 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 User's Guide and Reference</h6>

  <div class="nav">
    &laquo;&nbsp;<a href="draw.html">Prev</a> | <a href=
    "index.html">Contents</a> | <a href=
    "info.html">Next</a>&nbsp;&raquo;
  </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>
    </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">&lt;
    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>) -&gt;
      aView</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 sync'ing. 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>] -&gt;
      <em>aPixel</em> or <em>anArray</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 contigous 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 -&gt; <em>anInteger</em> or
      <em>anArray</em><br />
      [<span class="arg">i</span>][<span class=
      "arg">j</span>].green -&gt; <em>anInteger</em> or
      <em>anArray</em><br />
      [<span class="arg">i</span>][<span class="arg">j</span>].blue
      -&gt; <em>anInteger</em> or <em>anArray</em><br />
      [<span class="arg">i</span>][<span class=
      "arg">j</span>].opacity -&gt; <em>anInteger</em> or
      <em>anArray</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>
      -&gt; <code>nil</code></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>anInteger</em> -&gt;
      <code>nil</code><br />
      [<span class="arg">i</span>][<span class=
      "arg">j</span>].green = <em>anInteger</em> -&gt;
      <code>nil</code><br />
      [<span class="arg">i</span>][<span class="arg">j</span>].blue
      = <em>anInteger</em> -&gt; <code>nil</code><br />
      [<span class="arg">i</span>][<span class=
      "arg">j</span>].opacity = <em>anInteger</em> -&gt;
      <code>nil</code></p>
    </div>

    <div class="desc">
      <h5>Description</h5>

      <p>Assigns <em>anInteger</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 MaxRGB
  view[1][].red = MaxRGB
  # 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>) -&gt;
      <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 -&gt; <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 -&gt; anInteger<br />
      y -&gt; anInteger<br />
      width -&gt; anInteger<br />
      height -&gt; anInteger</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
      &times;Magick <a href="imusage.html#geometry">geometry
      string</a>. Geometry objects are interchangable with geometry
      strings.</p>
    </div>

    <h3>class Geometry <span class="superclass">&lt;
    Object</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>Geometry.<span class="arg">new</span>(<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) -&gt;
      <em>aGeometry</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[!@%&lt;&gt;]. 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">&lt;</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">&gt;</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>) -&gt; <em>aGeometry</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">geometry.</span>to_s() -&gt;
    <em>aString</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 RBG <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#MaxRGB">MaxRGB</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">&lt;
    Object</span><br />
    <span class="mixin">mixes in Comparable, Observable</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>Pixel.<span class="arg">new</span>(<span class=
      "arg">red</span>, <span class="arg">green</span>,
      <span class="arg">blue</span>, <span class=
      "arg">opacity</span>) -&gt; <em>aPixel</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">MaxRGB</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.<span class="arg">from_color</span>(<span class=
      "arg">color_name</span>) -&gt; <em>aPixel</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>from_HSL</h4>

      <p>Pixel.<span class="arg">from_HSL</span>(<span class=
      "arg">[hue, saturation, luminosity]</span>) -&gt;
      <em>aPixel</em></p>
    </div>

    <div class="desc">
      <h5>Description</h5>

      <p>Constructs a pixel object from the specified array of 3
      values: hue, saturation, and luminosity.</p>
    </div>

    <div class="sig">
      <h4 id="spaceship">&lt;=&gt;</h4>

      <p><span class="arg">pixel1</span> &lt;=&gt; <span class=
      "arg">pixel2</span> -&gt; -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">aPixel</span>, <span class="arg">fuzz</span>=0.0,
      <span class="arg">colorspace</span>=RGBColorspace) -&gt;
      <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">&lt;=&gt;</a></p>
    </div>

    <div class="sig">
      <h4>intensity</h4>

      <p><span class="arg">pixel</span>.intensity() -&gt;
      anInteger</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>) -&gt;
      <em>aString</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 "#RRGGBBOO" or, if the depth is 16,
      "#RRRRGGGGBBBBOOOO".</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 &times;Magick was compiled. The values 16 and 32 can
        be used only when &times;Magick was compiled with the
        appropriate QuantumDepth.</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>to_HSL</h4>

      <p><span class="arg">pixel</span>.to_HSL -&gt;
      <em>anArray</em></p>
    </div>

    <div class="desc">
      <h5>Description</h5>

      <p>Converts the RGB representation of the pixel to hue,
      saturation, and luminosity values.</p>

      <h5>Returns</h5>

      <p>An array of the form <code>[hue, saturation,
      luminosity]</code>.</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">&lt; Struct</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>AffineMatrix.<span class="arg">new</span>(<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>) -&gt;
      <em>anAffineMatrix</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">&lt; Struct</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>Chromaticity.<span class="arg">new</span>(<span class=
      "arg">red_primary</span>, <span class=
      "arg">green_primary</span>, <span class=
      "arg">blue_primary</span>, <span class=
      "arg">white_point</span>) -&gt; <em>aChromaticity</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">&lt;
    Struct</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>Point.new(<span class="arg">x</span>, <span class=
      "arg">y</span>) -&gt; <em>aPoint</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>

      <dl>
        <dt>x</dt>

        <dd>Character width</dd>

        <dt>y</dt>

        <dd>Character height</dd>
      </dl>
    </div>

    <h3 id="Primary">class Primary <span class="superclass">&lt;
    Struct</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>Primary.new(<span class="arg">x</span>, <span class=
      "arg">y</span>, <span class="arg">z</span>) -&gt;
      <em>aPrimary</em></p>
    </div>

    <div class="desc">
      <h5>Description</h5>

      <p>See <a href="#Chromaticity">class Chromaticity</a>.</p>

      <h5>Attributes</h5>

      <dl>
        <dt>x</dt>

        <dd>X ordinate</dd>

        <dt>y</dt>

        <dd>Y ordinate</dd>

        <dt>z</dt>

        <dd>Z ordinate. This attribute is always ignored.</dd>
      </dl>
    </div>

    <h3 id="Rectangle">class Rectangle <span class=
    "superclass">&lt; Struct</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>Rectangle.new(<span class="arg">width</span>, <span class=
      "arg">height</span>, <span class="arg">x</span>, <span class=
      "arg">y</span>) -&gt; <em>aRectangle</em></p>
    </div>

    <div class="desc">
      <h5>Description</h5>

      <p>The value of the <a href=
      "imageattrs.html#tile_info">Image#tile_info</a> and <a href=
      "imageattrs.html#bounding_box">Image#bounding_box</a>
      attributes.</p>

      <h5>Attributes</h5>

      <dl>
        <dt>width</dt>

        <dd>Rectangle width</dd>

        <dt>height</dt>

        <dd>Rectangle height</dd>

        <dt>x</dt>

        <dd>Offset from the left edge of the image</dd>

        <dt>y</dt>

        <dd>Offset from the top edge of the image</dd>
      </dl>
    </div>

    <h3 id="Segment">class Segment <span class="superclass">&lt;
    Struct</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>Segment.new(<span class="arg">x1</span>, <span class=
      "arg">y1</span>, <span class="arg">x2</span>, <span class=
      "arg">y2</span>) -&gt; <em>aSegment</em></p>
    </div>

    <div class="desc">
      <h5>Description</h5>

      <p>The value of the <code>bounds</code> attribute in the
      <a href="draw.html#get_type_metrics">TypeMetric</a>
      class.</p>

      <h5>Attributes</h5>

      <p><em>x1</em>, <em>y1</em>, <em>x2</em>, <em>y2</em></p>
    </div>
  </div>

  <div class="subhd">
    <h2 id="fill">Fill classes</h2>

    <div class="intro">
      <h3>Introduction</h3>

      <p>The <a href="image.html#new">Image#new</a> and <a href=
      "ilist.html#new_image">ImageList#new_image</a> methods accept
      a <code>Fill</code> object as an optional third argument. A
      <code>Fill</code> object is an instance of a <em>Fill
      class</em>. Fill classes are designed to support custom
      background fills. Each <code>Fill</code> class defines only
      two methods, <code>initialize</code> and <code>fill</code>.
      The <code>initialize</code> method is called from the
      application to create an instance of the fill class. It
      accepts any arguments and does whatever is necessary to
      create the fill. The <code>fill</code> method is called from
      the initialize method of the new image object, after the
      image is completely initialized. The <code>fill</code> method
      gets the image as its only argument and sends whatever
      methods are necessary to the image to fill the image's
      background.</p>

      <p>RMagick supplies three Fill classes,
      <code><strong>HatchFill</strong></code>,
      <code><strong>GradientFill</strong></code>, and
      <code><strong>TextureFill</strong></code>. These classes are
      explained below. The <code>HatchFill</code> class is intended
      as an example of how to write a <code>Fill</code> class and
      is written in pure Ruby. You can read it in RMagick.rb.</p>
    </div>

    <h3 id="GradientFill">class GradientFill <span class=
    "superclass">&lt; Object</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p><span class="arg">GradientFill.new(<em>x1</em>,
      <em>y1</em>, <em>x2</em>, <em>y2</em>, <em>start_color</em>,
      <em>end_color</em>) -&gt;</span> <em>aGradientFill</em></p>
    </div>

    <div class="desc">
      <h5>Description</h5>

      <p>Creates a gradient fill. The <span class="arg">x1</span>,
      <span class="arg">y1</span>, and <span class="arg">x2</span>,
      <span class="arg">y2</span> arguments describe either a line
      or a point. If <span class="arg">x1</span> != <span class=
      "arg">x2</span> or <span class="arg">y1</span> !=
      <span class="arg">y2</span>, then the arguments describe the
      starting line for the gradient. The gradient will start with
      <span class="arg">start_color</span> at the starting line and
      gradually transform to <span class="arg">end_color</span> as
      the distance increases from the starting line.</p>

      <p>If <span class="arg">x1</span> == <span class=
      "arg">x2</span> and <span class="arg">y1</span> ==
      <span class="arg">y2</span>, the gradient radiates from the
      specified point, gradually transforming from <span class=
      "arg">start_color</span> to <span class=
      "arg">end_color</span>.</p>

      <p>The line or point does not have to lie within the image
      bounds.</p>

      <h5>Arguments</h5>

      <dl>
        <dt>x1, y1</dt>

        <dd>One of the starting line end-points.</dd>

        <dt>x2, y2</dt>

        <dd>The other end-point on the starting line.</dd>

        <dt>start_color</dt>

        <dd>The color at the starting line.</dd>

        <dt>end_color</dt>

        <dd>The color to which the gradient transforms.</dd>
      </dl>

      <h5>Example</h5>

      <p><a href=
      "javascript:popup('gradientfill.rb.html')"><img src=
      "ex/gradientfill.gif" alt="GradientFill example" title=
      "Click to see the example script" /></a></p>
    </div>

    <h3 id="HatchFill">class HatchFill <span class=
    "superclass">&lt; Object</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>HatchFill.new(<span class="arg">background_color</span>,
      <span class="arg">hatch_color</span>='white', <span class=
      "arg">dist</span>=10) -&gt; <em>aHatchFill</em></p>
    </div>

    <div class="desc">
      <h4>Description</h4>

      <p>Creates a cross-hatched fill.</p>

      <h4>Arguments</h4>

      <dl>
        <dt>background_color</dt>

        <dd>The image background color.</dd>

        <dt>hatch_color</dt>

        <dd>The color of the cross-hatch lines.</dd>

        <dt>dist</dt>

        <dd>The distance between cross-hatch lines, in pixels.</dd>
      </dl>

      <h4>Example</h4>

      <p><a href="javascript:popup('hatchfill.rb.html')"><img src=
      "ex/hatchfill.gif" alt="HatchFill example" title=
      "Click to see the example script" /></a></p>
    </div>

    <h3 id="TextureFill">class TextureFill <span class=
    "superclass">&lt; Object</span></h3>

    <div class="sig">
      <h4>new</h4>

      <p>TextureFill.new(<span class="arg">texture_image</span>)
      -&gt; <em>aTextureFill</em></p>
    </div>

    <div class="desc">
      <h5>Description</h5>

      <p>Creates a texture fill by tiling the <span class=
      "arg">texture_image</span> to fill the image.</p>

      <h5>Arguments</h5>

      <p>The texture to be used as the background. May be an image
      or imagelist. If <span class="arg">texture_image</span> is an
      imagelist, uses the current image.</p>

      <h5>Example</h5>

      <p><a href=
      "javascript:popup('texturefill.rb.html')"><img src="ex/texturefill.gif"
      alt="TextureFill example" title=
      "Click to see the example script" /></a></p>
    </div>
  </div>

  <div class="subhd">
    <h2 id="exception">Exception classes</h2>

    <h3 id="MagickError">class ImageMagickError <span class=
    "superclass">&lt; StandardError</span></h3>

    <div class="desc">
      <h4>Description</h4>

      <p>When an &times;Magick function returns an error condition,
      RMagick raises an <code>ImageMagickError</code>
      exception.</p>

      <h4>Attributes</h4>

      <dl>
        <dt>magick_location</dt>

        <dd>With GraphicsMagick 1.1, this attribute contains a
        string that indicates the source file (module), function
        and line number in which GraphicsMagick raised the error.
        The string is in the form <tt>&lt;function&gt; at
        &lt;module&gt;:&lt;line&gt;</tt>. (Get-only.)</dd>
      </dl>
    </div>
  </div>

  <p class="spacer">&nbsp;</p>

  <div class="nav">
    &laquo;&nbsp;<a href="draw.html">Prev</a> | <a href=
    "index.html">Contents</a> | <a href=
    "info.html">Next</a>&nbsp;&raquo;
  </div>
</body>
</html>