utility

package
v0.0.0-...-0290392 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color struct {
	Red, Green, Blue, Alpha uint8
}

Represents an RGBA color

func ColorFromNormalizedVec3

func ColorFromNormalizedVec3(vector Vec3) Color

Convert a normalized Vec3 into a fully opaque color

func (*Color) AsNormalizedVec3

func (c *Color) AsNormalizedVec3() Vec3

Normalize the color and return it as a Vec3

type PngImage

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

Contains all functionality needed to export raw RGBA pixel data as a .png file

func NewPngImage

func NewPngImage(width int, height int, fileName string) PngImage

Create a new output image

func (*PngImage) SetPixelColor

func (p *PngImage) SetPixelColor(x int, y int, color Color)

Assign the specified pixel red, green, and blue components. Each pixel is assumed to use the RGBA uint8 color format. A color can be defined by specifying a value between 0 and 255 (inclusive) for each color component.

func (*PngImage) WritePngToFile

func (p *PngImage) WritePngToFile() error

Write the PNG image to a file on disk

Jump to

Keyboard shortcuts

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