Documentation
¶
Overview ¶
Package apptype defines the core types and interfaces for the Pel pixel art editor.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrushType ¶
type BrushType int
BrushType represents the type of brush tool being used
const ( BrushTypePencil BrushType = iota BrushTypeEraser BrushTypeFill BrushTypeLine BrushTypeRectangle BrushTypeCircle )
Brush type constants
type Brushable ¶
type Brushable interface {
// SetColor sets the color at the specified canvas coordinates
// Returns an error if the operation fails
SetColor(c color.Color, x, y int) error
// MouseToCanvasXY converts mouse event coordinates to canvas coordinates
// Returns nil pointers if the coordinates are outside the canvas
MouseToCanvasXY(ev *desktop.MouseEvent) (*int, *int)
}
Brushable defines the interface for objects that can be painted on
type PelCanvasConfig ¶
type PelCanvasConfig struct {
DrawingArea fyne.Size // Size of the drawing area in pixels
CanvasOffset fyne.Position // Offset of the canvas from the window origin
PxRows int // Number of pixel rows in the grid
PxCols int // Number of pixel columns in the grid
PxSize int // Size of each pixel in screen pixels
}
PelCanvasConfig holds the configuration for the pixel canvas
func (PelCanvasConfig) TotalPixels ¶
func (c PelCanvasConfig) TotalPixels() int
TotalPixels returns the total number of pixels in the canvas
func (PelCanvasConfig) Validate ¶
func (c PelCanvasConfig) Validate() error
Validate checks if the canvas configuration is valid
type State ¶
type State struct {
BrushColor color.Color // Current brush color
BrushType BrushType // Current brush tool type
SwatchSelected int // Index of the currently selected color swatch
FilePath string // Path to the currently open file (empty if new/unsaved)
}
State represents the current state of the application
func (*State) HasFilePath ¶
HasUnsavedChanges returns true if there's a file path (indicating the project has been saved)
func (*State) SetBrushColor ¶
SetBrushColor updates the current brush color
func (*State) SetBrushType ¶
SetBrushType updates the current brush type
func (*State) SetFilePath ¶
SetFilePath updates the file path for the current project
func (*State) SetSwatchSelected ¶
SetSwatchSelected updates the selected swatch index