Documentation ¶
Index ¶
- Constants
- Variables
- func AddMusicToVideo(videoPath string, musicPath string, outputPathAndFileName string, ...)
- func CreateVideo(inputDir string, outputPathAndFileName string, inputFps float64, ...)
- func CreateVideoWithFrameStartNumber(inputDir string, outputPathAndFileName string, inputFps float64, ...)
- func ExecuteCustomFFMpegCommand(args string, input string)
- func GetTheImage() *image
- func GetTheImageGraphicContext() *draw2d.ImageGraphicContext
- type Android
- type Circle
- type ComposedFigure
- type Ellipsis
- type Figure
- func (this Figure) Draw()
- func (this *Figure) GetBase() *Figure
- func (this *Figure) GetDepth() int
- func (this *Figure) GetFillColor() color.RGBA
- func (this *Figure) GetIsFilled() bool
- func (this *Figure) GetLineWidth() float64
- func (this *Figure) GetRotationDegrees() float64
- func (this *Figure) GetScale() Point
- func (this *Figure) GetStartPoint() Point
- func (this *Figure) GetStrokeColor() color.RGBA
- func (this *Figure) GetUpdateMethod() *UpdateMethod
- func (this *Figure) GetUpdateRotationDegrees() float64
- func (this *Figure) GetUpdateTranslation() Point
- func (this *Figure) SetDepth(value int)
- func (this *Figure) SetFillColor(value color.RGBA)
- func (this *Figure) SetIsFilled(value bool)
- func (this *Figure) SetLineWidth(value float64)
- func (this *Figure) SetRotationDegrees(value float64)
- func (this *Figure) SetScale(value Point)
- func (this *Figure) SetStartPoint(value Point)
- func (this *Figure) SetStrokeColor(value color.RGBA)
- func (this *Figure) SetSubClass(value Figurer)
- func (this *Figure) SetUpdateMethod(value *UpdateMethod)
- func (this *Figure) SetUpdateRotationDegrees(value float64)
- func (this *Figure) SetUpdateTranslation(value Point)
- func (this *Figure) Update()
- type Figurer
- type Heart
- type Line
- type Point
- type Rectangle
- type Rectangler
- type RoundRectangle
- type Text
- type TextWithFrame
- func NewTextWithFrame(fontData draw2d.FontData, fontSize float64, text string, margin float64, ...) *TextWithFrame
- func NewTextWithFrameCustomMargins(fontData draw2d.FontData, fontSize float64, text string, margins []float64, ...) *TextWithFrame
- func NewTextWithRoundFrame(fontData draw2d.FontData, fontSize float64, text string, margin float64, ...) *TextWithFrame
- func NewTextWithRoundFrameCustomMargins(fontData draw2d.FontData, fontSize float64, text string, margins []float64, ...) *TextWithFrame
- type UpdateMethod
- func NewUpdateMethod(funcs ...func(Figurer)) *UpdateMethod
- func NewUpdateMethod2(times int, funcs ...func(Figurer)) *UpdateMethod
- func NewUpdateMethod3(times int, waitTimes int, funcs ...func(Figurer)) *UpdateMethod
- func NewUpdateMethod4(times int, waitTimes int, eachNth int, funcs ...func(Figurer)) *UpdateMethod
Constants ¶
const ( TopMargin int = iota BottomMargin LeftMargin RightMargin )
const ( None updateType = iota Translation updateType = 1 << iota Rotation updateType = 1 << iota Custom updateType = 1 << iota )
const (
Unlimitted int = -1
)
Variables ¶
var DestinationFolder string = "../result/"
A global variable holding the default destination for produces files.
var FrameHeight int = 480
A global variable holding the default height of the created frames.
var FramePattern string = "Frame"
A global variable holding the name of the produced frames which will be followed by their number.
var FrameWidth int = 640
A global variable holding the default width of the created frames.
Functions ¶
func AddMusicToVideo ¶
func AddMusicToVideo(videoPath string, musicPath string, outputPathAndFileName string, overwrite bool)
Add music to a video and the result is saved as a new file. All files should contain their extensions specified. Information source: http://blog.noizeramp.com/2011/04/21/adding-audio-track-to-video-with-ffmpeg/
func CreateVideo ¶
func CreateVideo(inputDir string, outputPathAndFileName string, inputFps float64, outputFps float64, overwrite bool)
Creates video using FFmpeg and all of the frames with the global FramePattern in inputDir. Overwrite indicates whether the file should be replaces in case that such already exists in the destination folder.
func CreateVideoWithFrameStartNumber ¶
func CreateVideoWithFrameStartNumber(inputDir string, outputPathAndFileName string, inputFps float64, outputFps float64, startNumber int, overwrite bool)
Creates video using FFmpeg and all of the frames with the global FramePattern in inputDir starting from StartNumber. Overwrite indicates whether the file should be replaces in case that such already exists in the destination folder. Information source: https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images
func ExecuteCustomFFMpegCommand ¶
Executes custom FFmpeg command by given arguments excluding the command name and input string if need. The ffmpeg.exe should be found in the %PATH% variable or in the current directory.
func GetTheImageGraphicContext ¶
func GetTheImageGraphicContext() *draw2d.ImageGraphicContext
Gets the singleton ImageGraphicContext.
Types ¶
type Android ¶
type Android struct { *ComposedFigure BodyWidth float64 BodyHeight float64 }
An adroid figure. Change width and height for adjusting the figure to the desired ratio.
func NewAndroid ¶
func NewAndroid(bodyWidth float64, bodyHeight float64, lineWidth float64, fillColor color.RGBA) *Android
Constructor setting current struct's fields and default values for the base struct
func NewAndroid7 ¶
func NewAndroid7( bodyWidth float64, bodyHeight float64, fillColor color.RGBA, depth int, startPoint Point, rotationDegrees float64, lineWidth float64) *Android
Constructor setting both base struct's and current struct's fields.
func (*Android) InitializeFigures ¶
Called by constructors to set initial state of the figure. Can also be used for reset.
type Circle ¶
A figure type representing circle.
func NewCircle4 ¶
Constructor setting both base struct's and current struct's fields.
type ComposedFigure ¶
type ComposedFigure struct { *Figure // contains filtered or unexported fields }
An abstract figure type. Represents a composition of figures kept as collection. Updates to this figure affect it as hole including each part.
func NewComposedFigure ¶
func NewComposedFigure() *ComposedFigure
Constructor setting current struct's fields and default values for the base struct
func NewComposedFigure3 ¶
func NewComposedFigure3(depth int, startPoint Point, rotationDegrees float64) *ComposedFigure
Constructor setting both base struct's and current struct's fields.
func (*ComposedFigure) AddFigure ¶
func (this *ComposedFigure) AddFigure(name string, figure Figurer)
Adds figure with string key to the contained collection.
func (*ComposedFigure) Draw ¶
func (this *ComposedFigure) Draw()
Draw the figure by visualizing all its part taking in to account the scale, translation and rotation of the figure.
func (*ComposedFigure) GetFigureByName ¶
func (this *ComposedFigure) GetFigureByName(name string) Figurer
Gets the figure corresponding to the given string key in the contained collection or nil if not found.
func (*ComposedFigure) RemoveFigure ¶
func (this *ComposedFigure) RemoveFigure(name string)
Removes figure by string key from the contained collection.
func (*ComposedFigure) Update ¶
func (this *ComposedFigure) Update()
Updates the figure as a whole and each of its parts.
func (*ComposedFigure) Visualize ¶
func (this *ComposedFigure) Visualize()
Defines the visualization of the figure according to position (0, 0).
type Ellipsis ¶
A figure type representing ellipsis. Change RadiusX and RadiusY for adjusting the figure to the desired ratio.
func NewEllipsis ¶
Constructor setting current struct's fields and default values for the base struct
type Figure ¶
type Figure struct {
// contains filtered or unexported fields
}
An abstract figure type. Represents a base struct for all figures.
func NewFigure4 ¶
Constructor accepting depth(layer in the image), startPoint(to which all actions are related) and rotation degrees.
func (Figure) Draw ¶
func (this Figure) Draw()
Draws the figure taking into account the translation, rotation and the rest common properties of all figures and using the implemented by the extending subClass Visualize() method.
func (*Figure) GetBase ¶
Gets the current instance. Has meaning to be used from struct extending this one if need.
func (*Figure) GetFillColor ¶
Gets the color used to fill the figure.
func (*Figure) GetIsFilled ¶
Gets whether the figure should be filled or stroked.
func (*Figure) GetLineWidth ¶
Gets the line width of the figure.
func (*Figure) GetRotationDegrees ¶
Get the current degrees by which the figure is rotated.
func (*Figure) GetStartPoint ¶
Gets the start point of the figure.
func (*Figure) GetStrokeColor ¶
Gets to color used for drawing the contour of the figure.
func (*Figure) GetUpdateMethod ¶
func (this *Figure) GetUpdateMethod() *UpdateMethod
Gets the update method used to update the figure on each call of Update().
func (*Figure) GetUpdateRotationDegrees ¶
Gets the degrees by which the figure rotates on each call of Update().
func (*Figure) GetUpdateTranslation ¶
Gets the vector by which the figure is translated on each call of Update().
func (*Figure) SetFillColor ¶
Sets the color to be used to fill the figure. Automatically set the figure as one to be filled.
func (*Figure) SetIsFilled ¶
Sets whether the figure should be filled or stroked.
func (*Figure) SetLineWidth ¶
Sets the line width of the figure.
func (*Figure) SetRotationDegrees ¶
Sets the rotation of the figure for the time after the next call of Update()
func (*Figure) SetStartPoint ¶
Sets the start point of the figure.
func (*Figure) SetStrokeColor ¶
Sets the color to be used to draw the contour of the figure.
func (*Figure) SetSubClass ¶
Sets the final figure in the extending chain. Should be called in the constructor of each extending struct. Has meaning to be used from struct extending this one to use function as virtual.
func (*Figure) SetUpdateMethod ¶
func (this *Figure) SetUpdateMethod(value *UpdateMethod)
Sets the update method to be used for updating the figure on each call of Update(). A copy of the update method is used to avoid use of the same method by more than one figures.
func (*Figure) SetUpdateRotationDegrees ¶
Sets the degrees by which the figure should rotate on each call of Update().
func (*Figure) SetUpdateTranslation ¶
Sets the vector by which the figure should translate on each call of Update().
type Figurer ¶
type Figurer interface { GetDepth() int SetDepth(value int) GetStartPoint() Point SetStartPoint(value Point) GetRotationDegrees() float64 SetRotationDegrees(value float64) GetFillColor() color.RGBA SetFillColor(value color.RGBA) GetStrokeColor() color.RGBA SetStrokeColor(value color.RGBA) GetIsFilled() bool SetIsFilled(value bool) GetLineWidth() float64 SetLineWidth(value float64) GetScale() Point SetScale(value Point) GetUpdateTranslation() Point SetUpdateTranslation(value Point) GetUpdateRotationDegrees() float64 SetUpdateRotationDegrees(value float64) GetUpdateMethod() *UpdateMethod SetUpdateMethod(value *UpdateMethod) Draw() Update() Visualize() // contains filtered or unexported methods }
Represents the base interface of all figures. For information on the methods see struct Figure.
type Heart ¶
A figure type with the shape of a heart. Change width and height for adjusting the figure to the desired ratio.
type Line ¶
A figure type representing a line.
type Rectangle ¶
A figure type representing a rectangle. Change width and height for adjusting the figure to the desired ratio.
func NewRectangle ¶
Constructor setting current struct's fields and default values for the base struct
func NewRectangle6 ¶
func NewRectangle6( width float64, height float64, depth int, startPoint Point, rotationDegrees float64, lineWidth float64) *Rectangle
Constructor setting both base struct's and current struct's fields.
type Rectangler ¶
type RoundRectangle ¶
A figure type with the shape a rectangle with rounded edges. Change width, height and radius for adjusting the figure to the desired ratio.
func NewRoundRectangle ¶
func NewRoundRectangle(radius float64, width float64, height float64, lineWidth float64) *RoundRectangle
Constructor setting current struct's fields and default values for the base struct
func NewRoundRectangle7 ¶
func NewRoundRectangle7( radius float64, width float64, height float64, depth int, startPoint Point, rotationDegrees float64, lineWidth float64) *RoundRectangle
Constructor setting both base struct's and current struct's fields.
func (*RoundRectangle) Visualize ¶
func (this *RoundRectangle) Visualize()
Defines the visualization of the figure according to position (0, 0).
type Text ¶
A figure type that allows visualization of a text with custom font. Change font size and data to adjust the text visulization.
type TextWithFrame ¶
type TextWithFrame struct { *ComposedFigure Margins []float64 }
func NewTextWithFrame ¶
func NewTextWithFrame(fontData draw2d.FontData, fontSize float64, text string, margin float64, base *ComposedFigure) *TextWithFrame
Constructor accepting initialized base class and creating text with rectangular frame and equal margins for all sides.
func NewTextWithFrameCustomMargins ¶
func NewTextWithFrameCustomMargins(fontData draw2d.FontData, fontSize float64, text string, margins []float64, base *ComposedFigure) *TextWithFrame
Constructor accepting initialized base class and creating text with rectangular frame and custom margin for each sides.
func NewTextWithRoundFrame ¶
func NewTextWithRoundFrame(fontData draw2d.FontData, fontSize float64, text string, margin float64, radius float64, base *ComposedFigure) *TextWithFrame
Constructor accepting initialized base class and radius and creating text with rectangular frame with round edges and equal margins for all sides.
func NewTextWithRoundFrameCustomMargins ¶
func NewTextWithRoundFrameCustomMargins(fontData draw2d.FontData, fontSize float64, text string, margins []float64, radius float64, base *ComposedFigure) *TextWithFrame
Constructor accepting initialized base class and radius and creating text with rectangular frame with round edges and custom margin for each sides.
type UpdateMethod ¶
type UpdateMethod struct {
// contains filtered or unexported fields
}
Type representing figure's update method than can set properties like expiration time, wait until starting, how often to update and a set of functions used for updating.
func NewUpdateMethod ¶
func NewUpdateMethod(funcs ...func(Figurer)) *UpdateMethod
Creates new update method by given set of update functions.
func NewUpdateMethod2 ¶
func NewUpdateMethod2(times int, funcs ...func(Figurer)) *UpdateMethod
Creates new update method by given times to update and set of update functions.
func NewUpdateMethod3 ¶
func NewUpdateMethod3(times int, waitTimes int, funcs ...func(Figurer)) *UpdateMethod
Creates new update method by given times to update, wait time before updating and set of update functions.
func NewUpdateMethod4 ¶
func NewUpdateMethod4(times int, waitTimes int, eachNth int, funcs ...func(Figurer)) *UpdateMethod
Creates new update method by given times to update, wait time before updating, how often to update and set of update functions.
func (*UpdateMethod) Update ¶
func (this *UpdateMethod) Update(figure Figurer)