Documentation ¶
Index ¶
- Constants
- type Ps_gc
- func (ps *Ps_gc) Add_button(bid int, x int, y int, height int, width int, label string, colour string, ...)
- func (ps *Ps_gc) Add_listener(ch chan *sktools.Interaction)
- func (ps *Ps_gc) Clear()
- func (ps *Ps_gc) Clear_subpage(colour string)
- func (ps *Ps_gc) Close()
- func (ps *Ps_gc) Close_image(iimage interface{})
- func (ps *Ps_gc) Delete_subpage(pname string)
- func (ps *Ps_gc) Draw_arc(xo float64, yo float64, radius float64, alpha1 float64, alpha2 float64)
- func (ps *Ps_gc) Draw_circle(xo float64, yo float64, radius float64, outline bool)
- func (ps *Ps_gc) Draw_image(xo float64, yo float64, iimage interface{})
- func (ps *Ps_gc) Draw_line(x1 float64, y1 float64, x2 float64, y2 float64)
- func (ps *Ps_gc) Draw_pie(xo float64, yo float64, radius float64, alpha1 float64, alpha2 float64, ...)
- func (ps *Ps_gc) Draw_poly(points []*sktools.Point, outline bool)
- func (ps *Ps_gc) Draw_rect(xo float64, yo float64, height float64, width float64, outline bool)
- func (ps *Ps_gc) Draw_text(xo float64, yo float64, text string)
- func (ps *Ps_gc) Drive()
- func (ps *Ps_gc) Engague()
- func (ps *Ps_gc) Mk_bounded_image(fname string, max_height int, max_width int) (interface{}, error)
- func (ps *Ps_gc) Mk_locked_subpage(pname string, xo float64, yo float64, height float64, width float64)
- func (ps *Ps_gc) Mk_page(pname string, h int, w int, title string) error
- func (ps *Ps_gc) Mk_scaled_image(fname string, scale float64) (interface{}, error)
- func (ps *Ps_gc) Mk_stacked_image(fnames []string, max_height int, max_width int) (interface{}, error)
- func (ps *Ps_gc) Mk_subpage(pname string, xo float64, yo float64, height float64, width float64)
- func (ps *Ps_gc) Pop_state()
- func (ps *Ps_gc) Press_button(subpage_name string, button_id int)
- func (ps *Ps_gc) Push_state()
- func (ps *Ps_gc) Release_button(subpage_name string, button_id int)
- func (ps *Ps_gc) Rotate(degrees float64) bool
- func (ps *Ps_gc) Select_page(pname string)
- func (ps *Ps_gc) Select_subpage(pname string) bool
- func (ps *Ps_gc) Set_colour(cname string)
- func (ps *Ps_gc) Set_dimensions(width float64, height float64)
- func (ps *Ps_gc) Set_fill_attrs(cname string, fill_style int)
- func (ps *Ps_gc) Set_font(fname string, points int, weight int, ital bool)
- func (ps *Ps_gc) Set_iscale(increment float64)
- func (ps *Ps_gc) Set_line_style(pattern []int)
- func (ps *Ps_gc) Set_line_width(width int)
- func (ps *Ps_gc) Set_page_colour(cname string)
- func (ps *Ps_gc) Set_scale(xscale float64, yscale float64)
- func (ps *Ps_gc) Show()
- func (ps *Ps_gc) Translate(x float64, y float64)
- func (ps *Ps_gc) Translate_delta(delta_x float64, delta_y float64)
Constants ¶
const ( PS_FL_SETUP int = 1 << iota // flag constants PS_FL_CLOSED PS_FL_FONTSET PS_FL_GSAVED // graphics is saved )
const ( FILL_NONE int = iota FILL_SOLID FILL_OP_0 // for postscript these are shades of grey from dark to light FILL_OP_1 FILL_OP_2 FILL_OP_3 FILL_OP_4 FILL_OP_5 FILL_OP_6 FILL_HORIZ FILL_VERT )
CAUTION: there is no way to reference these from the 'parent' without managing this directory
at the same level as sketch. So, these are defined in all places, and user will reference them as sketch.FILL_*. These must match the constants in sketch.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ps_gc ¶
type Ps_gc struct {
// contains filtered or unexported fields
}
Represents a page of output.
func Mk_ps_gc ¶
---------------- public --------------------------------------------------------------------
Allocate a postscript graphics construct. Output is the name of the output file that we'll write to.
func (*Ps_gc) Add_button ¶
func (*Ps_gc) Add_listener ¶
func (ps *Ps_gc) Add_listener(ch chan *sktools.Interaction)
Sets the interactive event listener for this gc. This function also "triggers" the callback registration.
func (*Ps_gc) Clear_subpage ¶
Fill the subpage area with the indicated colour
func (*Ps_gc) Close_image ¶
func (ps *Ps_gc) Close_image(iimage interface{})
Some environments must release resources associated with images. For PS this is probably not needed, but we must maintain the hook for the interface
func (*Ps_gc) Delete_subpage ¶
func (*Ps_gc) Draw_arc ¶
Draw an arc with center at xo, yo and a given radius. alpha1 and alpha2 respectively are the starting and ending angles of the arc. The angles are measured in degrees from "3 o'clock".
func (*Ps_gc) Draw_circle ¶
Draw a circle with center at xo,yo and the given radius. The circle is filled depending on the current value of fstyle.
func (*Ps_gc) Draw_image ¶
Draw image is a dummy function at the moment.
func (*Ps_gc) Draw_pie ¶
func (ps *Ps_gc) Draw_pie(xo float64, yo float64, radius float64, alpha1 float64, alpha2 float64, outline bool)
Draw a pie 'slice' with center at xo, yo and a given radius. alpha1 and alpha2 respectively are the starting and ending angles of the arc. The angles are measured in degrees from "3 o'clock". The outline and fill type parameters define whether the pie slice is outlined in the current colour and/or filled with the fill colour or grey scale using the FILL_* constants.
func (*Ps_gc) Draw_poly ¶
Draw_poly accepts a slice of sktools:points and draws the polygon formed by the points. We assume that the first point and the last point are to be 'closed'. The poly is filled based on the current fill style (not if none is set) and outlined if outline is true.
func (*Ps_gc) Mk_bounded_image ¶
func (*Ps_gc) Mk_locked_subpage ¶
func (ps *Ps_gc) Mk_locked_subpage(pname string, xo float64, yo float64, height float64, width float64)
Mk_locked_subpage creates a subpage that is locked in place which really only applies to the sketch interfaces that are window/screen oriente.
func (*Ps_gc) Mk_scaled_image ¶
not implemented just yet
func (*Ps_gc) Mk_stacked_image ¶
func (*Ps_gc) Mk_subpage ¶
func (*Ps_gc) Press_button ¶
func (*Ps_gc) Release_button ¶
func (*Ps_gc) Rotate ¶
Set the rotation n degrees from "3 o'clock".
Returns true to indicate that it was successful.
func (*Ps_gc) Select_page ¶
func (*Ps_gc) Select_subpage ¶
Selects (activates) the 'sub page' (clip area) by name. If the name "default" is given the main page is selected. The origin of the sub-page is the lower left corner of the page. Returns true if the subpage was found.
func (*Ps_gc) Set_colour ¶
Set the named colour as the current colour.
func (*Ps_gc) Set_dimensions ¶
Set the dimensions of the page (width x height).
func (*Ps_gc) Set_fill_attrs ¶
Set the fill attributes: colour and style.
func (*Ps_gc) Set_font ¶
Set the desired font. For postscript a weight of 0 or 1 is normal and >1 is bold. If ital is true, then -oblique is added to the font name.
func (*Ps_gc) Set_iscale ¶
Adjust the scale by the increment value.
func (*Ps_gc) Set_line_style ¶
Set the style that lines will be drawn in. Pattern is an array of integers which are used asn an on/off pattern for setting a dashed line. [3] sets 3 on, 3 off while [2, 3] sets two on, three off.
Passing a nil array sets a solid line style.
func (*Ps_gc) Set_line_width ¶
Set the line width. A value of 0 is the smalles possible width supported by the device.
func (*Ps_gc) Set_page_colour ¶
Set the named colour as the page colour.
func (*Ps_gc) Show ¶
func (ps *Ps_gc) Show()
Cause what ever has been drawn onto the page to be rendered.
func (*Ps_gc) Translate_delta ¶
Translate_delta adjusts the orign by delta_x, delta_y. ??? is this accurate?