Class: Rixmap::Format::PNG::Chunk::BaseChunk

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

Overview

PNGチャンクベースクラス

Instance Method Summary collapse

Constructor Details

#initialize(type, data = nil) ⇒ BaseChunk

チャンクを初期化します.

Parameters:

  • type (String)

    チャンクタイプ

  • data (String) (defaults to: nil)

    チャンクデータ



51
52
53
54
55
56
# File 'lib/rixmap/format/png/chunk.rb', line 51

def initialize(type, data = nil)
  @type = type
  @data = nil

  self.data = data unless data.nil?
end

Instance Method Details

#copysafe?Boolean

コピー安全なチャンクかどうかを返します.

Returns:

  • (Boolean)

    コピー安全なチャンクならtrue



106
107
108
# File 'lib/rixmap/format/png/chunk.rb', line 106

def copysafe?()
  return (@type[3].ord & 0x20) != 0
end

#dataString

チャンクデータを返します.

Returns:

  • (String)

    チャンクデータ



68
69
70
71
# File 'lib/rixmap/format/png/chunk.rb', line 68

def data()
  self.pack()
  return @data
end

#data=(data) ⇒ Object

チャンクデータを更新します.

Parameters:

  • data (String)

    チャンクデータ



76
77
78
79
80
# File 'lib/rixmap/format/png/chunk.rb', line 76

def data=(data)
  @data = data
  self.unpack()
  return nil
end

#optional?Boolean

補助チャンクかどうかを返します.

Returns:

  • (Boolean)

    補助チャンクならtrue



85
86
87
# File 'lib/rixmap/format/png/chunk.rb', line 85

def optional?()
  return (@type[0].ord & 0x20) != 0
end

#packObject

データ取得前の、データ構築処理を行います.

data から呼び出されます



113
114
# File 'lib/rixmap/format/png/chunk.rb', line 113

def pack()
end

#private?Boolean

プライベートチャンクかどうかを返します.

Returns:

  • (Boolean)

    プライベートチャンクならtrue



92
93
94
# File 'lib/rixmap/format/png/chunk.rb', line 92

def private?()
  return (@type[1].ord & 0x20) != 0
end

#standard?Boolean

標準チャンクかどうかを返します.

Returns:

  • (Boolean)

    標準チャンクならtrue



99
100
101
# File 'lib/rixmap/format/png/chunk.rb', line 99

def standard?()
  return (@type[2].ord & 0x20) == 0
end

#typeString

チャンクタイプを返します.

Returns:

  • (String)

    チャンクタイプ



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

def type()
  return @type
end

#unpackObject

データ更新後の、内部プロパティ更新処理を行います.



117
118
# File 'lib/rixmap/format/png/chunk.rb', line 117

def unpack()
end