1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

Create tool for converting images to compatible console logo files

The tool processes an image and converts it to a logo.Image struct which
can be assigned to a logo-capable console.
This commit is contained in:
Achilleas Anagnostopoulos
2017-07-13 07:51:08 +01:00
parent 99977294aa
commit a5c6828fc2
2 changed files with 239 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
// Package logo contains logos that can be used with a framebuffer console.
package logo
import "image/color"
// ConsoleLogo defines the logo used by framebuffer consoles. If set to nil
// then no logo will be displayed.
var ConsoleLogo *Image
// Alignment defines the supported horizontal alignments for a console logo.
type Alignment uint8
const (
// AlignLeft aligns the logo to the left side of the console.
AlignLeft Alignment = iota
// AlignCenter aligns the logo to the center of the console.
AlignCenter
// AlignRight aligns the logo to the right side of the console.
AlignRight
)
// Image describes an 8bpp image with
type Image struct {
// The width and height of the logo in pixels.
Width uint32
Height uint32
// Align specifies the horizontal alignment for the logo.
Align Alignment
// TransparentIndex defines a color index that will be treated as
// transparent when drawing the logo.
TransparentIndex uint8
// The palette for the logo. The console remaps the palette
// entries to the end of its own palette.
Palette []color.RGBA
// The logo data comprises of Width*Height bytes where each byte
// represents an index in the logo palette.
Data []uint8
}