lib/RMagick.rb in rmagick-1.14.1 vs lib/RMagick.rb in rmagick-1.15.0
- old
+ new
@@ -1,8 +1,8 @@
-# $Id: RMagick.rb,v 1.48 2006/08/27 23:06:00 rmagick Exp $
+# $Id: RMagick.rb,v 1.51 2007/01/20 23:13:50 rmagick Exp $
#==============================================================================
-# Copyright (C) 2006 by Timothy P. Hunter
+# Copyright (C) 2007 by Timothy P. Hunter
# Name: RMagick.rb
# Author: Tim Hunter
# Purpose: Extend Ruby to interface with ImageMagick.
# Notes: RMagick.so defines the classes. The code below adds methods
# to the classes.
@@ -106,47 +106,47 @@
# values to the strings used in the primitives.
ALIGN_TYPE_NAMES = {
LeftAlign.to_i => 'left',
RightAlign.to_i => 'right',
CenterAlign.to_i => 'center'
- }
+ }.freeze
ANCHOR_TYPE_NAMES = {
StartAnchor.to_i => 'start',
MiddleAnchor.to_i => 'middle',
EndAnchor.to_i => 'end'
- }
+ }.freeze
DECORATION_TYPE_NAMES = {
NoDecoration.to_i => 'none',
UnderlineDecoration.to_i => 'underline',
OverlineDecoration.to_i => 'overline',
LineThroughDecoration.to_i => 'line-through'
- }
+ }.freeze
FONT_WEIGHT_NAMES = {
AnyWeight.to_i => 'all',
NormalWeight.to_i => 'normal',
BoldWeight.to_i => 'bold',
BolderWeight.to_i => 'bolder',
LighterWeight.to_i => 'lighter',
- }
+ }.freeze
GRAVITY_NAMES = {
NorthWestGravity.to_i => 'northwest',
NorthGravity.to_i => 'north',
NorthEastGravity.to_i => 'northeast',
WestGravity.to_i => 'west',
CenterGravity.to_i => 'center',
EastGravity.to_i => 'east',
SouthWestGravity.to_i => 'southwest',
SouthGravity.to_i => 'south',
SouthEastGravity.to_i => 'southeast'
- }
+ }.freeze
PAINT_METHOD_NAMES = {
PointMethod.to_i => 'point',
ReplaceMethod.to_i => 'replace',
FloodfillMethod.to_i => 'floodfill',
FillToBorderMethod.to_i => 'filltoborder',
ResetMethod.to_i => 'reset'
- }
+ }.freeze
STRETCH_TYPE_NAMES = {
NormalStretch.to_i => 'normal',
UltraCondensedStretch.to_i => 'ultra-condensed',
ExtraCondensedStretch.to_i => 'extra-condensed',
CondensedStretch.to_i => 'condensed',
@@ -154,17 +154,17 @@
SemiExpandedStretch.to_i => 'semi-expanded',
ExpandedStretch.to_i => 'expanded',
ExtraExpandedStretch.to_i => 'extra-expanded',
UltraExpandedStretch.to_i => 'ultra-expanded',
AnyStretch.to_i => 'all'
- }
+ }.freeze
STYLE_TYPE_NAMES = {
NormalStyle.to_i => 'normal',
ItalicStyle.to_i => 'italic',
ObliqueStyle.to_i => 'oblique',
AnyStyle.to_i => 'all'
- }
+ }.freeze
private
def enquote(str)
if str.length > 2 && /\A(?:\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})\z/.match(str)
return str
@@ -338,10 +338,10 @@
primitive "line " + sprintf("%g,%g %g,%g", startX, startY, endX, endY)
end
# Set matte (make transparent) in image according to the specified
# colorization rule
- def matte(x, y, rule)
+ def matte(x, y, method)
if ( not PAINT_METHOD_NAMES.has_key?(method.to_i) )
Kernel.raise ArgumentError, "Unknown paint method"
end
primitive "matte #{x},#{y} #{PAINT_METHOD_NAMES[method.to_i]}"
end