Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApplyResult ¶
ApplyResult holds the output of applying a ChangeSet.
func ApplyChangeSet ¶
func ApplyChangeSet(cs ChangeSet, baseImageId string, fetchImage FetchImageFunc) (*ApplyResult, error)
ApplyChangeSet applies each Change in the ChangeSet in order, piping output bytes into the next step, then serializes the full ChangeSet.
type BlurEditor ¶
type BlurEditor struct{}
func (*BlurEditor) Apply ¶
func (e *BlurEditor) Apply(baseBytes []byte, cs Change, _ FetchImageFunc) ([]byte, string, error)
type BlurParams ¶
type BlurParams struct {
Region BlurRegion `json:"region"`
Radius int `json:"radius"`
}
type BlurRegion ¶
type Change ¶
type Change struct {
Type string `json:"type"`
Params json.RawMessage `json:"params"`
}
Change represents a single named edit operation with its parameters.
func NewBlurChange ¶
func NewBlurChange(params BlurParams) (Change, error)
func NewWatermarkChange ¶
func NewWatermarkChange(params WatermarkParams) (Change, error)
NewWatermarkChange validates params and builds a Change.
type ChangeSet ¶
type ChangeSet []Change
ChangeSet is an ordered list of changes applied atomically to produce one image.
type Editor ¶
type Editor interface {
Apply(base []byte, c Change, fetchImage FetchImageFunc) ([]byte, string, error)
}
Editor applies a Change to base image bytes, producing new image bytes.
type FetchImageFunc ¶
FetchImageFunc retrieves image bytes by image ID.
func NewFetchImageFunc ¶
func NewFetchImageFunc( storedImageRepo storage.StoredImageRepo, storageDefRepo storage.StorageDefRepo, maxBytes int64, ) FetchImageFunc
NewFetchImageFunc creates a FetchImageFunc that reads image bytes from storage.
type WatermarkEditor ¶
type WatermarkEditor struct{}
func (*WatermarkEditor) Apply ¶
func (e *WatermarkEditor) Apply(baseBytes []byte, cs Change, fetchImage FetchImageFunc) ([]byte, string, error)
type WatermarkParams ¶
type WatermarkParams struct {
OverlayImageID string `json:"overlay_image_id"`
Position WatermarkPosition `json:"position"`
Anchor Anchor `json:"anchor"`
Opacity float64 `json:"opacity"`
Scale float64 `json:"scale"`
}
type WatermarkPosition ¶
Click to show internal directories.
Click to hide internal directories.