ximage

package module
v0.0.0-...-ec5d7de Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

README

ximage - extended image types

About

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.

Links License Stable?
homedocssrc BSD-3-Clause ✔ yes

Download

go get -u tawesoft.co.uk/go

Import

import tawesoft.co.uk/go/ximage

See Also:

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)

For license information, documentation, source code, support, links, etc. please see https://tawesoft.co.uk/go/ximage

This module is part of https://tawesoft.co.uk/go

Index

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 NewRG

func NewRG(r image.Rectangle) *RG

NewRG returns a new RG image with the given bounds.

func (*RG) At

func (p *RG) At(x, y int) color.Color

func (*RG) Bounds

func (p *RG) Bounds() image.Rectangle

func (*RG) ColorModel

func (p *RG) ColorModel() color.Model

func (*RG) Opaque

func (p *RG) Opaque() bool

Opaque scans the entire image and reports whether it is fully opaque.

func (*RG) PixOffset

func (p *RG) PixOffset(x, y int) int

PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).

func (*RG) RGAt

func (p *RG) RGAt(x, y int) xcolor.RG

func (*RG) Set

func (p *RG) Set(x, y int, c color.Color)

func (*RG) SetRG

func (p *RG) SetRG(x, y int, c xcolor.RG)

func (*RG) SubImage

func (p *RG) SubImage(r image.Rectangle) image.Image

SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.

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 NewRGB

func NewRGB(r image.Rectangle) *RGB

NewRGB returns a new RGB image with the given bounds.

func (*RGB) At

func (p *RGB) At(x, y int) color.Color

func (*RGB) Bounds

func (p *RGB) Bounds() image.Rectangle

func (*RGB) ColorModel

func (p *RGB) ColorModel() color.Model

func (*RGB) Opaque

func (p *RGB) Opaque() bool

Opaque scans the entire image and reports whether it is fully opaque.

func (*RGB) PixOffset

func (p *RGB) PixOffset(x, y int) int

PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).

func (*RGB) RGBAt

func (p *RGB) RGBAt(x, y int) xcolor.RGB

func (*RGB) Set

func (p *RGB) Set(x, y int, c color.Color)

func (*RGB) SetRGB

func (p *RGB) SetRGB(x, y int, c xcolor.RGB)

func (*RGB) SubImage

func (p *RGB) SubImage(r image.Rectangle) image.Image

SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.

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.

func NewRed

func NewRed(r image.Rectangle) *Red

NewRed returns a new Red image with the given bounds.

func (*Red) At

func (p *Red) At(x, y int) color.Color

func (*Red) Bounds

func (p *Red) Bounds() image.Rectangle

func (*Red) ColorModel

func (p *Red) ColorModel() color.Model

func (*Red) Opaque

func (p *Red) Opaque() bool

Opaque scans the entire image and reports whether it is fully opaque.

func (*Red) PixOffset

func (p *Red) PixOffset(x, y int) int

PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).

func (*Red) RedAt

func (p *Red) RedAt(x, y int) xcolor.Red

func (*Red) Set

func (p *Red) Set(x, y int, c color.Color)

func (*Red) SetRed

func (p *Red) SetRed(x, y int, c xcolor.Red)

func (*Red) SubImage

func (p *Red) SubImage(r image.Rectangle) image.Image

SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.

Directories

Path Synopsis
xcolor module

Jump to

Keyboard shortcuts

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