heximage

package
v0.0.0-...-16c02d3 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearImage

func ClearImage(conn redis.Conn) error

ClearImage clears the image.

func ConnectRedis

func ConnectRedis(dsn string, maxActive int) (*redis.Pool, error)

ConnectRedis connects to the redis instance, pings it, and returns the pool object on sucesfull connect.

func GetImage

func GetImage(conn redis.Conn) (image.Image, error)

GetImage returns an image.

func HandleCreatePixel

func HandleCreatePixel(pool *redis.Pool) http.HandlerFunc

HandleCreatePixel handles creating pixels on the image.

func HandleGetBoard

func HandleGetBoard(pool *redis.Pool) http.HandlerFunc

HandleGetBoard handles serving the board as a png image.

func HandleGetBoardBitmap

func HandleGetBoardBitmap(pool *redis.Pool) http.HandlerFunc

HandleGetBoardBitmap handles serving the board as a png image.

func HandleLiveConnection

func HandleLiveConnection(pool *redis.Pool, psconn redis.Conn) http.HandlerFunc

HandleLiveConnection brokers the websocket connection with redis.

func InitImage

func InitImage(conn redis.Conn) error

InitImage initializes the image.

func PublishPixel

func PublishPixel(conn redis.Conn, px Pixel) error

PublishPixel publishes the pixel as it was created to redis by sending the redis command for PUBLISH, it does not flush the command.

func SendSet

func SendSet(conn redis.Conn, x, y, colour uint32) error

SendSet sends the set comment but does not flush it.

func SetColour

func SetColour(conn redis.Conn, px Pixel) error

SetColour sets the colour on a pixel of the image.

func StartServer

func StartServer(addr string, pool *redis.Pool, conn redis.Conn, corsOrigins []string) error

StartServer runs an http server capable of serving requests for the image service.

func TestImage

func TestImage(conn redis.Conn) error

TestImage prints a test pattern onto the image.

Types

type Pixel

type Pixel struct {
	X      uint32
	Y      uint32
	Colour uint32
}

Pixel represents a given point and it's colour.

func ParsePixel

func ParsePixel(xs, ys, colours string) (*Pixel, error)

ParsePixel parses pixel data from strings.

Jump to

Keyboard shortcuts

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