Class: Rixmap::Format::PCX::PCXFileHeader
- Inherits:
-
Object
- Object
- Rixmap::Format::PCX::PCXFileHeader
- Defined in:
- lib/rixmap/format/pcx.rb
Overview
PCXファイルヘッダ.
Instance Attribute Summary collapse
-
#bit_planes ⇒ Object
Returns the value of attribute bit_planes.
-
#bit_width ⇒ Object
Returns the value of attribute bit_width.
-
#bottom ⇒ Object
Returns the value of attribute bottom.
-
#colortype ⇒ Object
Returns the value of attribute colortype.
-
#dpi_x ⇒ Object
Returns the value of attribute dpi_x.
-
#dpi_y ⇒ Object
Returns the value of attribute dpi_y.
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#left ⇒ Object
Returns the value of attribute left.
-
#line_width ⇒ Object
Returns the value of attribute line_width.
-
#magic ⇒ Object
Returns the value of attribute magic.
-
#palette ⇒ Object
Returns the value of attribute palette.
-
#right ⇒ Object
Returns the value of attribute right.
-
#screen_x ⇒ Object
Returns the value of attribute screen_x.
-
#screen_y ⇒ Object
Returns the value of attribute screen_y.
-
#top ⇒ Object
Returns the value of attribute top.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize ⇒ PCXFileHeader
constructor
A new instance of PCXFileHeader.
-
#pack ⇒ String
設定されてる属性値をPCXヘッダバイナリ文字列にエンコードします.
-
#unpack(data)
文字列からPCXヘッダデータを復元します.
Constructor Details
#initialize ⇒ PCXFileHeader
Returns a new instance of PCXFileHeader.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/rixmap/format/pcx.rb', line 67 def initialize() @magic = FILE_SIGNATURE @version = FORMAT_VERSION_30 @encoding = ENCODINGTYPE_RLE @bit_width = nil @left = nil @top = nil @right = nil @bottom = nil @dpi_x = 72 @dpi_y = 72 @palette = "\x00" * 48 @bit_planes = nil @line_width = nil @colortype = COLORTYPE_NORMAL @screen_x = 0 @screen_y = 0 # packデータ @template = "CCCCssssssa48xCSSssx54" end |
Instance Attribute Details
#bit_planes ⇒ Object
Returns the value of attribute bit_planes.
60 61 62 |
# File 'lib/rixmap/format/pcx.rb', line 60 def bit_planes @bit_planes end |
#bit_width ⇒ Object
Returns the value of attribute bit_width.
48 49 50 |
# File 'lib/rixmap/format/pcx.rb', line 48 def bit_width @bit_width end |
#bottom ⇒ Object
Returns the value of attribute bottom.
53 54 55 |
# File 'lib/rixmap/format/pcx.rb', line 53 def bottom @bottom end |
#colortype ⇒ Object
Returns the value of attribute colortype.
62 63 64 |
# File 'lib/rixmap/format/pcx.rb', line 62 def colortype @colortype end |
#dpi_x ⇒ Object
Returns the value of attribute dpi_x.
55 56 57 |
# File 'lib/rixmap/format/pcx.rb', line 55 def dpi_x @dpi_x end |
#dpi_y ⇒ Object
Returns the value of attribute dpi_y.
56 57 58 |
# File 'lib/rixmap/format/pcx.rb', line 56 def dpi_y @dpi_y end |
#encoding ⇒ Object
Returns the value of attribute encoding.
47 48 49 |
# File 'lib/rixmap/format/pcx.rb', line 47 def encoding @encoding end |
#left ⇒ Object
Returns the value of attribute left.
50 51 52 |
# File 'lib/rixmap/format/pcx.rb', line 50 def left @left end |
#line_width ⇒ Object
Returns the value of attribute line_width.
61 62 63 |
# File 'lib/rixmap/format/pcx.rb', line 61 def line_width @line_width end |
#magic ⇒ Object
Returns the value of attribute magic.
45 46 47 |
# File 'lib/rixmap/format/pcx.rb', line 45 def magic @magic end |
#palette ⇒ Object
Returns the value of attribute palette.
58 59 60 |
# File 'lib/rixmap/format/pcx.rb', line 58 def palette @palette end |
#right ⇒ Object
Returns the value of attribute right.
52 53 54 |
# File 'lib/rixmap/format/pcx.rb', line 52 def right @right end |
#screen_x ⇒ Object
Returns the value of attribute screen_x.
64 65 66 |
# File 'lib/rixmap/format/pcx.rb', line 64 def screen_x @screen_x end |
#screen_y ⇒ Object
Returns the value of attribute screen_y.
65 66 67 |
# File 'lib/rixmap/format/pcx.rb', line 65 def screen_y @screen_y end |
#top ⇒ Object
Returns the value of attribute top.
51 52 53 |
# File 'lib/rixmap/format/pcx.rb', line 51 def top @top end |
#version ⇒ Object
Returns the value of attribute version.
46 47 48 |
# File 'lib/rixmap/format/pcx.rb', line 46 def version @version end |
Instance Method Details
#pack ⇒ String
設定されてる属性値をPCXヘッダバイナリ文字列にエンコードします.
100 101 102 |
# File 'lib/rixmap/format/pcx.rb', line 100 def pack() return [@magic, @version, @encoding, @bit_width, @left, @top, @right, @bottom, @dpi_x, @dpi_y, @palette, @bit_planes, @line_width, @colortype, @screen_x, @screen_y].pack(@template) end |
#unpack(data)
This method returns an undefined value.
文字列からPCXヘッダデータを復元します.
93 94 95 |
# File 'lib/rixmap/format/pcx.rb', line 93 def unpack(data) @magic, @version, @encoding, @bit_width, @left, @top, @right, @bottom, @dpi_x, @dpi_y, @palette, @bit_planes, @line_width, @colortype, @screen_x, @screen_y = data.unpack(@template) end |