xcolor

package module
v0.0.0-...-3930b03 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: BSD-3-Clause Imports: 1 Imported by: 0

README

ximage/xcolor - extended color types

go get "tawesoft.co.uk/go/"
import "tawesoft.co.uk/go/ximage/xcolor"
Links License Stable?
homedocssrc BSD-3-Clause ✔ yes

About

Package xcolor implements Red, RedGreen, and RGB color models matching the core image/color interface.

Note that there are good reasons these color types aren't in the core image.color package. The native color types may have optimized fast-paths for many use cases.

This package is a tradeoff of these optimizations against lower memory usage. This package is intended to be used in computer graphics (e.g. OpenGL) where images are uploaded to the GPU in a specific format (such as GL_R, GL_RG, or GL_RGB) and we don't care about the performance of native Go image manipulation.

OpenGL® and the oval logo are trademarks or registered trademarks of Hewlett Packard Enterprise in the United States and/or other countries worldwide.

Getting Help

This package is part of tawesoft.co.uk/go, a monorepo for small Go modules maintained by Tawesoft®. Check out that URL for more information about other Go modules from Tawesoft plus community and commercial support options.

Documentation

Overview

Package xcolor implements Red, RedGreen, and RGB color models matching the core image/color interface.

Note that there are good reasons these color types aren't in the core image.color package. The native color types may have optimized fast-paths for many use cases.

This package is a tradeoff of these optimizations against lower memory usage. This package is intended to be used in computer graphics (e.g. OpenGL) where images are uploaded to the GPU in a specific format (such as GL_R, GL_RG, or GL_RGB) and we don't care about the performance of native Go image manipulation.

OpenGL® and the oval logo are trademarks or registered trademarks of Hewlett Packard Enterprise in the United States and/or other countries worldwide.

Package Information

License: BSD-3-Clause (see LICENSE.txt)

Stable: yes

For more information, documentation, source code, examples, support, links, etc. please see https://www.tawesoft.co.uk/go and https://www.tawesoft.co.uk/go/ximage/xcolor

Index

Constants

This section is empty.

Variables

View Source
var RGBModel color.Model = color.ModelFunc(rgbModel)
View Source
var RGModel color.Model = color.ModelFunc(func(c color.Color) color.Color {
	if _, ok := c.(color.RGBA); ok {
		return c
	}
	r, g, _, _ := c.RGBA()
	return RG{uint8(r >> 8), uint8(g >> 8)}
})
View Source
var RedModel color.Model = color.ModelFunc(redModel)

Functions

This section is empty.

Types

type RG

type RG struct {
	R uint8
	G uint8
}

Red represents an 8-bit Red 8-bit Green color.

func (RG) RGBA

func (c RG) RGBA() (r, g, b, a uint32)

type RGB

type RGB struct {
	R uint8
	G uint8
	B uint8
}

RGB represents an 8-bit Red 8-bit Green 8-bit Blue color.

func (RGB) RGBA

func (c RGB) RGBA() (r, g, b, a uint32)

type Red

type Red struct {
	R uint8
}

Red represents an 8-bit red color.

func (Red) RGBA

func (c Red) RGBA() (r, g, b, a uint32)

Jump to

Keyboard shortcuts

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