imgshow

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 17 Imported by: 0

README

imgshow

Dead simple Go library to open a window with an image.

Only Linux (X server) is supported.

Installation

go get github.com/orsinium-labs/imgshow

Usage

stream, _ := os.Open("image.png")
img, _ := png.Decode(stream)
imgshow.Show(img)

See _examples directory for more examples.

Standing on the shoulders of giants

The code is based on goiv library which is an image viewer written on Go. Unfortunately, the project doesn't provide an API, so imgshow was born out of it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Show

func Show(img image.Image) error

Create a new window, draw the image, and wait until the window is closed.

Types

type Config

type Config struct {
	Width  int
	Height int
	Title  string
	// contains filtered or unexported fields
}

Configuration for windows.

func NewConfig

func NewConfig() Config

func (Config) Window

func (c Config) Window() *Window

Get a window for this configuration.

type Window

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

func (*Window) Create

func (w *Window) Create() error

Create a new empty window.

func (*Window) Destroy

func (w *Window) Destroy()

Destroy the window

func (*Window) Draw

func (w *Window) Draw(img image.Image) error

Draw the image on window. `Render` must be called after to actually render the image.

func (*Window) Render

func (w *Window) Render()

Render the image and wait for the window to be closed.

Jump to

Keyboard shortcuts

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