Class: Magick::Image
- Inherits:
-
Object
- Object
- Magick::Image
- Defined in:
- lib/autoload/autoload_io_rmagick.rb,
lib/autoload/autoload_object_magick_image.rb,
lib/object/ca_obj_magick_image.rb,
lib/io/rmagick.rb
Instance Method Summary collapse
- #ca ⇒ Object
- #export_pixels_to_ca(ca, map = "RGB", x = 0, y = 0) ⇒ Object
- #import_pixels_from_ca(ca, map = "RGBO", x = 0, y = 0) ⇒ Object
- #to_ca ⇒ Object
Instance Method Details
#ca ⇒ Object
76 77 78 |
# File 'lib/object/ca_obj_magick_image.rb', line 76 def ca return CAMagickImage.new(self) end |
#export_pixels_to_ca(ca, map = "RGB", x = 0, y = 0) ⇒ Object
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 |
# File 'lib/io/rmagick.rb', line 18 def export_pixels_to_ca (ca, map="RGB",x=0,y=0) case ca.data_type when CA_FIXLEN case ca.bytes when map.size stype = Magick::CharPixel when 2*map.size stype = Magick::ShortPixel when 4*map.size stype = Magick::IntegerPixel else raise end when CA_UINT8, CA_INT8 stype = Magick::CharPixel when CA_UINT16, CA_INT16 stype = Magick::ShortPixel when CA_UINT32, CA_INT32 stype = Magick::IntegerPixel when CA_FLOAT32 stype = Magick::FloatPixel when CA_FLOAT64 stype = Magick::DoublePixel else raise "invalid strage type" end case ca.rank when 2 if map.size != 1 raise end when 3 if map.size != ca.dim.last raise end else raise "invalid rank" end ca.load_binary(export_pixels_to_str(x,y,ca.dim1,ca.dim0,map,stype)) return ca end |
#import_pixels_from_ca(ca, map = "RGBO", x = 0, y = 0) ⇒ Object
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 |
# File 'lib/io/rmagick.rb', line 60 def import_pixels_from_ca (ca,map="RGBO",x=0,y=0) case ca.data_type when CA_FIXLEN case ca.bytes when map.size stype = Magick::CharPixel when 2*map.size stype = Magick::ShortPixel when 4*map.size stype = Magick::IntegerPixel else raise end when CA_UINT8, CA_INT8 stype = Magick::CharPixel when CA_UINT16, CA_INT16 stype = Magick::ShortPixel when CA_UINT32, CA_INT32 stype = Magick::IntegerPixel when CA_FLOAT32 stype = Magick::FloatPixel when CA_FLOAT64 stype = Magick::DoublePixel else raise "invalid strage type" end import_pixels(x,y,ca.dim1,ca.dim0,map,ca.dump_binary,stype) return self end |
#to_ca ⇒ Object
80 81 82 |
# File 'lib/object/ca_obj_magick_image.rb', line 80 def to_ca return ca.to_ca end |