Documentation
¶
Index ¶
Constants ¶
const ( DefaultOuterPad = 24.0 // The default outer padding around the canvas DefaultMinPad = 12.0 // The minimum padding between tiles DefaultLineSpacing = 1.5 // The default line spacing for text rendering DefaultLabelPad = 3.0 // The default padding between image and its label DefaultMinFontSize = 12.0 // The default minimum font size DefaultMaxFontSize = 32.0 // The default maximum font size DefaultColWidth = 720.0 // The default column width for tiling DefaultColPad = 24.0 // The default padding between columns )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶
type Canvas struct {
Width int // The width of the canvas in pixels.
Height int // The height of the canvas in pixels.
Raw image.Image // The raw image data of the canvas.
}
Canvas represents the rendered image canvas.
type Column ¶ added in v0.2.0
type Column struct {
Objects []Tileable
}
Column represents a single column in the pane, containing multiple tileable objects. The column width will follow Pane.ColWidth when rendered.
type Config ¶
type Config struct {
MaxCanvasWidth int // The maximum width of the canvas to compose images on.
MaxCanvasHeight int // The maximum height of the canvas to compose images on.
FgColor color.Color // The foreground color used for text and shapes.
BgColor color.Color // The background color of the canvas.
FontSize float64 // The default font size for text rendering.
}
The configuration options for the Imacon rendering engine.
type Drawable ¶
type Drawable interface {
Draw(ctx *gg.Context, cw float64, ch float64) // Draw the object onto the given context with specified canvas width and height
}
Drawable defines the behavior of objects that can be drawn onto the scene.
type ImageBlock ¶
type ImageBlock struct {
// Representation of an image, with a custom label for identification.
Image image.Image
Label *TextBlock
}
func NewImageBlock ¶
func NewImageBlock(file io.Reader, label string) (*ImageBlock, error)
func (*ImageBlock) IntrinsicSize ¶
type Pane ¶
type Pane struct {
Objects []Tileable // The objects within the pane, which can be TextBlocks or ImageBlocks
PlannedShape *Shape // The planned shape of the pane after layout calculation
ColWidth float64 // The fixed column width for tiling
ColPad float64 // The padding between columns
RowPad float64 // The padding between tiles in a column
}
Pane represents a container that holds multiple tileable objects (TextBlocks or ImageBlocks) and manages their layout.
func NewPaneWithShape ¶ added in v0.2.0
func (*Pane) DrawShape ¶ added in v0.2.0
Draw the pane onto the given context based on the provided shape.
func (*Pane) IntrinsicSize ¶
type Scene ¶
type Scene struct {
Main *Pane // The main pane that holds all the objects to be rendered.
}
Scene represents the overall image composition, containing panes and their layout properties.
type Shape ¶
type Shape struct {
Columns []Column // The columns in the pane
}
Shape stores the layout shape of the pane in terms of columns and rows. It's a temporary view of underlying objects calculated using the greedy algorithm to fit into the best canvas size.
func NewShapeWithObjects ¶ added in v0.2.0
type TextBlock ¶
type TextBlock struct {
// Representation of a plain-text.
Text string
Opts TextBlockOpts
}
func NewTextBlock ¶
func NewTextBlock(text string, opts TextBlockOpts) *TextBlock
type TextBlockOpts ¶
type TextBlockOpts struct {
TextWrap bool // Whether to wrap text if it exceeds the pane width
}
type TileProxy ¶ added in v0.2.0
type TileProxy struct {
Object Tileable // The actual tileable object being proxied
Size Size // The pre-calculated size of the tile
}
TileProxy is a placeholder tileable object used for layout calculations, with pre-calculated size.
