logogen

package
v0.0.0-...-8898136 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: GPL-3.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

func NewLogo(image []byte, logoType LogoType) Logo

NewLogo returns a Logo instance depending on its shit wow much factory!

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 (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 LogoType

type LogoType uint

LogoType defines logo orientation type

const (
)

LogoType constants, which are vertical or horizontal :)

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)

func (*SquareLogo) GetWidth

func (sl *SquareLogo) GetWidth() int

GetWidth returns logo's width

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 NewText

func NewText(text string, color color.RGBA64, fontSize float64, fontFamily []byte) (*Text, error)

NewText returns a Text instance

func (*Text) GetColorRGB

func (t *Text) GetColorRGB() (float64, float64, float64)

GetColorRGB returns a normalized text's color in RGB form

func (*Text) GetColorRGBA

func (t *Text) GetColorRGBA() (float64, float64, float64, float64)

GetColorRGBA returns a normalized text's color in RGBA form

func (*Text) GetContent

func (t *Text) GetContent() string

GetContent returns text's content string

func (*Text) GetFontColor

func (t *Text) GetFontColor() color.RGBA64

GetFontColor returns text's color

func (*Text) GetFontFamily

func (t *Text) GetFontFamily() []byte

GetFontFamily returns font's family's byte slice

func (*Text) GetFontSize

func (t *Text) GetFontSize() float64

GetFontSize returns text's font size

func (*Text) GetXLength

func (t *Text) GetXLength() float64

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

func (t *Text) GetXLengthUsingParent(parentWidth, child2ParentRatio float64) (float64, float64)

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

func (t *Text) SetContent(content string) *Text

SetContent sets content's value to the given value

func (*Text) SetFontColor

func (t *Text) SetFontColor(fontColor color.RGBA64) *Text

SetFontColor sets 's value to the given value

func (*Text) SetFontFamily

func (t *Text) SetFontFamily(fontFamily []byte) *Text

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

func (t *Text) SetFontSize(fontSize float64) *Text

SetFontSize sets 's value to the given value

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

Jump to

Keyboard shortcuts

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