Documentation ¶
Overview ¶
Package flame implements parsing the XML-based Flame format.
The unmarshaler ignores any unknown variation types. To allow it to load new types, add to the Funcs map.
While the goal is to produce results identical to Apophysis, it may not be possible in all cases.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Funcs = map[string]Parser{
"linear": parseLinear,
"linear3D": parseLinear,
"bipolar": parseBipolar,
"blur": parseBlur,
"pre_blur": parsePreblur,
"bubble": parseBubble,
"elliptic": parseElliptic,
"exp": parseExp,
"expo": parseExpo,
"curl": parseCurl,
"cylinder": parseCylinder,
"disc": parseDisc,
"flatten": parseFlatten,
"foci": parseFoci,
"gaussian_blur": parseGaussblur,
"post_heat": parsePostHeat,
"julia": parseJulia,
"julian": parseJulian,
"lazysusan": parseLazySusan,
"log": parseLog,
"mobius": parseMobius,
"mobiq": parseMobiq,
"polar": parsePolar,
"rod": parseRod,
"scry": parseScry,
"spherical": parseSpherical,
"spherical3D": parseSpherical3D,
"pre_spherical": parsePrespherical,
"splits": parseSplits,
"splits3D": parseSplits3D,
"unpolar": parseUnpolar,
}
Funcs maps Flame xform attribute names to functions which parse attributes into function instances. Parameters of functions should not included here, e.g. julian is an entry but julian_power is not, as the parser should handle the parameters.
Functions ¶
This section is empty.
Types ¶
type Flame ¶
type Flame struct { // Name is the name of the flame. Name string // System is the encoded function system. System xirho.System // R is the renderer for the system. Its histogram should be Reset to the // appropriate size before rendering. R *xirho.Render // Aspect is the aspect ratio (number of columns per row in the image, or // width divided by height) of the system as encoded in the flame file. Aspect float64 // BG is the background color for the system. The alpha component is always // maximized. BG color.NRGBA64 // Err holds any error that occurred while decoding this flame. Err error }
Flame holds a decoded renderer and extra information about it.
func Unmarshal ¶
Unmarshal decodes a renderer from Flame XML. The decoder must be positioned at a flame element, rather than at the flames element at the start of a typical file; one may use d.Token() or d.RawToken() to advance the decoder to the correct position. The returned error is the same as the Flame's Err field.
func UnmarshalAll ¶
UnmarshalAll decodes all systems in an Apophysis flame file. The decoder must be positioned at a flames element. The returned error is independent of errors in the decoded flames, and it may be nil even if no flames were successfully decoded.