postscript

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2023 License: BSD-2-Clause-Views Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PS_FL_SETUP int = 1 << iota // flag constants
	PS_FL_CLOSED
	PS_FL_FONTSET
	PS_FL_GSAVED // graphics is saved
)
View Source
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

func Mk_ps_gc(output string) (gc *Ps_gc, err error)

---------------- 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 *Ps_gc) Add_button(bid int, x int, y int, height int, width int, label string, colour string, txt_colour string, kind int, pushed bool)

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

func (ps *Ps_gc) Clear()

Clear the page by filling in the pcolour.

func (*Ps_gc) Clear_subpage

func (ps *Ps_gc) Clear_subpage(colour string)

Fill the subpage area with the indicated colour

func (*Ps_gc) Close

func (ps *Ps_gc) Close()

Close the output file and do any clean up needed.

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 *Ps_gc) Delete_subpage(pname string)

func (*Ps_gc) Draw_arc

func (ps *Ps_gc) Draw_arc(xo float64, yo float64, radius float64, alpha1 float64, alpha2 float64)

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

func (ps *Ps_gc) Draw_circle(xo float64, yo float64, radius float64, outline bool)

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

func (ps *Ps_gc) Draw_image(xo float64, yo float64, iimage interface{})

Draw image is a dummy function at the moment.

func (*Ps_gc) Draw_line

func (ps *Ps_gc) Draw_line(x1 float64, y1 float64, x2 float64, y2 float64)

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

func (ps *Ps_gc) Draw_poly(points []*sktools.Point, outline bool)

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) Draw_rect

func (ps *Ps_gc) Draw_rect(xo float64, yo float64, height float64, width float64, outline bool)

Draw a rectangle, x,y is the lower left cornoer.

func (*Ps_gc) Draw_text

func (ps *Ps_gc) Draw_text(xo float64, yo float64, text string)

Draw text at xo,yo with the current font, size and colour settings.

func (*Ps_gc) Drive

func (ps *Ps_gc) Drive()

func (*Ps_gc) Engague

func (ps *Ps_gc) Engague()

func (*Ps_gc) Mk_bounded_image

func (ps *Ps_gc) Mk_bounded_image(fname string, max_height int, max_width int) (interface{}, error)

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_page

func (ps *Ps_gc) Mk_page(pname string, h int, w int, title string) error

func (*Ps_gc) Mk_scaled_image

func (ps *Ps_gc) Mk_scaled_image(fname string, scale float64) (interface{}, error)

not implemented just yet

func (*Ps_gc) Mk_stacked_image

func (ps *Ps_gc) Mk_stacked_image(fnames []string, max_height int, max_width int) (interface{}, error)

func (*Ps_gc) Mk_subpage

func (ps *Ps_gc) Mk_subpage(pname string, xo float64, yo float64, height float64, width float64)

func (*Ps_gc) Pop_state

func (ps *Ps_gc) Pop_state()

restore the previously saved graphics state.

func (*Ps_gc) Press_button

func (ps *Ps_gc) Press_button(subpage_name string, button_id int)

func (*Ps_gc) Push_state

func (ps *Ps_gc) Push_state()

Save the current graphics state.

func (*Ps_gc) Release_button

func (ps *Ps_gc) Release_button(subpage_name string, button_id int)

func (*Ps_gc) Rotate

func (ps *Ps_gc) Rotate(degrees float64) bool

Set the rotation n degrees from "3 o'clock".

Returns true to indicate that it was successful.

func (*Ps_gc) Select_page

func (ps *Ps_gc) Select_page(pname string)

func (*Ps_gc) Select_subpage

func (ps *Ps_gc) Select_subpage(pname string) bool

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

func (ps *Ps_gc) Set_colour(cname string)

Set the named colour as the current colour.

func (*Ps_gc) Set_dimensions

func (ps *Ps_gc) Set_dimensions(width float64, height float64)

Set the dimensions of the page (width x height).

func (*Ps_gc) Set_fill_attrs

func (ps *Ps_gc) Set_fill_attrs(cname string, fill_style int)

Set the fill attributes: colour and style.

func (*Ps_gc) Set_font

func (ps *Ps_gc) Set_font(fname string, points int, weight int, ital bool)

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

func (ps *Ps_gc) Set_iscale(increment float64)

Adjust the scale by the increment value.

func (*Ps_gc) Set_line_style

func (ps *Ps_gc) Set_line_style(pattern []int)

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

func (ps *Ps_gc) Set_line_width(width int)

Set the line width. A value of 0 is the smalles possible width supported by the device.

func (*Ps_gc) Set_page_colour

func (ps *Ps_gc) Set_page_colour(cname string)

Set the named colour as the page colour.

func (*Ps_gc) Set_scale

func (ps *Ps_gc) Set_scale(xscale float64, yscale float64)

Set the scale factor.

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

func (ps *Ps_gc) Translate(x float64, y float64)

Translate adjusts the orign to x,y.

func (*Ps_gc) Translate_delta

func (ps *Ps_gc) Translate_delta(delta_x float64, delta_y float64)

Translate_delta adjusts the orign by delta_x, delta_y. ??? is this accurate?

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL