Class: Magick::Image
- Defined in:
- docs/hornetseye-rmagick/lib/hornetseye-rmagick/image.rb
Instance Method Summary collapse
Instance Method Details
#to_multiarray ⇒ 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 89 |
# File 'docs/hornetseye-rmagick/lib/hornetseye-rmagick/image.rb', line 60 def to_multiarray case image_type when BilevelType, GrayscaleType, GrayscaleMatteType case depth when 32 to_type Hornetseye::UINT when 16 to_type Hornetseye::USINT when 1, 8 to_type Hornetseye::UBYTE else Kernel.raise "Conversion for grayscale image with depth #{depth} not " + "implemented" end when PaletteType, PaletteMatteType, TrueColorType, TrueColorMatteType case depth when 32 to_type Hornetseye::UINTRGB when 16 to_type Hornetseye::USINTRGB when 8 to_type Hornetseye::UBYTERGB else Kernel.raise "Conversion for colour image with depth #{depth} not " + "implemented" end else Kernel.raise "Unknown image type #{image_type.inspect}" end end |
#to_type(typecode) ⇒ Object
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 'docs/hornetseye-rmagick/lib/hornetseye-rmagick/image.rb', line 20 def to_type( typecode ) case typecode when Hornetseye::UBYTE format = 'I' pixel_type = CharPixel when Hornetseye::USINT format = 'I' pixel_type = ShortPixel when Hornetseye::UINT format = 'I' pixel_type = IntegerPixel when Hornetseye::SFLOAT format = 'I' pixel_type = FloatPixel when Hornetseye::DFLOAT format = 'I' pixel_type = DoublePixel when Hornetseye::UBYTERGB format = 'RGB' pixel_type = CharPixel when Hornetseye::USINTRGB format = 'RGB' pixel_type = ShortPixel when Hornetseye::UINTRGB format = 'RGB' pixel_type = IntegerPixel when Hornetseye::SFLOATRGB format = 'RGB' pixel_type = FloatPixel when Hornetseye::DFLOATRGB format = 'RGB' pixel_type = DoublePixel else Kernel.raise "Cannot convert to typecode #{typecode}" end Hornetseye::MultiArray.import typecode, export_pixels_to_str( 0, 0, columns, rows, format, pixel_type ), columns, rows end |