Documentation
¶
Index ¶
- Variables
- func GetAnonymousToken(ctx context.Context) (oauth2.Token, error)
- func GetPalette(r io.Reader) (map[string]CanvasColor, error)
- type CanvasColor
- type Client
- func (c *Client) GetDiff(ctx context.Context, img image.Image, at image.Point) ([]Update, error)
- func (c *Client) Init(ctx context.Context) error
- func (c *Client) NeededUpdatesFor(ctx context.Context, img image.Image, at image.Point) (chan Update, error)
- func (c *Client) Subscribe(ctx context.Context) (chan []Update, error)
- func (c *Client) WithImage(img image.Image, at image.Point) (image.Image, error)
- type Update
Constants ¶
This section is empty.
Variables ¶
var (
StdPalette = color.Palette{}
)
Functions ¶
func GetAnonymousToken ¶
GetAnonymousToken returns the web accessToken that is written to the r/place reddit page in javascript <script> tags by default.
func GetPalette ¶ added in v0.2.0
func GetPalette(r io.Reader) (map[string]CanvasColor, error)
GetPalette searches for the colors given an html page.
Types ¶
type CanvasColor ¶ added in v0.2.0
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client exists to help read and understand changes to the canvas as they happen, and determine changes necessary to bring specific desired states (images) to the canvas.
func (*Client) GetDiff ¶ added in v0.6.0
GetDiff returns a slice of changes that must be made for the Client's current canvas to become the given image, overlayed at the given point.
func (*Client) NeededUpdatesFor ¶
func (c *Client) NeededUpdatesFor(ctx context.Context, img image.Image, at image.Point) (chan Update, error)
NeededUpdatesFor takes an image.Image and a location on r/place to place it, and returns a channel of updates needed to create and maintain the image at that location. It is subscribed to further canvas updates and will continue to return necessary changes until the context is closed.