class Gpx2png::ChunkyPngRenderer

Attributes

x[RW]
y[RW]

Public Class Methods

new(_options = {}) click to toggle source
# File lib/gpx2png/renderers/chunky_png_renderer.rb, line 9
def initialize(_options = {})
  @options = _options || {}
  @_color = @options[:color] || '#FF0000'
  @color = ChunkyPNG::Color.from_hex(@_color)
end

Public Instance Methods

add_tile(blob, x_offset, y_offset) click to toggle source

Add one tile to full image

# File lib/gpx2png/renderers/chunky_png_renderer.rb, line 27
def add_tile(blob, x_offset, y_offset)
  tile_image = ChunkyPNG::Image.from_blob(blob)
  @image.compose!(
    tile_image,
    x_offset,
    y_offset
  )
end
crop() click to toggle source
# File lib/gpx2png/renderers/chunky_png_renderer.rb, line 48
def crop
  # TODO
end
line(xa, ya, xb, yb) click to toggle source
# File lib/gpx2png/renderers/chunky_png_renderer.rb, line 36
def line(xa, ya, xb, yb)
  @image.line(
    xa, ya,
    xb, yb,
    @color
  )
end
new_image() click to toggle source

Create new (full) image

# File lib/gpx2png/renderers/chunky_png_renderer.rb, line 18
def new_image
  @image = ChunkyPNG::Image.new(
    @x,
    @y,
    ChunkyPNG::Color::WHITE
  )
end
save(filename) click to toggle source
# File lib/gpx2png/renderers/chunky_png_renderer.rb, line 52
def save(filename)
  @image.save(filename)
end
set_crop(x_min, x_max, y_min, y_max) click to toggle source
# File lib/gpx2png/renderers/chunky_png_renderer.rb, line 44
def set_crop(x_min, x_max, y_min, y_max)
  # TODO
end
to_png() click to toggle source
# File lib/gpx2png/renderers/chunky_png_renderer.rb, line 56
def to_png
  # TODO
end