Documentation ¶
Overview ¶
The problem that is sovled by using the handlers is that you can pass in the minecraft.Skin and it does the rest - vs. requiring a switch logic based on the route for which method to use.
mcskin has the logic for constructing the skin into the desired shape It also will detect width/image type and can be used as an http.Handler to then deliver this to a client
Index ¶
- Constants
- func GetWidth(inp string) int
- func HandlerArmorBody(logger log.Logger, skinIO mcuser.TextureIO) http.HandlerFunc
- func HandlerArmorBust(logger log.Logger, skinIO mcuser.TextureIO) http.HandlerFunc
- func HandlerBody(logger log.Logger, skinIO mcuser.TextureIO) http.HandlerFunc
- func HandlerBust(logger log.Logger, skinIO mcuser.TextureIO) http.HandlerFunc
- func HandlerCube(logger log.Logger, skinIO mcuser.TextureIO) http.HandlerFunc
- func HandlerCubeHelm(logger log.Logger, skinIO mcuser.TextureIO) http.HandlerFunc
- func HandlerHead(logger log.Logger, skinIO mcuser.TextureIO) http.HandlerFunc
- func HandlerHelm(logger log.Logger, skinIO mcuser.TextureIO) http.HandlerFunc
- type ImageType
- type McSkin
- func (skin *McSkin) GetArmorBody() error
- func (skin *McSkin) GetArmorBust() error
- func (skin *McSkin) GetBody() error
- func (skin *McSkin) GetBust() error
- func (skin *McSkin) GetCube() error
- func (skin *McSkin) GetCubeHelm() error
- func (skin *McSkin) GetHead() error
- func (skin *McSkin) GetHelm() error
- func (skin *McSkin) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (skin *McSkin) WritePNG(w io.Writer) error
- func (skin *McSkin) WriteSVG(w io.Writer) error
- func (skin *McSkin) WriteSkin(w io.Writer) error
Constants ¶
const ( HeadX = 8 HeadY = 8 HeadWidth = 8 HeadHeight = 8 HelmX = 40 HelmY = 8 TorsoX = 20 TorsoY = 20 TorsoWidth = 8 TorsoHeight = 12 Torso2X = 20 Torso2Y = 36 RaX = 44 RaY = 20 RaWidth = 4 RaHeight = 12 Ra2X = 44 Ra2Y = 36 RlX = 4 RlY = 20 RlWidth = 4 RlHeight = 12 Rl2X = 4 Rl2Y = 36 LaX = 36 LaY = 52 LaWidth = 4 LaHeight = 12 La2X = 52 La2Y = 52 LlX = 20 LlY = 52 LlWidth = 4 LlHeight = 12 Ll2X = 4 Ll2Y = 52 // The height of the 'bust' relative to the width of the body (16) BustHeight = 16 )
const ( DefaultWidth = int(180) MinWidth = int(8) MaxWidth = int(300) )
Set the default, min and max width to resize processed images to
Variables ¶
This section is empty.
Functions ¶
func HandlerArmorBody ¶
Will deliver a Body with Armor when ServeHTTP is called
func HandlerArmorBust ¶
Will deliver a Bust with Armor when ServeHTTP is called
func HandlerBody ¶
Will deliver a Body when ServeHTTP is called
func HandlerBust ¶
Will deliver a Bust when ServeHTTP is called
func HandlerCube ¶
Will deliver an isometric "Cube" avatar when ServeHTTP is called
func HandlerCubeHelm ¶
Will deliver an isometric "Cube" with Helm when ServeHTTP is called
func HandlerHead ¶
Will deliver an avatar Head when ServeHTTP is called
func HandlerHelm ¶
Will deliver a head with Helm when ServeHTTP is called
Types ¶
type ImageType ¶
type ImageType string
func GetImageType ¶
GetImageType checks for specific extensions, otherwise uses PNG
type McSkin ¶
type McSkin struct { minecraft.Skin Processed image.Image Processor func() error Type ImageType Width int }
func NewMcSkinFromRequest ¶
Create a McSkin for manual usage (vs. using the Handlers)
func (*McSkin) GetArmorBody ¶
Sets skin.Processed to a front render of the body but with any armor which the user has.
func (*McSkin) GetArmorBust ¶
Sets skin.Processed to the upper portion of the body (slightly higher cutoff than waist) but with any armor which the user has.
func (*McSkin) GetBust ¶
Sets skin.Processed to the upper portion of the body (slightly higher cutoff than waist).
func (*McSkin) GetCube ¶
Sets skin.Processed to an isometric render of the head from a top-left angle (showing 3 sides).
func (*McSkin) GetCubeHelm ¶
Sets skin.Processed to an isometric render of the head from a top-left angle (showing 3 sides).
func (*McSkin) ServeHTTP ¶
func (skin *McSkin) ServeHTTP(w http.ResponseWriter, r *http.Request)
The