RMagick User's Guide and Reference
Struct classes

Table Of Contents

Miscellaneous structures

These structure classes are used to create objects used as attribute and argument values in other RMagick classes. Generally the classes define only attributes and their accessor methods. The Pixel structure, however, defines additional constructors and conversion methods.

class AffineMatrix

class methods

new Magick::AffineMatrix.new(sx, rx, ry, sy, tx, ty) -> anAffineMatrix
Description An AffineMatrix object describes a coordinate transformation. This object is used as an argument to the Frame#affine_transform, Frame#composite_affine, and Draw#affine= methods.

attributes

sx The amount of scaling on the x-axis.
rx The amount of rotation on the x-axis, in radians.
ry The amount of rotation on the x-axis, in radians.
sy The amount of scaling on the y-axis.
tx The amount of translation on the x-axis, in pixels.
ty The amount of translation on the y-axis, in pixels.
 
class Chromaticity

class methods

new Magick::Chromaticity.new(red_primary, green_primary, blue_primary, white_point) -> anChromaticity
Description A Chromaticity object represents chromaticity values for the Frame#chromaticity attribute.

attributes

The attribute values are Primary objects.
red_primary Red primary point (e.g. red_primary.x=0.64, red_primary.y=0.33)
green_primary Green primary point (e.g. green_primary.x=0.3, green_primary.y=0.6)
blue_primary Blue primary point (e.g. blue_primary.x=0.15, blue_primary.y=0.06)
white_point White point (e.g. white_point.x=0.3127, white_point.y=0.329)
 
class Pixel

class methods

new Magick::Pixel.new(red, green, blue, opacity) -> aPixel
Description Constructs a pixel object from the specified red, green, blue, and opacity intensities.
from_color Magick::Pixel.from_color(color_name) -> aPixel
Description Constructs a pixel object corresponding to the specified color name. Raises ArgumentError if the name is unknown. See Pixel#to_color, below.
from_HSL Magick::Pixel.from_HSL(hue, saturation, luminosity) -> aPixel
Description Constructs a pixel object from the specified hue, saturation, and luminosity values. See Pixel#to_HSL, below.

attributes

The attribute values are numbers between 0 and MaxRGB. If the image is in the CMYKColorspace, the red, green, blue, and opacity attributes are interpreted as cyan, magenta, yellow, and black intensities, respectively.
red The red intensity
green The green intensity
blue The blue intensity
opacity The opacity level. You can use the TransparentOpacity or OpaqueOpacity constants for this attribute as well as a number.

instance methods

to_color pixel.to_color(compliance=AllCompliance, matte=false, depth=8 or 16) -> aString
Description Returns the color name 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".
Arguments
compliance
A ComplianceType constant. The default value of AllCompliance causes to_color to search for a color name in any of the 3 defined color standards.
matte
If false, the pixel's opacity attribute is ignored.
depth
An image depth. The default is the quantum depth used when ×Magick was compiled. The value 16 can be used only when ×Magick was compiled with a quantum depth of 16.
to_HSL pixel.to_HSL -> anArray
Description Returns the array [hue, saturation, luminosity] corresponding the the pixel RGB values.
 
class Point

class methods

new Magick::Point.new(x, y) -> aPoint
Description An object of this Struct class is used as the value of the pixels_per_em attribute in the TypeMetric struct returned by Draw#get_type_metrics.

attributes

x Character width.
y Character height.
 
class Primary

class methods

new Magick::Primary.new(x, y, z) -> aPrimary
Description See class Chromaticity.

attributes

x X ordinate.
y Y ordinate.
z Z ordinate. This attribute is always ignored.
 
class Rectangle

class methods

new Magick::Rectangle.new(width, height, x, y) -> aRectangle
Description The value of the Image#tile_info and Image#bounding_box attributes.

attributes

width Rectangle width.
height Rectangle height.
x Offset from the left edge of the image.
y Offset from the top edge of the image.
 
class Segment

class methods

new Magick::Segment.new(x1, y1, x2, y2) -> aSegment
Description The value of the bounds attribute in the TypeMetric class.

attributes

x1  
y1  
x2  
y2