Class: ApplePng

Inherits:
Object
  • Object
show all
Defined in:
lib/apple_png.rb,
ext/apple_png/apple_png.c

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(apple_png_data) ⇒ ApplePng

Create a new ApplePng instance from Apple PNG data in a string

Parameters:

  • apple_png_data (String)

    Binary string containing Apple PNG data, probably read from a file



11
12
13
14
# File 'lib/apple_png.rb', line 11

def initialize(apple_png_data)
  self.get_dimensions(apple_png_data)
  @raw_data = apple_png_data
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



6
7
8
# File 'lib/apple_png.rb', line 6

def height
  @height
end

#raw_dataObject (readonly)

Returns the value of attribute raw_data.



7
8
9
# File 'lib/apple_png.rb', line 7

def raw_data
  @raw_data
end

#widthObject

Returns the value of attribute width.



6
7
8
# File 'lib/apple_png.rb', line 6

def width
  @width
end

Instance Method Details

#dataString

Get the PNG data as string. The conversion from Apple PNG data to standard PNG data will be performed when this method is first called.

Returns:

  • (String)

    Binary string containing standard PNG data



18
19
20
21
# File 'lib/apple_png.rb', line 18

def data
  @data = self.convert_apple_png(@raw_data) if @data.nil?
  return @data
end