Class PNG::Canvas
In: lib/png/font.rb
lib/png.rb
Parent: Object

A canvas used for drawing images. Origin is 0, 0 in the bottom left corner.

Methods

[]   []=   annotate   composite   each   extract   line   new   point   to_s  

Attributes

data  [R]  Raw data
height  [R]  Height of the canvas
width  [R]  Width of the canvas

Public Class methods

Public Instance methods

Retrieves the color of the pixel at (x, y).

Sets the color of the pixel at (x, y) to color.

Write a string at [x, y] with font, optionally specifying a font, an alignment of :left, :center, or :right and the style to draw the annotation (see composite).

  require 'png/font'

Composites another canvas onto self at the given (bottom left) coordinates.

Iterates over the canvas yielding x, y, and color.

Create a new canvas copying a region of the current canvas

Draws a line using Xiaolin Wu‘s antialiasing technique.

en.wikipedia.org/wiki/Xiaolin_Wu's_line_algorithm

Blends color onto the color at point (x, y).

Returns an ASCII representation of this image

[Validate]