Documentation ¶
Overview ¶
Package ximage implements Red, RG, and RGB images matching the core image interface.
Note that there are good reasons these image types aren't in the core image package. The native image 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 too much 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.
See also: ximage/xcolor (https://tawesoft.co.uk/go/ximage/xcolor)
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
Index ¶
- type RG
- func (p *RG) At(x, y int) color.Color
- func (p *RG) Bounds() image.Rectangle
- func (p *RG) ColorModel() color.Model
- func (p *RG) Opaque() bool
- func (p *RG) PixOffset(x, y int) int
- func (p *RG) RGAt(x, y int) xcolor.RG
- func (p *RG) Set(x, y int, c color.Color)
- func (p *RG) SetRG(x, y int, c xcolor.RG)
- func (p *RG) SubImage(r image.Rectangle) image.Image
- type RGB
- func (p *RGB) At(x, y int) color.Color
- func (p *RGB) Bounds() image.Rectangle
- func (p *RGB) ColorModel() color.Model
- func (p *RGB) Opaque() bool
- func (p *RGB) PixOffset(x, y int) int
- func (p *RGB) RGBAt(x, y int) xcolor.RGB
- func (p *RGB) Set(x, y int, c color.Color)
- func (p *RGB) SetRGB(x, y int, c xcolor.RGB)
- func (p *RGB) SubImage(r image.Rectangle) image.Image
- type Red
- func (p *Red) At(x, y int) color.Color
- func (p *Red) Bounds() image.Rectangle
- func (p *Red) ColorModel() color.Model
- func (p *Red) Opaque() bool
- func (p *Red) PixOffset(x, y int) int
- func (p *Red) RedAt(x, y int) xcolor.Red
- func (p *Red) Set(x, y int, c color.Color)
- func (p *Red) SetRed(x, y int, c xcolor.Red)
- func (p *Red) SubImage(r image.Rectangle) image.Image
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RG ¶
type RG struct { // Pix holds the image's pixels, as Red values. The pixel at // (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*2]. Pix []uint8 // Stride is the Pix stride (in bytes) between vertically adjacent pixels. Stride int // Rect is the image's bounds. Rect image.Rectangle }
RG is an in-memory image whose At method returns color.RG values.
func (*RG) ColorModel ¶
type RGB ¶
type RGB struct { // Pix holds the image's pixels, as Red values. The pixel at // (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*2]. Pix []uint8 // Stride is the Pix stride (in bytes) between vertically adjacent pixels. Stride int // Rect is the image's bounds. Rect image.Rectangle }
RGB is an in-memory image whose At method returns color.RGB values.
func (*RGB) ColorModel ¶
type Red ¶
type Red struct { // Pix holds the image's pixels, as Red values. The pixel at // (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*1]. Pix []uint8 // Stride is the Pix stride (in bytes) between vertically adjacent pixels. Stride int // Rect is the image's bounds. Rect image.Rectangle }
Red is an in-memory image whose At method returns color.Red values.