Documentation
¶
Overview ¶
Package deckgen (generate) performs slide deck generation
Index ¶
- func Polycoord(px, py []float64) (string, string)
- type Arc
- type CommonAttr
- type Curve
- type Deck
- type DeckGen
- func (p *DeckGen) Arc(x, y, w, h, size, a1, a2 float64, color string, opacity ...float64)
- func (p *DeckGen) Circle(x, y, w float64, color string, opacity ...float64)
- func (p *DeckGen) Code(x, y float64, s string, size, margin float64, color string, opacity ...float64)
- func (p *DeckGen) Curve(x1, y1, x2, y2, x3, y3, size float64, color string, opacity ...float64)
- func (p *DeckGen) Ellipse(x, y, w, h float64, color string, opacity ...float64)
- func (p *DeckGen) EndDeck()
- func (p *DeckGen) EndSlide()
- func (p *DeckGen) Image(x, y float64, w, h int, name, link string)
- func (p *DeckGen) Line(x1, y1, x2, y2, size float64, color string, opacity ...float64)
- func (p *DeckGen) List(x, y, size, spacing, wrap float64, items []string, ltype, font, color string)
- func (p *DeckGen) Polygon(x, y []float64, color string, opacity ...float64)
- func (p *DeckGen) Polyline(x, y []float64, size float64, color string, opacity ...float64)
- func (p *DeckGen) Rect(x, y, w, h float64, color string, opacity ...float64)
- func (p *DeckGen) Square(x, y, w float64, color string, opacity ...float64)
- func (p *DeckGen) StartDeck()
- func (p *DeckGen) StartSlide(colors ...string)
- func (p *DeckGen) Text(x, y float64, s, font string, size float64, color string, opacity ...float64)
- func (p *DeckGen) TextBlock(x, y float64, s, font string, size, margin float64, color string, ...)
- func (p *DeckGen) TextEnd(x, y float64, s, font string, size float64, color string, opacity ...float64)
- func (p *DeckGen) TextLink(x, y float64, s, link, font string, size float64, color string, ...)
- func (p *DeckGen) TextMid(x, y float64, s, font string, size float64, color string, opacity ...float64)
- func (p *DeckGen) TextRotate(x, y float64, s, link, font string, rotation, size float64, color string, ...)
- type Dimension
- type Ellipse
- type Image
- type Line
- type List
- type ListItem
- type Polygon
- type Polyline
- type Rect
- type Slide
- type Text
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Arc ¶
type Arc struct {
Dimension
A1 float64 `xml:"a1,attr"`
A2 float64 `xml:"a2,attr"`
Sp float64 `xml:"sp,attr"`
Opacity float64 `xml:"opacity,attr"`
}
Arc defines an elliptical arc the arc is defined by a beginning and ending angle in percentages <arc xp="55" yp="10" wp="4" hr="75" a1="0" a2="180"/>
type CommonAttr ¶
type CommonAttr struct {
Xp float64 `xml:"xp,attr"` // X coordinate
Yp float64 `xml:"yp,attr"` // Y coordinate
Sp float64 `xml:"sp,attr"` // size
Lp float64 `xml:"lp,attr"` // linespacing (leading) percentage
Rotation float64 `xml:"rotation,attr"` // Rotation (0-360 degrees)
Type string `xml:"type,attr"` // type: block, plain, code, number, bullet
Align string `xml:"align,attr"` // alignment: center, end, begin
Color string `xml:"color,attr"` // item color
Gradcolor1 string `xml:"gradcolor1,attr"` // gradient color 1
Gradcolor2 string `xml:"gradcolor2,attr"` // gradient color 2
GradPercent float64 `xml:"gp,attr"` // gradient percentage
Opacity float64 `xml:"opacity,attr"` // opacity percentage
Font string `xml:"font,attr"` // font type: i.e. sans, serif, mono
Link string `xml:"link,attr"` // reference to other content (i.e. http:// or mailto:)
}
CommonAttr are the common attributes for text and list
type Curve ¶
type Curve struct {
Xp1 float64 `xml:"xp1,attr"`
Yp1 float64 `xml:"yp1,attr"`
Xp2 float64 `xml:"xp2,attr"`
Yp2 float64 `xml:"yp2,attr"`
Xp3 float64 `xml:"xp3,attr"`
Yp3 float64 `xml:"yp3,attr"`
Sp float64 `xml:"sp,attr"`
Color string `xml:"color,attr"`
Opacity float64 `xml:"opacity,attr"`
}
Curve defines a quadratic Bezier curve The begining, ending, and control points are required: <curve xp1="60" yp1="10" xp2="75" yp2="20" xp3="70" yp3="10" />
type Deck ¶
type Deck struct {
Title string `xml:"title"`
Creator string `xml:"creator"`
Subject string `xml:"subject"`
Publisher string `xml:"publisher"`
Description string `xml:"description"`
Date string `xml:"date"`
Canvas canvas `xml:"canvas"`
Slide []Slide `xml:"slide"`
}
deckmarkup defines the structure of a presentation deck The size of the canvas, and series of slides
type DeckGen ¶
type DeckGen struct {
// contains filtered or unexported fields
}
DeckGen is the generated deck structure.
func (*DeckGen) Arc ¶
Arc makes an arc centered at (x,y), with specified color (with optional opacity), with dimensions (w,h), between angle a1 and a2 (specified in degrees).
func (*DeckGen) Circle ¶
Circle makes a circle, centered at (x,y) with width w, at the specified color and optional opacity.
func (*DeckGen) Code ¶
func (p *DeckGen) Code(x, y float64, s string, size, margin float64, color string, opacity ...float64)
Code makes a code block at (x,y), with specified size and color (opacity is optional), on a light gray background with the specified margin width.
func (*DeckGen) Curve ¶
Curve makes a Bezier curve between (x1, y2) and (x3, y3), with control points at (x2, y2), thickness is specified by size.
func (*DeckGen) Ellipse ¶
Ellipse makes a ellipse graphic, centered at (x,y), with (w,h) dimensions, at the specified color and optional opacity.
func (*DeckGen) Line ¶
Line makes a line from (x1,y1) to (x2, y2), with the specified color with optional opacity; thickness is size.
func (*DeckGen) List ¶
func (p *DeckGen) List(x, y, size, spacing, wrap float64, items []string, ltype, font, color string)
List makes a plain, bullet, or plain list with the specified font, size and color, with optional spacing
func (*DeckGen) Polygon ¶
Polygon makes a polygon with the specified color (with optional opacity), with coordinates in x and y slices.
func (*DeckGen) Polyline ¶
Polyline makes a polyline with the specified color and thickness (with optional opacity), with coordinates in x and y slices.
func (*DeckGen) Rect ¶
Rect makes a rectangle, centered at (x,y), with (w,h) dimensions, at the specified color and optional opacity.
func (*DeckGen) Square ¶
Square makes a square, centered at (x,y), with width w, at the specified color and optional opacity.
func (*DeckGen) StartSlide ¶
StartSlide begins a slide.
func (*DeckGen) Text ¶
func (p *DeckGen) Text(x, y float64, s, font string, size float64, color string, opacity ...float64)
Text places plain text aligned at (x,y), with specified font, size and color. Opacity is optional
func (*DeckGen) TextBlock ¶
func (p *DeckGen) TextBlock(x, y float64, s, font string, size, margin float64, color string, opacity ...float64)
TextBlock makes a block of text aligned at (x,y), wrapped at margin; with specified font, size and color. Opacity is optional.
func (*DeckGen) TextEnd ¶
func (p *DeckGen) TextEnd(x, y float64, s, font string, size float64, color string, opacity ...float64)
TextEnd places right-justified text aligned at (x,y), with specified font, size and color. Opacity is optional.
func (*DeckGen) TextLink ¶
func (p *DeckGen) TextLink(x, y float64, s, link, font string, size float64, color string, opacity ...float64)
TextLink places text aligned at (x,y) with a link
type Dimension ¶
type Dimension struct {
CommonAttr
Wp float64 `xml:"wp,attr"` // width percentage
Hp float64 `xml:"hp,attr"` // height percentage
Hr float64 `xml:"hr,attr"` // height relative percentage
Hw float64 `xml:"hw,attr"` // height by width
}
Dimension describes a graphics object with width and height
type Ellipse ¶
type Ellipse struct {
Dimension
}
Ellipse describes a rectangle with x,y,w,h <ellipse xp="45" yp="10" wp="4" hr="75" color="rgb(0,127,0)"/>
type Image ¶
type Image struct {
CommonAttr
Width int `xml:"width,attr"` // image width
Height int `xml:"height,attr"` // image height
Scale float64 `xml:"scale,attr"` // image scale percentage
Autoscale string `xml:"autoscale,attr"` // scale the image to the canvas
Name string `xml:"name,attr"` // image file name
Caption string `xml:"caption,attr"` // image caption
}
Image describes an image <image xp="20" yp="30" width="256" height="256" scale="50" name="picture.png" caption="Pretty picture"/>
type Line ¶
type Line struct {
Xp1 float64 `xml:"xp1,attr"` // begin x coordinate
Yp1 float64 `xml:"yp1,attr"` // begin y coordinate
Xp2 float64 `xml:"xp2,attr"` // end x coordinate
Yp2 float64 `xml:"yp2,attr"` // end y coordinate
Sp float64 `xml:"sp,attr"` // line thickness
Color string `xml:"color,attr"` // line color
Opacity float64 `xml:"opacity,attr"` // line opacity (1-100)
}
Line defines a straight line <line xp1="20" yp1="10" xp2="30" yp2="10"/>
type List ¶
type List struct {
CommonAttr
Wp float64 `xml:"wp,attr"`
Li []ListItem `xml:"li"`
}
List describes the list element
type ListItem ¶
type ListItem struct {
Color string `xml:"color,attr"`
Opacity float64 `xml:"opacity,attr"`
Font string `xml:"font,attr"`
ListText string `xml:",chardata"`
}
ListItem describes a list item <list xp="20" yp="70" sp="1.5">
<li>canvas<li> <li>slide</li>
</list>
type Polygon ¶
type Polygon struct {
XC string `xml:"xc,attr"`
YC string `xml:"yc,attr"`
Color string `xml:"color,attr"`
Opacity float64 `xml:"opacity,attr"`
}
Polygon defines a polygon, x and y coordinates are specified by strings of space-separated percentages: <polygon xc="10 20 30" yc="30 40 50"/>
type Polyline ¶
type Polyline struct {
XC string `xml:"xc,attr"`
YC string `xml:"yc,attr"`
Sp float64 `xml:"sp,attr"` // line thickness
Color string `xml:"color,attr"`
Opacity float64 `xml:"opacity,attr"`
}
Polyline defines a polyline, x and y coordinates are specified by strings of space-separated percentages: <polyline xc="10 20 30" yc="30 40 50"/>
type Rect ¶
type Rect struct {
Dimension
}
Rect describes a rectangle with x,y,w,h <rect xp="35" yp="10" wp="4" hp="3"/>
type Slide ¶
type Slide struct {
Bg string `xml:"bg,attr"`
Fg string `xml:"fg,attr"`
Gradcolor1 string `xml:"gradcolor1,attr"`
Gradcolor2 string `xml:"gradcolor2,attr"`
GradPercent float64 `xml:"gp,attr"`
Duration string `xml:"duration,attr"`
Note string `xml:"note"`
List []List `xml:"list"`
Text []Text `xml:"text"`
Image []Image `xml:"image"`
Ellipse []Ellipse `xml:"ellipse"`
Line []Line `xml:"line"`
Rect []Rect `xml:"rect"`
Curve []Curve `xml:"curve"`
Arc []Arc `xml:"arc"`
Polygon []Polygon `xml:"polygon"`
Polyline []Polyline `xml:"polyline"`
}
Slide is the structure of an individual slide within a deck <slide bg="black" fg="rgb(255,255,255)" duration="2s" note="hello, world"> <slide gradcolor1="black" gradcolor2="white" gp="20" duration="2s" note="wassup">