Gradient

package
v0.0.0-...-80877a9 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package Gradient provides methods for working with Gradient object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsGradient() Instance
}

type ColorSpace

type ColorSpace = gdclass.GradientColorSpace //gd:Gradient.ColorSpace
const (
	/*sRGB color space.*/
	GradientColorSpaceSrgb ColorSpace = 0
	/*Linear sRGB color space.*/
	GradientColorSpaceLinearSrgb ColorSpace = 1
	/*[url=https://bottosson.github.io/posts/oklab/]Oklab[/url] color space. This color space provides a smooth and uniform-looking transition between colors.*/
	GradientColorSpaceOklab ColorSpace = 2
)

type Instance

type Instance [1]gdclass.Gradient

This resource describes a color transition by defining a set of colored points and how to interpolate between them. See also [Curve] which supports more complex easing methods, but does not support colors.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddPoint

func (self Instance) AddPoint(offset Float.X, color Color.RGBA)

Adds the specified color to the gradient, with the specified offset.

func (Instance) AsGradient

func (self Instance) AsGradient() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) Colors

func (self Instance) Colors() []Color.RGBA

func (Instance) GetColor

func (self Instance) GetColor(point int) Color.RGBA

Returns the color of the gradient color at index [param point].

func (Instance) GetOffset

func (self Instance) GetOffset(point int) Float.X

Returns the offset of the gradient color at index [param point].

func (Instance) GetPointCount

func (self Instance) GetPointCount() int

Returns the number of colors in the gradient.

func (Instance) InterpolationColorSpace

func (self Instance) InterpolationColorSpace() gdclass.GradientColorSpace

func (Instance) InterpolationMode

func (self Instance) InterpolationMode() gdclass.GradientInterpolationMode

func (Instance) Offsets

func (self Instance) Offsets() []float32

func (Instance) RemovePoint

func (self Instance) RemovePoint(point int)

Removes the color at index [param point].

func (Instance) Reverse

func (self Instance) Reverse()

Reverses/mirrors the gradient. [b]Note:[/b] This method mirrors all points around the middle of the gradient, which may produce unexpected results when [member interpolation_mode] is set to [constant GRADIENT_INTERPOLATE_CONSTANT].

func (Instance) Sample

func (self Instance) Sample(offset Float.X) Color.RGBA

Returns the interpolated color specified by [param offset].

func (Instance) SetColor

func (self Instance) SetColor(point int, color Color.RGBA)

Sets the color of the gradient color at index [param point].

func (Instance) SetColors

func (self Instance) SetColors(value []Color.RGBA)

func (Instance) SetInterpolationColorSpace

func (self Instance) SetInterpolationColorSpace(value gdclass.GradientColorSpace)

func (Instance) SetInterpolationMode

func (self Instance) SetInterpolationMode(value gdclass.GradientInterpolationMode)

func (Instance) SetOffset

func (self Instance) SetOffset(point int, offset Float.X)

Sets the offset for the gradient color at index [param point].

func (Instance) SetOffsets

func (self Instance) SetOffsets(value []float32)

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type InterpolationMode

type InterpolationMode = gdclass.GradientInterpolationMode //gd:Gradient.InterpolationMode
const (
	/*Linear interpolation.*/
	GradientInterpolateLinear InterpolationMode = 0
	/*Constant interpolation, color changes abruptly at each point and stays uniform between. This might cause visible aliasing when used for a gradient texture in some cases.*/
	GradientInterpolateConstant InterpolationMode = 1
	/*Cubic interpolation.*/
	GradientInterpolateCubic InterpolationMode = 2
)

Jump to

Keyboard shortcuts

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