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/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
|