SLWash.sleela
lib/user-interface/SLWash.sleela · 81 line(s) · sleela
<< lib/user-interface/SLWash.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLWash — an "Excellent Wash": a soft, multi-stop graded
colour field (up to 8 stops) that paints a SleelaUI mood. Stops are
sampled with smoothstep so the wash reads as a gentle gradient, not hard
bands. Light colours are known and adjustable; the wash is how a mood
colours the light. It is a VM-local handle built up stop by stop and handed
to an SLMood. Each method bottoms out in a `wash*` SLVM built-in calling the
C ABI (sleela_ui_mood.h).
Family: user-interface. Native VM/UI work crosses the explicit `wash*` SLVM
bridge. >>
#sleela 2.5
material;
class SLWash {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 10403;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-07";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
< VM-local handle (-1 = none) >
int wash;
void begin() { wash = washBegin(); }
int handle() { return wash; }
boolean valid() { return wash >= 0; }
void destroy() { if (wash >= 0) { washDestroy(wash); wash = -1; } }
< Add a colour stop at position in [0,1]. Softness (0..1) extra-blurs between >
< stops for a gentler wash. >
void stop(double position, int color) { if (wash >= 0) { washStop(wash, position, color); } }
void setSoftness(double softness) { if (wash >= 0) { washSoftness(wash, softness); } }
< Two- and three-stop shortcuts for the common washes. >
void linear(int a, int b) {
begin(); stop(0.0, a); stop(1.0, b);
}
void triad(int a, int b, int c) {
begin(); stop(0.0, a); stop(0.5, b); stop(1.0, c);
}
< Sample the wash at t in [0,1] -> colour (0xRRGGBBAA). >
int sample(double t) { if (wash < 0) { return 0; } return washSample(wash, t); }
}