Documentation ¶
Overview ¶
Package pvrz provides functionality to deal with data of the PVR and PVRZ formats. It has been optimized for use in Enhanced Edition games based on the Infinity Engine.
Index ¶
- Constants
- Variables
- type Pvr
- func (p *Pvr) ClearError()
- func (p *Pvr) Error() error
- func (p *Pvr) FillImageRect(r image.Rectangle, col color.Color)
- func (p *Pvr) GetChannelType() int
- func (p *Pvr) GetColorSpace() int
- func (p *Pvr) GetHeight() int
- func (p *Pvr) GetImage() image.Image
- func (p *Pvr) GetImageRect(r image.Rectangle) image.Image
- func (p *Pvr) GetPixelType() int
- func (p *Pvr) GetQuality() int
- func (p *Pvr) GetWeightByAlpha() bool
- func (p *Pvr) GetWidth() int
- func (p *Pvr) IsPerceptiveMetric() bool
- func (p *Pvr) Save(w io.Writer, compress bool)
- func (p *Pvr) SetChannelType(channelType int)
- func (p *Pvr) SetColorSpace(colorSpace int)
- func (p *Pvr) SetDimension(width, height int, preserve bool)
- func (p *Pvr) SetImage(img image.Image)
- func (p *Pvr) SetImageRect(img image.Image, r image.Rectangle, dp image.Point)
- func (p *Pvr) SetPerceptiveMetric(set bool)
- func (p *Pvr) SetPixelType(pixelType int)
- func (p *Pvr) SetQuality(q int)
- func (p *Pvr) SetWeightByAlpha(set bool)
Constants ¶
const ( // Supported texture flags FLAGS_PREMULTIPLIED = 2 // Whether texture pixels are premultiplied by alpha // Supported compression type TYPE_BC1 = 7 // aka DXT1, full decoding and encoding support TYPE_BC2 = 9 // aka DXT3, full decoding and encoding support TYPE_BC3 = 11 // aka DXT5, full decoding and encoding support // Available color space constants SPACE_LRGB = 0 // linear RGB space (default) SPACE_SRGB = 1 // standard RGB space // Available channel types CHAN_UBN = 0 // Unsigned Byte Normalized (default) CHAN_SBN = 1 // Signed Byte Normalized CHAN_UB = 2 // Unsigned Byte CHAN_SB = 3 // Signed Byte // Available pixel encoding quality modes QUALITY_LOW = 0 // Encode with lowest possible quality QUALITY_DEFAULT = 1 // Encode with a sensible quality/speed ratio QUALITY_HIGH = 2 // Encoed with highest possiblle quality )
Variables ¶
var ErrIllegalArguments = errors.New("Illegal arguments specified")
Functions ¶
This section is empty.
Types ¶
type Pvr ¶
type Pvr struct {
// contains filtered or unexported fields
}
The main PVR structure.
func CreateNew ¶
CreateNew initializes a new Pvr object with an empty pixel buffer of specified dimension.
pixelType defines the pixel compression type applied when using the Save() function.
Note: It is strongly recommended to use a dimension that is compatible with the desired pixel compression.
func (*Pvr) ClearError ¶
func (p *Pvr) ClearError()
ClearError clears the error state from the last Pvr operation. Must be called for subsequent operations to work correctly.
func (*Pvr) Error ¶
Error returns the error state of the most recent operation on Pvr. Use ClearError() function to clear the current error state.
func (*Pvr) FillImageRect ¶
FillImageRect fills the region "r" of the texture with the specified color.
func (*Pvr) GetChannelType ¶
GetChannelType returns the size of individual pixel elements (r, g, b, a). Currently only byte-sized channel types are supported (see CHAN_xxx constants).
func (*Pvr) GetColorSpace ¶
GetColorSpace returns the color space used to represent pixel data. (see SPACE_xxx constants).
func (*Pvr) GetImageRect ¶
GetImageRect returns the content of the texture in the specified region as a new Image object.
func (*Pvr) GetPixelType ¶
GetPixelType returns the currently assigned pixel compression type applied when using the Save() function.
func (*Pvr) GetQuality ¶
GetQuality returns the quality mode applied to pixel compression (see QUALITY_xxx constants).
func (*Pvr) GetWeightByAlpha ¶
GetWeightByAlpha indicates whether pixel values are weighted by their alpha component when performing compression.
func (*Pvr) IsPerceptiveMetric ¶
IsPerceptiveMetric returns whether a perceptive metric is applied to pixel compression.
func (*Pvr) Save ¶
Save sends PVR data to the specified Writer.
Specify "compress" whether to write uncompressed PVR or compressed PVRZ data through the Writer. Note: Output texture dimension may be padded to meet pixel encoding requirements.
func (*Pvr) SetChannelType ¶
SetChannelType defines the size of individual pixel elements (r, g, b, a). Currently only byte-sized channel types are supported (see CHAN_xxx constants).
func (*Pvr) SetColorSpace ¶
SetColorSpace defines the the color space used to represent pixel data. (see SPACE_xxx constants).
func (*Pvr) SetDimension ¶
SetDimension can be used to resize the current pixel buffer. Specify "preserve" to preserve as much of old content if possible.
func (*Pvr) SetImage ¶
SetImage replaces the current texture graphics with the specified image data.
Note: It is strongly recommended to use images with dimensions supported by the desired pixel encoding type.
func (*Pvr) SetImageRect ¶
SetImageRect draws the content of "img" limited by the region "r" to the texture starting at position "dp".
func (*Pvr) SetPerceptiveMetric ¶
SetPerceptiveMetric defines whether a perceptive metric is applied to pixel compression.
func (*Pvr) SetPixelType ¶
SetPixelType sets the pixel compression type that is applied when using the Save() function.
func (*Pvr) SetQuality ¶
SetQuality defines the quality mode applied to pixel compression. Use one of the QUALITY_xxx constants.
func (*Pvr) SetWeightByAlpha ¶
SetWeightByAlpha defines whether pixel values are weighted by their alpha component when performing compression.