constants

package
v0.0.0-...-a4a601d Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: GPL-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Rle = iota
	Rle16
)

Variables

View Source
var (
	OrderedDither        = DitheringType{"Ordered"}
	ErrorDiffusionDither = DitheringType{"ErrorDiffusion"}
)
View Source
var (
	Mode0         = Size{Width: 160, Height: 200, LinesNumber: 200, ColumnsNumber: 20, ColorsAvailable: 16, GatearrayValue: 0x9c}
	Mode1         = Size{Width: 320, Height: 200, LinesNumber: 200, ColumnsNumber: 40, ColorsAvailable: 4, GatearrayValue: 0x9d}
	Mode2         = Size{Width: 640, Height: 200, LinesNumber: 200, ColumnsNumber: 80, ColorsAvailable: 2, GatearrayValue: 0x9e}
	OverscanMode0 = Size{Width: 192, Height: 272, LinesNumber: 272, ColumnsNumber: 96, ColorsAvailable: 16}
	OverscanMode1 = Size{Width: 384, Height: 272, LinesNumber: 272, ColumnsNumber: 96, ColorsAvailable: 4}
	OverscanMode2 = Size{Width: 768, Height: 272, LinesNumber: 272, ColumnsNumber: 96, ColorsAvailable: 2}
	SelfMode      = Size{}
	WidthMax      = 768
	HeightMax     = 272
)
View Source
var (
	White         = CpcColor{HardwareNumber: 0, FirmwareNumber: 13, HardwareValues: []uint8{0x40, 0x41}, Color: color.RGBA{A: 0xFF, R: 111, G: 125, B: 107}}
	SeaGreen      = CpcColor{HardwareNumber: 2, FirmwareNumber: 19, HardwareValues: []uint8{0x42, 0x51}, Color: color.RGBA{A: 0xFF, R: 0, G: 243, B: 107}}
	PastelYellow  = CpcColor{HardwareNumber: 3, FirmwareNumber: 25, HardwareValues: []uint8{0x43, 0x49}, Color: color.RGBA{A: 0xFF, R: 244, G: 244, B: 109}}
	Blue          = CpcColor{HardwareNumber: 4, FirmwareNumber: 1, HardwareValues: []uint8{0x44, 0x50}, Color: color.RGBA{A: 0xFF, R: 0, G: 2, B: 107}}
	Purple        = CpcColor{HardwareNumber: 5, FirmwareNumber: 7, HardwareValues: []uint8{0x45, 0x48}, Color: color.RGBA{A: 0xFF, R: 241, G: 2, B: 104}}
	Cyan          = CpcColor{HardwareNumber: 6, FirmwareNumber: 10, HardwareValues: []uint8{0x46}, Color: color.RGBA{A: 0xFF, R: 0, G: 120, B: 104}}
	Pink          = CpcColor{HardwareNumber: 7, FirmwareNumber: 16, HardwareValues: []uint8{0x47}, Color: color.RGBA{A: 0xFF, R: 243, G: 125, B: 107}}
	BrightYellow  = CpcColor{HardwareNumber: 10, FirmwareNumber: 24, HardwareValues: []uint8{0x4A}, Color: color.RGBA{A: 0xFF, R: 244, G: 244, B: 13}}
	BrightWhite   = CpcColor{HardwareNumber: 11, FirmwareNumber: 26, HardwareValues: []uint8{0x4B}, Color: color.RGBA{A: 0xFF, R: 255, G: 244, B: 250}}
	BrightRed     = CpcColor{HardwareNumber: 12, FirmwareNumber: 6, HardwareValues: []uint8{0x4C}, Color: color.RGBA{A: 0xFF, R: 244, G: 5, B: 6}}
	BrightMagenta = CpcColor{HardwareNumber: 13, FirmwareNumber: 8, HardwareValues: []uint8{0x4D}, Color: color.RGBA{A: 0xFF, R: 243, G: 2, B: 245}}
	Orange        = CpcColor{HardwareNumber: 14, FirmwareNumber: 15, HardwareValues: []uint8{0x4E}, Color: color.RGBA{A: 0xFF, R: 243, G: 125, B: 13}}
	PastelMagenta = CpcColor{HardwareNumber: 15, FirmwareNumber: 17, HardwareValues: []uint8{0x4F}, Color: color.RGBA{A: 0xFF, R: 251, G: 125, B: 250}}
	BrightGreen   = CpcColor{HardwareNumber: 18, FirmwareNumber: 18, HardwareValues: []uint8{0x52}, Color: color.RGBA{A: 0xFF, R: 2, G: 241, B: 1}}
	BrightCyan    = CpcColor{HardwareNumber: 19, FirmwareNumber: 20, HardwareValues: []uint8{0x53}, Color: color.RGBA{A: 0xFF, R: 15, G: 243, B: 242}}
	Black         = CpcColor{HardwareNumber: 20, FirmwareNumber: 0, HardwareValues: []uint8{0x54}, Color: color.RGBA{A: 0xFF, R: 0, G: 2, B: 1}}
	BrightBlue    = CpcColor{HardwareNumber: 21, FirmwareNumber: 2, HardwareValues: []uint8{0x55}, Color: color.RGBA{A: 0xFF, R: 12, G: 2, B: 245}}
	Green         = CpcColor{HardwareNumber: 22, FirmwareNumber: 9, HardwareValues: []uint8{0x56}, Color: color.RGBA{A: 0xFF, R: 2, G: 120, B: 1}}
	SkyBlue       = CpcColor{HardwareNumber: 23, FirmwareNumber: 11, HardwareValues: []uint8{0x57}, Color: color.RGBA{A: 0xFF, R: 12, G: 123, B: 245}}
	Magenta       = CpcColor{HardwareNumber: 24, FirmwareNumber: 4, HardwareValues: []uint8{0x58}, Color: color.RGBA{A: 0xFF, R: 106, G: 2, B: 104}}
	PastelGreen   = CpcColor{HardwareNumber: 25, FirmwareNumber: 22, HardwareValues: []uint8{0x59}, Color: color.RGBA{A: 0xFF, R: 113, G: 243, B: 107}}
	Lime          = CpcColor{HardwareNumber: 26, FirmwareNumber: 21, HardwareValues: []uint8{0x5A}, Color: color.RGBA{A: 0xFF, R: 113, G: 243, B: 4}}
	PastelCyan    = CpcColor{HardwareNumber: 27, FirmwareNumber: 23, HardwareValues: []uint8{0x5B}, Color: color.RGBA{A: 0xFF, R: 113, G: 243, B: 245}}
	Red           = CpcColor{HardwareNumber: 28, FirmwareNumber: 3, HardwareValues: []uint8{0x5C}, Color: color.RGBA{A: 0xFF, R: 108, G: 2, B: 1}}
	Mauve         = CpcColor{HardwareNumber: 29, FirmwareNumber: 5, HardwareValues: []uint8{0x5D}, Color: color.RGBA{A: 0xFF, R: 108, G: 2, B: 242}}
	Yellow        = CpcColor{HardwareNumber: 30, FirmwareNumber: 12, HardwareValues: []uint8{0x5E}, Color: color.RGBA{A: 0xFF, R: 111, G: 123, B: 1}}
	PastelBlue    = CpcColor{HardwareNumber: 31, FirmwareNumber: 14, HardwareValues: []uint8{0x5F}, Color: color.RGBA{A: 0xFF, R: 111, G: 125, B: 247}}
	NotColor      = CpcColor{}
)

values 50% RGB = 0x7F values 100% RGB = 0xFF

View Source
var CpcOldPalette = color.Palette{White.Color,
	SeaGreen.Color,
	PastelYellow.Color,
	Blue.Color,
	Purple.Color,
	Cyan.Color,
	Pink.Color,
	BrightYellow.Color,
	BrightWhite.Color,
	BrightRed.Color,
	BrightMagenta.Color,
	Orange.Color,
	PastelMagenta.Color,
	BrightGreen.Color,
	BrightCyan.Color,
	Black.Color,
	BrightBlue.Color,
	Green.Color,
	SkyBlue.Color,
	Magenta.Color,
	PastelGreen.Color,
	Lime.Color,
	PastelCyan.Color,
	Red.Color,
	Mauve.Color,
	Yellow.Color,
	PastelBlue.Color,
}
View Source
var CpcPlusPalette = NewCpcPlusPalette()
View Source
var DistanceMax int64 = 584970
View Source
var (
	ErrorCpcColorNotFound = errors.New("cpc color not found")
)

Functions

func CToF

func CToF(c uint32) float64

func ColorDistance2

func ColorDistance2(c1, c2 color.Color) int64

func ColorFromHardware

func ColorFromHardware(c uint8) (color.Color, error)

nolint: funlen

func ColorsAreEquals

func ColorsAreEquals(c1, c2 color.Color) bool

func ColorsDistance

func ColorsDistance(c1, c2 color.Color) float64

from website https://www.compuphase.com/cmetric.htm

func CpcColorStringFromHardwareNumber

func CpcColorStringFromHardwareNumber(c uint8) string

nolint: funlen

func FillColorPalette

func FillColorPalette(p color.Palette) color.Palette

func FirmwareNumber

func FirmwareNumber(c color.Color) (int, error)

func FlashColorQuotient

func FlashColorQuotient(c1, c2 CpcColor) float64

func HardwareNumber

func HardwareNumber(c color.Color) (int, error)

func HardwareValueAreEquals

func HardwareValueAreEquals(hv []uint8, val uint8) bool

func HardwareValues

func HardwareValues(c color.Color) ([]uint8, error)

func NewColorCpcPlusColor

func NewColorCpcPlusColor(c CpcPlusColor) color.Color

func NewCpcPlusPalette

func NewCpcPlusPalette() color.Palette

func SortColorsByDistance

func SortColorsByDistance(p color.Palette) color.Palette

Types

type ByDistance

type ByDistance []color.Color

func (ByDistance) Len

func (p ByDistance) Len() int

func (ByDistance) Less

func (p ByDistance) Less(i, j int) bool

func (ByDistance) Swap

func (p ByDistance) Swap(i, j int)

type ByOccurence

type ByOccurence []ColorReducer

func (ByOccurence) Len

func (b ByOccurence) Len() int

func (ByOccurence) Less

func (b ByOccurence) Less(i, j int) bool

func (ByOccurence) Swap

func (b ByOccurence) Swap(i, j int)

type ColorReducer

type ColorReducer struct {
	C         color.Color
	Occurence int
	Distances map[color.Color]float64
}

func NewColorReducer

func NewColorReducer(c color.Color, occ int) ColorReducer

type CpcColor

type CpcColor struct {
	HardwareNumber int
	HardwareValues []uint8
	FirmwareNumber int
	Color          color.RGBA
}

func CpcColorFromHardwareNumber

func CpcColorFromHardwareNumber(c int) (CpcColor, error)

nolint: funlen

func (CpcColor) ToString

func (c CpcColor) ToString() string

type CpcPlusColor

type CpcPlusColor struct {
	G uint8
	R uint8
	B uint8
}

func NewCpcPlusColor

func NewCpcPlusColor(c color.Color) CpcPlusColor

func NewRawCpcPlusColor

func NewRawCpcPlusColor(v uint16) *CpcPlusColor

func (*CpcPlusColor) Bytes

func (c *CpcPlusColor) Bytes() []byte

func (*CpcPlusColor) ToString

func (c *CpcPlusColor) ToString() string

func (*CpcPlusColor) Value

func (c *CpcPlusColor) Value() uint16

type DitheringType

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

type PaletteReducer

type PaletteReducer struct {
	Cs []ColorReducer
}

func NewPaletteReducer

func NewPaletteReducer() *PaletteReducer

func (*PaletteReducer) ComputeDistances

func (p *PaletteReducer) ComputeDistances()

func (*PaletteReducer) OccurencesSort

func (p *PaletteReducer) OccurencesSort()

func (*PaletteReducer) Reduce

func (pr *PaletteReducer) Reduce(nbColors int) color.Palette

type Size

type Size struct {
	Width           int
	Height          int
	LinesNumber     int
	ColumnsNumber   int
	ColorsAvailable int
	GatearrayValue  uint8
}

func NewSize

func NewSize(mode uint8) Size

func NewSizeMode

func NewSizeMode(mode uint8, overscan bool) Size

func (*Size) ModeWidth

func (s *Size) ModeWidth(mode uint8) int

func (*Size) ToString

func (s *Size) ToString() string

type SplitRaster

type SplitRaster struct {
	Offset        uint16
	Length        int
	Occurence     int
	HardwareColor []int
	PaletteIndex  []int
}

func NewSpliteRaster

func NewSpliteRaster(offset uint16, length, occurence int) SplitRaster

func (*SplitRaster) Add

func (s *SplitRaster) Add(paletteIndex, hardwareColor int) bool

func (*SplitRaster) Boundaries

func (s *SplitRaster) Boundaries() (uint16, uint16)

type SplitRasterScreen

type SplitRasterScreen struct {
	Values []SplitRaster
}

func NewSplitRasterScreen

func NewSplitRasterScreen() *SplitRasterScreen

func (*SplitRasterScreen) Add

func (srs *SplitRasterScreen) Add(s SplitRaster) bool

func (*SplitRasterScreen) IsFull

func (srs *SplitRasterScreen) IsFull() bool

Jump to

Keyboard shortcuts

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