Top Level Namespace

Defined in:

Constant Summary

FUNCS = ["width", "height", "enable_debug", "fill", "no_fill", "stroke", "stroke_width", "save", "new_drawing", "rect", "oval", "line", "line_dash", "line_cap", "line_join", "translate", "rotate", "scale", "polygon", "background", "no_stroke", "font", "font_size", "text", "text_box", "hyphenation", "hyphen_char", "text_align", "line_height", "point", "save_state", "restore_state", "fill_opacity", "stroke_opacity", "image", "new_page", "group_start", "group_end", "composite", "markup", "markup_box", "rainbow", "rainbow_box", "image_width", "image_height", "image_size", "font_weight"] of ::String
NO_ARG_FUNCS = ["enable_debug", "no_fill", "new_drawing", "no_stroke", "new_page"] of ::String
PAPER_SIZES = {a0: {841, 1189}, a1: {594, 841}, a2: {420, 594}, a3: {297, 420}, a4: {210, 297}, a5: {148, 210}, a6: {105, 148}, a7: {74, 105}, a8: {52, 74}, a9: {37, 52}, a10: {26, 37}, b0: {1000, 1414}, b1: {707, 1000}, b2: {500, 707}, b3: {353, 500}, b4: {250, 353}, b5: {176, 250}, b6: {125, 176}, b7: {88, 125}, b8: {62, 88}, b9: {44, 62}, b10: {31, 44}, c0: {917, 1297}, c1: {648, 917}, c2: {458, 648}, c3: {324, 458}, c4: {229, 324}, c5: {162, 229}, c6: {114, 162}, c7: {81, 114}, c8: {57, 81}, c9: {40, 57}, c10: {28, 40}, letter: {216, 279}, legal: {216, 356}, ledger: {432, 279}}

Paper sizes in mm

Method Summary

Method Detail

def background(*args, **kwargs) #

[View source]
def chitra_from_json(data : String) #

[View source]
def composite(*args, **kwargs) #

[View source]
def enable_debug(*args, **kwargs) #

[View source]
def fill(*args, **kwargs) #

[View source]
def fill_opacity(*args, **kwargs) #

[View source]
def font(*args, **kwargs) #

[View source]
def font_size(*args, **kwargs) #

[View source]
def font_weight(*args, **kwargs) #

[View source]
def group_end(*args, **kwargs) #

[View source]
def group_start(*args, **kwargs) #

[View source]
def grouped(&block) #

Create group for composite drawings.

ctx.grouped do
  ctx.rect 10, 10, 100, 100
  ctx.composite "In"
  ctx.rect 50, 50, 100, 100
end

[View source]
def height(*args, **kwargs) #

[View source]
def hyphen_char(*args, **kwargs) #

[View source]
def hyphenation(*args, **kwargs) #

[View source]
def image(*args, **kwargs) #

[View source]
def image_height(*args, **kwargs) #

[View source]
def image_size(*args, **kwargs) #

[View source]
def image_width(*args, **kwargs) #

[View source]
def line(*args, **kwargs) #

[View source]
def line_cap(*args, **kwargs) #

[View source]
def line_dash(*args, **kwargs) #

[View source]
def line_height(*args, **kwargs) #

[View source]
def line_join(*args, **kwargs) #

[View source]
def markup(*args, **kwargs) #

[View source]
def markup_box(*args, **kwargs) #

[View source]
def new_drawing(*args, **kwargs) #

[View source]
def new_page(*args, **kwargs) #

[View source]
def no_fill(*args, **kwargs) #

[View source]
def no_stroke(*args, **kwargs) #

[View source]
def oval(*args, **kwargs) #

[View source]
def point(*args, **kwargs) #

[View source]
def polygon(*args, **kwargs) #

[View source]
def rainbow(*args, **kwargs) #

[View source]
def rainbow_box(*args, **kwargs) #

[View source]
def rect(*args, **kwargs) #

[View source]
def resolution(val) #

Set resolution Default value is 72 ppi

resolution 300
size 297.mm, 210.mm
rect 10.mm, 10.mm, 500

[View source]
def restore_state(*args, **kwargs) #

[View source]
def rotate(*args, **kwargs) #

[View source]
def save(*args, **kwargs) #

[View source]
def save_state(*args, **kwargs) #

[View source]
def saved_state(&block) #

Draw with the state changes that don't change the Global state

# Set Fill color Red
ctx.fill 1, 0, 0
ctx.saved_state do
  # Change the fill color to Blue
  ctx.fill 0, 0, 1
  ctx.rect 100, 100, 200, 200
end
# Draw rect with the fill color set previously
ctx.rect 200, 200, 200, 200

[View source]
def scale(*args, **kwargs) #

[View source]
def size(paper : String) #

Set the size and initialize the drawing surface

#    paper
size "A4"
size "A4,landscape"
size "A4,portrait"

[View source]
def size(w, h = 0) #

Set the size and initialize the drawing surface

#    width height
size 1600, 900

[View source]
def stroke(*args, **kwargs) #

[View source]
def stroke_opacity(*args, **kwargs) #

[View source]
def stroke_width(*args, **kwargs) #

[View source]
def text(*args, **kwargs) #

[View source]
def text_align(*args, **kwargs) #

[View source]
def text_box(*args, **kwargs) #

[View source]
def translate(*args, **kwargs) #

[View source]
def width(*args, **kwargs) #

[View source]