scaling

package
v0.0.0-...-e7bc4dc Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2015 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 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 = iota

	// 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

	// The source is not scaled.
	None
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Scaling

type Scaling uint8

Various scaling types for fitting one rectangle into another.

func (Scaling) Apply

func (self Scaling) Apply(sourceWidth, sourceHeight, targetWidth, targetHeight float32) *Vector2

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