Class: Rixmap::Format::PCX::PCXFileHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/rixmap/format/pcx.rb

Overview

PCXファイルヘッダ.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePCXFileHeader

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_planesObject

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_widthObject

Returns the value of attribute bit_width.



48
49
50
# File 'lib/rixmap/format/pcx.rb', line 48

def bit_width
  @bit_width
end

#bottomObject

Returns the value of attribute bottom.



53
54
55
# File 'lib/rixmap/format/pcx.rb', line 53

def bottom
  @bottom
end

#colortypeObject

Returns the value of attribute colortype.



62
63
64
# File 'lib/rixmap/format/pcx.rb', line 62

def colortype
  @colortype
end

#dpi_xObject

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_yObject

Returns the value of attribute dpi_y.



56
57
58
# File 'lib/rixmap/format/pcx.rb', line 56

def dpi_y
  @dpi_y
end

#encodingObject

Returns the value of attribute encoding.



47
48
49
# File 'lib/rixmap/format/pcx.rb', line 47

def encoding
  @encoding
end

#leftObject

Returns the value of attribute left.



50
51
52
# File 'lib/rixmap/format/pcx.rb', line 50

def left
  @left
end

#line_widthObject

Returns the value of attribute line_width.



61
62
63
# File 'lib/rixmap/format/pcx.rb', line 61

def line_width
  @line_width
end

#magicObject

Returns the value of attribute magic.



45
46
47
# File 'lib/rixmap/format/pcx.rb', line 45

def magic
  @magic
end

#paletteObject

Returns the value of attribute palette.



58
59
60
# File 'lib/rixmap/format/pcx.rb', line 58

def palette
  @palette
end

#rightObject

Returns the value of attribute right.



52
53
54
# File 'lib/rixmap/format/pcx.rb', line 52

def right
  @right
end

#screen_xObject

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_yObject

Returns the value of attribute screen_y.



65
66
67
# File 'lib/rixmap/format/pcx.rb', line 65

def screen_y
  @screen_y
end

#topObject

Returns the value of attribute top.



51
52
53
# File 'lib/rixmap/format/pcx.rb', line 51

def top
  @top
end

#versionObject

Returns the value of attribute version.



46
47
48
# File 'lib/rixmap/format/pcx.rb', line 46

def version
  @version
end

Instance Method Details

#packString

設定されてる属性値をPCXヘッダバイナリ文字列にエンコードします.

Returns:

  • (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ヘッダデータを復元します.

Parameters:

  • data (String)

    ヘッダ文字列



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