api

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogo(res http.ResponseWriter, req *http.Request)

GetLogo generates a dsc logo based on the given request body it uses GetLogoWithTextWithPadding from the LogoGenerator package to append university name with padding. it works on the very basic 4 steps: 1. get logo properties from the request body, 2. get a proper raw-logo and font color based on image color type 3. pass data to LogoGenerator, and generate a logo :) 4. send the generated b64 image to the response. no error handling is available yet!, since this api is ONLY called from the provided front end.

Types

type LogoProps

type LogoProps struct {
	ImgColor           string
	UniName            string
	Opacity            float64
	LogoType           logogen.LogoType
	LogoColor          string
	XPadding, YPadding int
	LogoSth            files.DecodedB64File
}

LogoProps , well it's written on the box :)

type LogoPropsJuicer

type LogoPropsJuicer struct {
	// contains filtered or unexported fields
}

LogoPropsJuicer gets the appropriate logo and text color based on the request query

func NewLogoPropsJuicer

func NewLogoPropsJuicer(req *http.Request) (lp *LogoPropsJuicer)

NewLogoPropsJuicer returns a new LogoPropsJuicer instance

func (*LogoPropsJuicer) GetImageBackground

func (lp *LogoPropsJuicer) GetImageBackground() color.RGBA64

GetImageBackground returns a color color.RGBA64 that represents the logo background color based on the logo color-type, if color-style is not recognised it returns a white background

func (*LogoPropsJuicer) GetPadding

func (lp *LogoPropsJuicer) GetPadding() (x, y int)

GetPadding returns the appropriate padding for the logo depending on its orientation

func (lp *LogoPropsJuicer) GetRawLogo() logogen.Logo

GetRawLogo returns a byte array of the required logo color-style. if color-style is not recognised it returns a colored logo :)

func (*LogoPropsJuicer) GetText

func (lp *LogoPropsJuicer) GetText() *logogen.Text

GetText returns a text for the logo with the appropriate color and size 200

func (*LogoPropsJuicer) GetTextColor

func (lp *LogoPropsJuicer) GetTextColor() color.RGBA64

GetTextColor returns a color.RGBA64 that represents the text color based on the required logo color-style. if color-style is not recognised it returns a colored logo text :)

Jump to

Keyboard shortcuts

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