image

package
v0.0.0-...-bae2323 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Data          []byte `json:"data"`
	Ext           string `json:"ext"`
	ID            string `json:"id"`
	MimeType      string `json:"type"`
	Name          string `json:"name"`
	Size          int64  `json:"size"`
	ConvertedFile string
	IsConverted   bool
	Image         image.Image
	Runtime       *wails.Runtime
}

File represents an image file.

func (*File) Decode

func (f *File) Decode() error

Decode decodes the file's data based on its mime type.

func (*File) GetConvertedSize

func (f *File) GetConvertedSize() (int64, error)

GetConvertedSize returns the size of the converted file.

func (*File) GetSavings

func (f *File) GetSavings() (int64, error)

GetSavings returns the delta between original and converted file size.

func (*File) Write

func (f *File) Write(c *config.Config) error

Write saves a file to disk based on the encoding target.

type FileManager

type FileManager struct {
	Files []*File

	Runtime *wails.Runtime
	Logger  *wails.CustomLogger
	// contains filtered or unexported fields
}

FileManager handles collections of Files for conversion.

func NewFileManager

func NewFileManager(c *config.Config, s *stat.Stat) *FileManager

NewFileManager creates a new FileManager.

func (*FileManager) Clear

func (fm *FileManager) Clear()

Clear removes the files in the FileManager.

func (*FileManager) Convert

func (fm *FileManager) Convert() (errs []error)

Convert runs the conversion on all files in the FileManager.

func (*FileManager) Delete

func (fm *FileManager) Delete()

func (*FileManager) HandleFile

func (fm *FileManager) HandleFile(fileJson string) (err error)

HandleFile processes a file from the client.

func (*FileManager) OpenFile

func (fm *FileManager) OpenFile(p string) error

OpenFile opens the file at the given filepath using the file's native file application.

func (*FileManager) WailsInit

func (fm *FileManager) WailsInit(runtime *wails.Runtime) error

WailsInit performs setup when Wails is ready.

type SubImager

type SubImager interface {
	SubImage(r image.Rectangle) image.Image
}

SubImager handles creating a subimage from an image rect.

Jump to

Keyboard shortcuts

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