quadtreeImage

package
v0.0.0-...-4c8cea9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockSize  = 8
	ChildCount = 4
	MetaFile   = "meta"
)

Variables

This section is empty.

Functions

func Decode

func Decode(quadtreePath string, outputPath string, cfg *config.Config) (io.Reader, *map[string]io.Reader, error)

Decode decodes an encoded quadtree image and populates a quadtree with it

Types

type ArchiveMode

type ArchiveMode string
const (
	ArchiveModeGzip ArchiveMode = "gzip"
	ArchiveModeZip  ArchiveMode = "zip"
)

type ArchiveReader

type ArchiveReader struct {
	// contains filtered or unexported fields
}

ArchiveReader is an abstraction that allows reading several different compression algorithms.

func OpenArchiveReader

func OpenArchiveReader(name string) (*ArchiveReader, error)

OpenArchiveReader will open the archive file specified by name and return a reader.

func (*ArchiveReader) Files

func (r *ArchiveReader) Files() map[string]*[]byte

File returns the list of files contained in the archive.

func (*ArchiveReader) Open

func (r *ArchiveReader) Open(name string) (*[]byte, error)

Open opens the named file in the archive and returns a reader to it.

type ArchiveWriter

type ArchiveWriter struct {
	// contains filtered or unexported fields
}

ArchiveWriter is an abstraction that allows writing several different compression algorithms.

func NewArchiveWriter

func NewArchiveWriter(mode ArchiveMode, writer io.Writer) (*ArchiveWriter, error)

NewArchiveWriter creates a new archive writer for the archive type mode and configures it to write to writer.

func (*ArchiveWriter) Close

func (w *ArchiveWriter) Close() error

Close flushes the underlying archive to its writer.

func (*ArchiveWriter) WriteFile

func (w *ArchiveWriter) WriteFile(name string, reader io.Reader) error

WriteFile adds a file to the underlying archive and writes the contents of reader to it.

type QuadtreeElement

type QuadtreeElement struct {
	// contains filtered or unexported fields
}

QuadtreeElement represents a node in the quadtree that can either be the parent of ChildCount children or contain a block image

func NewQuadtreeElement

func NewQuadtreeElement(id string, baseImage image.Image, globalBounds *image.Rectangle, existingBlocks **[]*image.Image, existingBlocksMutex *sync.RWMutex, cfg *config.Config) *QuadtreeElement

NewQuadtreeElement returns a fully populated QuadtreeImage occupying the space of baseImage

type QuadtreeImage

type QuadtreeImage struct {
	// contains filtered or unexported fields
}

QuadtreeImage holds and manages a quadtree image

func NewQuadtreeImage

func NewQuadtreeImage(baseImage image.Image, cfg *config.Config) *QuadtreeImage

NewQuadtreeImage constructs a well-formed instance of QuadtreeImage from a baseImage

func (*QuadtreeImage) Encode

func (q *QuadtreeImage) Encode(archiveMode ArchiveMode) (io.Reader, *map[string]io.Reader, error)

Encode encodes a quadtree image into a single buffer and returns it

func (*QuadtreeImage) GetBlockImage

func (q *QuadtreeImage) GetBlockImage(padded bool) image.Image

GetBlockImage creates a representation of the image encoded in the quadtree. If padded is true, the padding area around the original image is included as well.

func (*QuadtreeImage) GetBoxImage

func (q *QuadtreeImage) GetBoxImage(padded bool, deduplicated bool, palette map[*image.Image]color.Color) (image.Image, map[*image.Image]color.Color)

GetBoxImage creates a representation of the bounding boxes of the quadtree. If padded is true, the padding area around the original image is included as well. If deduplicated is true, groups of deduplicated blocks should be colored the same The used palette is returned. It can be passed in further calls and thus be used again to color the same blocks in the same way.

func (*QuadtreeImage) Partition

func (q *QuadtreeImage) Partition()

Partition splits the BaseImage into an appropriate number of sub images and calls their partition method TODO: Make this private and call it from Encode. Also rework Encode to work as a static function and handle creating the quadtree in there.

type VisualizationElement

type VisualizationElement struct {
	// contains filtered or unexported fields
}

VisualizationElement holds an image section and additional information relevant during visualization

Jump to

Keyboard shortcuts

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