Documentation ¶
Overview ¶
Package application provides access to application resources. Image assets must be in the app's .xcassets file (iOS) or res/drawable folder (Android). Disable "Compress PNG Files" and "Remove Text Metadata from PNG Files" in Xcode if loading image resources is not working. Android does not allow uppercase image names or folders and this restriction carries over to Matcha as well.
// Display an image. img, err := application.LoadImage("example") if err != nil { imageview.Image = img } // or imageview.Image = application.MustLoadImage("example")
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ImageResource ¶
type ImageResource struct {
// contains filtered or unexported fields
}
ImageResource represents a static image asset and implements the image.Image interface.
func LoadImage ¶
func LoadImage(path string) (*ImageResource, error)
MustLoadImage loads the image at path.
func MustLoadImage ¶
func MustLoadImage(path string) *ImageResource
MustLoadImage loads the image at path, or panics on error.
func (*ImageResource) At ¶
func (res *ImageResource) At(x, y int) color.Color
At implements the image.Image interface.
func (*ImageResource) Bounds ¶
func (res *ImageResource) Bounds() image.Rectangle
Bounds implements the image.Image interface.
func (*ImageResource) ColorModel ¶
func (res *ImageResource) ColorModel() color.Model
ColorModel implements the image.Image interface.
func (*ImageResource) MarshalProtobuf ¶
func (res *ImageResource) MarshalProtobuf() *env.ImageResource
MarshalProtobuf encodes res into a Protobuf object.
func (*ImageResource) Path ¶
func (res *ImageResource) Path() string
Path returns the path to the image.
func (*ImageResource) Scale ¶
func (res *ImageResource) Scale() float64
Scale returns the scale factor of the image.