Documentation ¶
Index ¶
- Constants
- Variables
- type PlaceHolder
- func (p *PlaceHolder) EncodeGIF(options *gif.Options) (*bytes.Buffer, error)
- func (p *PlaceHolder) EncodeJPEG(options *jpeg.Options) (*bytes.Buffer, error)
- func (p *PlaceHolder) EncodePNG() (*bytes.Buffer, error)
- func (p *PlaceHolder) Render() error
- func (p *PlaceHolder) SetBackgroundColor(bgcolor string) error
- func (p *PlaceHolder) SetForegroundColor(fgcolor string) error
- func (p *PlaceHolder) SetHeight(height int) error
- func (p *PlaceHolder) SetText(text string) error
- func (p *PlaceHolder) SetWidth(width int) error
Constants ¶
View Source
const ( // DefaultServerAddress is the default hostname where the server is going // to be started and listening. DefaultServerAddress = "localhost" // DefaultServerPort is the default port number where the server is going // to be started and listening. DefaultServerPort = "8080" // DefaultWidth is the default width of the image placeholder. DefaultWidth = 640 // DefaultHeight is the default height of the image placeholder. DefaultHeight = 480 // DefaultDPI is the default DPI value for the image placeholder. DefaultDPI = 72.00 // DefaultMarginRatio is the default margin ratio to be used to render // the text on the image placeholder. // // This percentage margin will be applied to both four inner margin of the // image bounds. DefaultMarginRatio = 0.2 // DefaultMaxFontSize is the maximum size of the font that will be used to // render the placeholder text. DefaultMaxFontSize = 512.00 // DefaultText is the default text to be rendered. DefaultText = "Placeholder" // DefaultFontPath ... DefaultFontPath = "data/fonts/Roboto-Black.ttf" )
Variables ¶
View Source
var ( // DefaultBackgroundColor : Silver #bdc3c7 // http://flatuicolors.com/ DefaultBackgroundColor = &color.RGBA{189, 195, 199, 255} // DefaultForegroundColor : Midnight Blue #2c3e50 // http://flatuicolors.com/ DefaultForegroundColor = &color.RGBA{44, 62, 80, 255} )
Functions ¶
This section is empty.
Types ¶
type PlaceHolder ¶
type PlaceHolder struct { Width int Height int Text string MarginRatio float64 BackgroundColor *color.RGBA ForegroundColor *color.RGBA Canvas *image.RGBA }
PlaceHolder ...
func (*PlaceHolder) EncodeJPEG ¶
EncodeJPEG ...
func (*PlaceHolder) EncodePNG ¶
func (p *PlaceHolder) EncodePNG() (*bytes.Buffer, error)
EncodePNG ...
func (*PlaceHolder) SetBackgroundColor ¶
func (p *PlaceHolder) SetBackgroundColor(bgcolor string) error
SetBackgroundColor ...
func (*PlaceHolder) SetForegroundColor ¶
func (p *PlaceHolder) SetForegroundColor(fgcolor string) error
SetForegroundColor ...
func (*PlaceHolder) SetHeight ¶
func (p *PlaceHolder) SetHeight(height int) error
SetHeight sets the height of the placeholder and regenerates the canvas with the new size.
func (*PlaceHolder) SetWidth ¶
func (p *PlaceHolder) SetWidth(width int) error
SetWidth sets the width of the placeholder and regenerates the canvas with the new size.
Click to show internal directories.
Click to hide internal directories.