scaling

package
v0.0.0-...-0518d83 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The source is not scaled.
	None = Scaling(iota)

	// Scales the source to fit the target while keeping the same aspect ratio. This may cause the source to be smaller than the
	// target in one direction.
	Fit

	// Scales the source to fill the target while keeping the same aspect ratio. This may cause the source to be larger than the
	// target in one direction.
	Fill

	// Scales the source to fill the target in the x direction while keeping the same aspect ratio. This may cause the source to be
	// smaller or larger than the target in the y direction.
	FillX

	// Scales the source to fill the target in the y direction while keeping the same aspect ratio. This may cause the source to be
	// smaller or larger than the target in the x direction.
	FillY

	// Scales the source to fill the target. This may cause the source to not keep the same aspect ratio.
	Stretch

	// Scales the source to fill the target in the x direction, without changing the y direction. This may cause the source to not
	// keep the same aspect ratio.
	StretchX

	// Scales the source to fill the target in the y direction, without changing the x direction. This may cause the source to not
	// keep the same aspect ratio.
	StretchY
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Scaling

type Scaling int

func (Scaling) Apply

func (s Scaling) Apply(sourceX, sourceY, targetX, targetY float32) vector.Vector2f

Returns the size of the source scaled to the target. Note the same Vector2 instance is always returned and should never be cached.

Jump to

Keyboard shortcuts

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