#!/usr/bin/env ruby

require "tgif"

Tgif.new

# box
Tgif.text_just(Tgif::JUST_R)
Tgif.text(130, 60, "Box", "Times-Bold", 24)
Tgif.box(150, 40, 200, 60)

# rcbox
Tgif.text(130, 110, "RCBox", "Times-Bold", 24)
Tgif.box(150, 90, 200, 110)

# oval
Tgif.text(130, 160, "Oval", "Times-Bold", 24)
Tgif.oval(150, 140, 200, 160)

# poly
Tgif.text(130, 210, "Poly", "Times-Bold", 24)
Tgif.start_vertex(150, 210)
Tgif.add_vertex(180, 210)
Tgif.add_vertex(200, 170)
Tgif.poly()

Tgif.save_state()
Tgif.line_type(Tgif::LT_SPLINE)
Tgif.start_vertex(250, 210)
Tgif.add_vertex(280, 210)
Tgif.add_vertex(300, 170)
Tgif.poly()
Tgif.restore_state()

# polygon
Tgif.text(130, 260, "Polygon", "Times-Bold", 24)
Tgif.start_vertex(150, 260)
Tgif.add_vertex(180, 260)
Tgif.add_vertex(200, 220)
Tgif.add_vertex(150, 260)
Tgif.polygon()

# arc

# text_just
Tgif.text_just(Tgif::JUST_L)
Tgif.text(200, 350, "Tgif::JUST_L", "Times-Bold", 24)
Tgif.text_just(Tgif::JUST_C)
Tgif.text(200, 375, "Tgif::JUST_C", "Times-Bold", 24)
Tgif.text_just(Tgif::JUST_R)
Tgif.text(200, 400, "Tgif::JUST_R", "Times-Bold", 24)

# line_dash
Tgif.save_state()
Tgif.text(130, 460, "line_dash", "Times-Bold", 24)
Tgif.line_dash(1)
Tgif.box(150, 440, 200, 460)

Tgif.line_dash(5)
Tgif.box(250, 440, 300, 460)
Tgif.restore_state()

# line_style
Tgif.save_state()
Tgif.text(130, 510, "line_style", "Times-Bold", 24)
Tgif.line_style(Tgif::LS_RIGHT)
Tgif.start_vertex(150, 500)
Tgif.add_vertex(180, 500)
Tgif.poly()

Tgif.line_style(Tgif::LS_DOUBLE)
Tgif.start_vertex(250, 500)
Tgif.add_vertex(300, 500)
Tgif.poly()
Tgif.restore_state()

# line_width
Tgif.save_state()
Tgif.text(130, 560, "line_width", "Times-Bold", 24)
Tgif.line_width(3)
Tgif.start_vertex(150, 550)
Tgif.add_vertex(180, 550)
Tgif.poly()

Tgif.line_width(6)
Tgif.start_vertex(250, 550)
Tgif.add_vertex(300, 550)
Tgif.poly()
Tgif.restore_state()

# fill
Tgif.text(130, 610, "fill", "Times-Bold", 24)
Tgif.fill(Tgif::SOLIDPAT)
Tgif.box(150, 590, 200, 610)
Tgif.fill(Tgif::SCROLLPAT)
Tgif.box(250, 590, 300, 610)
Tgif.fill(Tgif::NONEPAT)

# pen
Tgif.text(130, 660, "pen", "Times-Bold", 24)
Tgif.pen(6)
Tgif.box(150, 640, 200, 660)
Tgif.pen(Tgif::SCROLLPAT)
Tgif.box(250, 640, 300, 660)
Tgif.pen(Tgif::SOLIDPAT)

# color
Tgif.text(130, 710, "color", "Times-Bold", 24)
Tgif.fill(Tgif::SOLIDPAT)
Tgif.color("red")
Tgif.box(150, 690, 200, 710)
Tgif.color("blue")
Tgif.box(250, 690, 300, 710)
Tgif.color("black")


#Tgif.import_gif("/home/nori/public_html/ruby/ja/gd-eg-gif/gif/arc.gif",
#				200, 500, 200, 200, "0.5", 0)
#Tgif.import_gif("arc.gif",
#				200, 500, 200, 200, "1.0", 1)
#Tgif.import_jpeg("/home/nori/arch/plamo-2.0/src/Ilib-1.1.7/images/ilib-logo-lowsrc.jpg",
#				200, 500, 100, 100, "1.0", 1)

# out
#Tgif.out(STDOUT, "obj")
f = open("test01.obj", "w")
Tgif.out(f, "obj")
f.close

# dump
Tgif.dump("test01.ps", "ps")
#Tgif.dump("tmp.ps.ps", "ps")

Tgif.delete
