Skip to content
shairontoledo edited this page Sep 13, 2010 · 4 revisions

Line Width

Sets the line width parameter in the graphics state. Examples The thinner line


 doc=RGhost::Document.new
 doc.line_width 0



 doc.line_width 1



 doc.line_width 2

Line

Draws line from one point to another; the first point is created by moveto and the last point is created using the method lineto.
Examples


 doc=RGhost::Document.new
 doc.moveto :x => 2, :y => 3
 doc.lineto :x => 5, :y => 2


doc=RGhost::Document.new
doc.moveto :x => 2, :y => 3
doc.lineto :x => 4, :y => 4


 doc=RGhost::Document.new
 doc.border :color => '#AAFA49', :width => 4
 doc.moveto :x => 2, :y => 3
 doc.lineto :x => 4, :y => 1
 


 doc=RGhost::Document.new
 doc.border :color => '#49AAFA', :width => 1
 doc.moveto :x => 2, :y => 3
 doc.lineto :x => 4, :y => 1
 doc.moveto :x => 2, :y => 3
 doc.lineto :x => 2, :y => 1
 

Using graphic state to close path shape


 doc=RGhost::Document.new
 doc.graphic do |g|
   g.border :color => '#49AAFA', :width => 1
   g.moveto :x => 2, :y => 3
   g.lineto :x => 4, :y => 1
   g.lineto :x => 2, :y => 1
   g.shape_content :color => "#F0FFFF"
   g.closepath
   g.stroke
 end

Horizontal Line

Creates horizontal line on the current row.
Examples
Drawing line in the middle


 doc.show "Foo Bar"
 doc.horizontal_line :middle

Drawing line on the bottom and customizing border attributes


 doc.show "Foo Bar"
 doc.horizontal_line :bottom, :border => {:dash => [1,2,2,2], :color => :red}

Specifies size and where the line will begin


 doc.show "Foo Bar"
 doc.horizontal_line :top, :start_in => 2, :size => 5, :border => {:dash => [1,2,2,2], :color => :red}

Vertical Line

Draws a vertical line where :start_in => y position and :size => size of line.
Example


 doc=RGhost::Document.new
 doc.vertical_line :start_in => 1, :size => 2, :border => {:color => :red}

Vertical Line row

Draws a vertical line with size or :row_height of the document.


  doc=RGhost::Document.new
  doc.vertical_line_row