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
- background(*args, **kwargs)
- chitra_from_json(data : String)
- composite(*args, **kwargs)
- enable_debug(*args, **kwargs)
- fill(*args, **kwargs)
- fill_opacity(*args, **kwargs)
- font(*args, **kwargs)
- font_size(*args, **kwargs)
- font_weight(*args, **kwargs)
- group_end(*args, **kwargs)
- group_start(*args, **kwargs)
-
grouped(&block)
Create group for composite drawings.
- height(*args, **kwargs)
- hyphen_char(*args, **kwargs)
- hyphenation(*args, **kwargs)
- image(*args, **kwargs)
- image_height(*args, **kwargs)
- image_size(*args, **kwargs)
- image_width(*args, **kwargs)
- line(*args, **kwargs)
- line_cap(*args, **kwargs)
- line_dash(*args, **kwargs)
- line_height(*args, **kwargs)
- line_join(*args, **kwargs)
- markup(*args, **kwargs)
- markup_box(*args, **kwargs)
- new_drawing(*args, **kwargs)
- new_page(*args, **kwargs)
- no_fill(*args, **kwargs)
- no_stroke(*args, **kwargs)
- oval(*args, **kwargs)
- point(*args, **kwargs)
- polygon(*args, **kwargs)
- rainbow(*args, **kwargs)
- rainbow_box(*args, **kwargs)
- rect(*args, **kwargs)
-
resolution(val)
Set resolution Default value is 72 ppi
resolution 300 size 297.mm, 210.mm rect 10.mm, 10.mm, 500
- restore_state(*args, **kwargs)
- rotate(*args, **kwargs)
- save(*args, **kwargs)
- save_state(*args, **kwargs)
-
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
- scale(*args, **kwargs)
-
size(paper : String)
Set the size and initialize the drawing surface
# paper size "A4" size "A4,landscape" size "A4,portrait"
-
size(w, h = 0)
Set the size and initialize the drawing surface
# width height size 1600, 900
- stroke(*args, **kwargs)
- stroke_opacity(*args, **kwargs)
- stroke_width(*args, **kwargs)
- text(*args, **kwargs)
- text_align(*args, **kwargs)
- text_box(*args, **kwargs)
- translate(*args, **kwargs)
- width(*args, **kwargs)
Method Detail
Create group for composite drawings.
ctx.grouped do
ctx.rect 10, 10, 100, 100
ctx.composite "In"
ctx.rect 50, 50, 100, 100
end
Set resolution Default value is 72 ppi
resolution 300
size 297.mm, 210.mm
rect 10.mm, 10.mm, 500
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
Set the size and initialize the drawing surface
# paper
size "A4"
size "A4,landscape"
size "A4,portrait"