image

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package image is an embedded image component with support for jpg, png, bmp and tiff files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	/*
		NamedPropertiesMap maps user/application variables to properties of the component.
		This field is filled automatically by VerifyAndSetJSONData, then used in
		SetNamedProperties to determine whether a variable being passed in is relevant to this
		component.

		For example, map[string][]string{"photo": []string{"fileName"}} would indicate that
		the user specified variable "photo" will fill the Image property via an image file.
	*/
	NamedPropertiesMap map[string][]string
	// Image is the image to draw on the canvas.
	Image image.Image
	/*
		TopLeft is the coordinates of the top-left corner of the image relative to the
		top-left corner of the canvas.
	*/
	TopLeft image.Point
	// Width is the width to scale the image to.
	Width int
	// Height is the height to scale the image to.
	Height int
	// contains filtered or unexported fields
}

Component implements the Component interface for images.

func (Component) GetJSONFormat

func (component Component) GetJSONFormat() interface{}

GetJSONFormat returns the JSON structure of a image component.

func (Component) SetNamedProperties

func (component Component) SetNamedProperties(properties render.NamedProperties) (render.Component, error)

SetNamedProperties processes the named properties and sets them into the image properties.

func (Component) VerifyAndSetJSONData

func (component Component) VerifyAndSetJSONData(data interface{}) (render.Component, render.NamedProperties, error)

VerifyAndSetJSONData processes the data parsed from JSON and uses it to set image properties and fill the named properties map.

func (Component) Write

func (component Component) Write(canvas render.Canvas) (render.Canvas, error)

Write draws an image on the canvas.

Jump to

Keyboard shortcuts

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