Documentation ¶
Index ¶
- type HorizontalWideLogo
- func (hl *HorizontalWideLogo) GetHeight() int
- func (hl *HorizontalWideLogo) GetHeightAndWidthForLogogen() (h, w int)
- func (hl *HorizontalWideLogo) GetImage() []byte
- func (hl *HorizontalWideLogo) GetLogoPosition(parentWidth, parentHeight int) (x, y float64)
- func (hl *HorizontalWideLogo) GetWidth() int
- type Logo
- type LogoGenerator
- type LogoType
- type SquareLogo
- type TallRectangleLogo
- type Text
- func (t *Text) GetColorRGB() (float64, float64, float64)
- func (t *Text) GetColorRGBA() (float64, float64, float64, float64)
- func (t *Text) GetContent() string
- func (t *Text) GetFontColor() color.RGBA64
- func (t *Text) GetFontFamily() []byte
- func (t *Text) GetFontSize() float64
- func (t *Text) GetXLength() float64
- func (t *Text) GetXLengthUsingParent(parentWidth, child2ParentRatio float64) (float64, float64)
- func (t *Text) SetContent(content string) *Text
- func (t *Text) SetFontColor(fontColor color.RGBA64) *Text
- func (t *Text) SetFontFamily(fontFamily []byte) *Text
- func (t *Text) SetFontSize(fontSize float64) *Text
- type WideRectangleLogo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HorizontalWideLogo ¶
type HorizontalWideLogo struct {
// contains filtered or unexported fields
}
HorizontalWideLogo is a wide horizontal logo 🌚
func (*HorizontalWideLogo) GetHeight ¶
func (hl *HorizontalWideLogo) GetHeight() int
GetHeight returns logo's height
func (*HorizontalWideLogo) GetHeightAndWidthForLogogen ¶
func (hl *HorizontalWideLogo) GetHeightAndWidthForLogogen() (h, w int)
GetHeightAndWidthForLogogen returns h, w the height and width that will be used when generating a logo
func (*HorizontalWideLogo) GetImage ¶
func (hl *HorizontalWideLogo) GetImage() []byte
GetImage returns image encoded in base64
func (*HorizontalWideLogo) GetLogoPosition ¶
func (hl *HorizontalWideLogo) GetLogoPosition(parentWidth, parentHeight int) (x, y float64)
GetLogoPosition returns x, y coordinates on a 2D plane that will make the logo centered according to its parent image(background)
func (*HorizontalWideLogo) GetWidth ¶
func (hl *HorizontalWideLogo) GetWidth() int
GetWidth returns logo's width
type Logo ¶
type Logo interface { // GetLogoPosition returns x, y coordinates on a 2D plane that will make the logo centered // according to its parent image(background) GetLogoPosition(parentWidth, parentHeight int) (x, y float64) // GetHeight returns logo's height GetHeight() int // GetWidth returns logo's width GetWidth() int // GetImage returns a byte slice that has the image GetImage() []byte // GetHeightAndWidthForLogogen returns h, w the height and width that will be used // when generating a logo GetHeightAndWidthForLogogen() (h, w int) }
Logo interface represents a general logo despite its shape
type LogoGenerator ¶
type LogoGenerator struct {
// contains filtered or unexported fields
}
LogoGenerator defines the wrapper of the logo generation process
func NewLogoGenerator ¶
func NewLogoGenerator(logo Logo, text *Text, backgroundColor color.RGBA64) *LogoGenerator
NewLogoGenerator returns a LogoGenerator instance
func (*LogoGenerator) GenerateLogo ¶
func (lg *LogoGenerator) GenerateLogo() []byte
GenerateLogo returns a byte array logo with the provided text(instance attribute) with the given text size
func (*LogoGenerator) GenerateLogoWithPadding ¶
func (lg *LogoGenerator) GenerateLogoWithPadding(xPadding, yPadding int) []byte
GenerateLogoWithPadding calls GenerateLogo and adds padding to the final result
type SquareLogo ¶
type SquareLogo struct {
// contains filtered or unexported fields
}
SquareLogo is a square logo 🌚
func (*SquareLogo) GetHeight ¶
func (sl *SquareLogo) GetHeight() int
GetHeight returns logo's height
func (*SquareLogo) GetHeightAndWidthForLogogen ¶
func (sl *SquareLogo) GetHeightAndWidthForLogogen() (h, w int)
GetHeightAndWidthForLogogen returns h, w the height and width that will be used when generating a logo
func (*SquareLogo) GetImage ¶
func (sl *SquareLogo) GetImage() []byte
GetImage returns image encoded in base64
func (*SquareLogo) GetLogoPosition ¶
func (sl *SquareLogo) GetLogoPosition(parentWidth, parentHeight int) (x, y float64)
GetLogoPosition returns x, y coordinates on a 2D plane that will make the logo centered according to its parent image(background)
type TallRectangleLogo ¶
type TallRectangleLogo struct {
// contains filtered or unexported fields
}
TallRectangleLogo is a tall rectangle logo 🌚
func (*TallRectangleLogo) GetHeight ¶
func (tl *TallRectangleLogo) GetHeight() int
GetHeight returns logo's height
func (*TallRectangleLogo) GetHeightAndWidthForLogogen ¶
func (tl *TallRectangleLogo) GetHeightAndWidthForLogogen() (h, w int)
GetHeightAndWidthForLogogen returns h, w the height and width that will be used when generating a logo
func (*TallRectangleLogo) GetImage ¶
func (tl *TallRectangleLogo) GetImage() []byte
GetImage returns image encoded in base64
func (*TallRectangleLogo) GetLogoPosition ¶
func (tl *TallRectangleLogo) GetLogoPosition(parentWidth, parentHeight int) (x, y float64)
GetLogoPosition returns x, y coordinates on a 2D plane that will make the logo centered according to its parent image(background)
func (*TallRectangleLogo) GetWidth ¶
func (tl *TallRectangleLogo) GetWidth() int
GetWidth returns logo's width
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text holds a fancy text that has size, style color and more
func (*Text) GetColorRGB ¶
GetColorRGB returns a normalized text's color in RGB form
func (*Text) GetColorRGBA ¶
GetColorRGBA returns a normalized text's color in RGBA form
func (*Text) GetContent ¶
GetContent returns text's content string
func (*Text) GetFontColor ¶
GetFontColor returns text's color
func (*Text) GetFontFamily ¶
GetFontFamily returns font's family's byte slice
func (*Text) GetFontSize ¶
GetFontSize returns text's font size
func (*Text) GetXLength ¶
GetXLength calculates and returns text's horizontal XLength as in its font family if the text hasn't changed the calculation is skipped :)
func (*Text) GetXLengthUsingParent ¶
GetXLengthUsingParent returns text's XLength and new fontSize when placed in a container with a specific ratio
the original FontSize is not affected by this method!
func (*Text) SetContent ¶
SetContent sets content's value to the given value
func (*Text) SetFontColor ¶
SetFontColor sets 's value to the given value
func (*Text) SetFontFamily ¶
SetFontFamily sets a new font family for the text
the reason of using setter and getter methods for fontFamily, to avoid arbitrary font updating since updating the font requires updating the font parser too :)
func (*Text) SetFontSize ¶
SetFontSize sets 's value to the given value
type WideRectangleLogo ¶
type WideRectangleLogo struct {
// contains filtered or unexported fields
}
WideRectangleLogo is a wide rectangle logo 🌚
func (*WideRectangleLogo) GetHeight ¶
func (wl *WideRectangleLogo) GetHeight() int
GetHeight returns logo's height
func (*WideRectangleLogo) GetHeightAndWidthForLogogen ¶
func (wl *WideRectangleLogo) GetHeightAndWidthForLogogen() (h, w int)
GetHeightAndWidthForLogogen returns h, w the height and width that will be used when generating a logo
func (*WideRectangleLogo) GetImage ¶
func (wl *WideRectangleLogo) GetImage() []byte
GetImage returns image encoded in base64
func (*WideRectangleLogo) GetLogoPosition ¶
func (wl *WideRectangleLogo) GetLogoPosition(parentWidth, parentHeight int) (x, y float64)
GetLogoPosition returns x, y coordinates on a 2D plane that will make the logo centered according to its parent image(background)
func (*WideRectangleLogo) GetWidth ¶
func (wl *WideRectangleLogo) GetWidth() int
GetWidth returns logo's width