Diol can save your theme preference in this browser using local storage.
uint32_t EsColorBlend(uint32_t under, uint32_t over, bool fullAlpha);
Blends the over color onto the under color and returns the result.
bool EsColorIsLight(uint32_t color);
Returns true if you should black to draw atop the color.
uint32_t EsColorConvertToRGB(float h, float s, float v);
0 <= hue < 6; 0 <= saturation <= 1; 0 <= value <= 1.
bool EsColorConvertToHSV(uint32_t color, float *h, float *s, float *v);
Converts a color to hue, saturation, and value. Returns false if the color is gray.
uint32_t EsColorParse(STRING string);
Parses a hexadecimal color string. Supports 3, 4, 5, 6, or 8 hex digits.
uint32_t EsColorInterpolate(uint32_t from, uint32_t to, float progress);
Linearly interpolates between the two colors by progress.
void EsDrawBitmap(EsPainter *painter, EsRectangle region, const uint32_t *bits, uintptr_t stride, uint16_t mode);
OR mode with alpha.
void EsDrawBitmapScaled(EsPainter *painter, EsRectangle destinationRegion, EsRectangle sourceRegion, const uint32_t *bits, uintptr_t stride, uint16_t alpha);
Set alpha to 0xFFFF if source is opaque.
void EsDrawBlock(EsPainter *painter, EsRectangle bounds, EsDeviceColor mainColor);
Fills the rectangle with a solid color. Does nothing if the color is fully transparent.
void EsDrawClear(EsPainter *painter, EsRectangle bounds);
Sets every pixel in the rectangle to zero.
void EsDrawContent(EsPainter *painter, EsElement *element, EsRectangle rectangle, STRING text, uint32_t iconID = 0, EsDrawContentFlags flags = ES_FLAGS_DEFAULT, const EsTextSelection *selectionProperties = ES_NULL);
Draws the text and optional icon of a themed element using the current style.
void EsDrawInvert(EsPainter *painter, EsRectangle bounds);
Inverts the color of every pixel in the rectangle.
void EsDrawLine(EsPainter *painter, const float *vertices, size_t vertexCount, EsDeviceColor color, float width, EsDrawLineFlags flags);
Vertices are pairs of x,y coordinates.
void EsDrawRectangle(EsPainter *painter, EsRectangle bounds, EsDeviceColor mainColor, EsDeviceColor borderColor, EsRectangle borderSize);
Draws a rectangle with a solid interior and a border of the given size.
void EsDrawRoundedRectangle(EsPainter *painter, EsRectangle bounds, EsDeviceColor mainColor, EsDeviceColor borderColor, EsRectangle borderSize, EsCornerRadii cornerRadii);
Draws a rectangle with rounded corners.
bool EsDrawStandardIcon(EsPainter *painter, uint32_t id, int size, EsRectangle region, EsDeviceColor color);
Draws a standard icon, centered in the region and tinted with color. Returns false if the icon does not exist.
void EsDrawPaintTarget(EsPainter *painter, EsPaintTarget *source, EsRectangle destinationRegion, EsRectangle sourceRegion, uint8_t alpha);
Draws one paint target onto another. Scales the source to fit the destination.
void EsDrawText(EsPainter *painter, EsTextPlan *plan, EsRectangle bounds, const EsRectangle *clip = ES_NULL, const EsTextSelection *selectionProperties = ES_NULL);
Draws a text plan within the given bounds. Optionally clips to clip and highlights the selection.
void EsDrawTextSimple(EsPainter *painter, EsElement *element, EsRectangle bounds, STRING stringBytes, EsTextStyle style, uint32_t flags = ES_FLAGS_DEFAULT);
Creates a single-use text plan and draws the text with the given style.
void EsDrawTextThemed(EsPainter *painter, EsElement *element, EsRectangle bounds, STRING stringBytes, EsStyleID style, uint32_t flags = ES_FLAGS_DEFAULT);
The style must be one of the ES_STYLE_TEXT_... styles.
void EsDrawTextLayers(EsPainter *painter, EsTextPlan *plan, EsRectangle bounds, const EsTextSelection *selectionProperties = ES_NULL);
Draws the themed text layers of a text plan.
void EsDrawVectorFile(EsPainter *painter, EsRectangle bounds, const void *data, size_t dataBytes);
Draws a vector icon from memory. data is the icon file data.
uint32_t EsIconIDFromString(STRING string = BLANK_STRING);
Returns the standard icon ID whose name matches the string. Returns 0 if there is no match.
uint32_t EsIconIDFromDriveType(uint8_t driveType);
Returns the standard icon ID for the given drive type.
uint8_t *EsImageLoad(const void *file, size_t fileSize, uint32_t *width, uint32_t *height, int imageChannels);
Decodes a PNG or JPEG image from memory. Builds without stb_image support only PNG. imageChannels must be 4. PNG files with invalid chunk CRC-32 checksums are rejected. Returns the pixels in 0xAARRGGBB format, or NULL on failure. Free with EsHeapFree.
EsRectangle EsPainterBoundsClient(EsPainter *painter);
Returns the full painting area of the painter.
EsRectangle EsPainterBoundsInset(EsPainter *painter);
Returns the painting area, inset by the style insets.
void EsPaintTargetClear(EsPaintTarget *target);
Sets every pixel of the paint target to zero.
void EsPaintTargetEndDirectAccess(EsPaintTarget *target);
Ends direct access to the paint target bits.
void EsPaintTargetStartDirectAccess(EsPaintTarget *target, uint32_t **bits, size_t *width, size_t *height, size_t *stride);
Returns the paint target bits for direct access. Do not use drawing functions until calling EsPaintTargetEndDirectAccess.
EsPaintTarget *EsPaintTargetCreate(size_t width, size_t height, bool hasAlphaChannel);
Allocates a new paint target. Returns NULL if there is not enough memory. Free with EsPaintTargetDestroy.
EsPaintTarget *EsPaintTargetCreateFromBitmap(uint32_t *bits, size_t width, size_t height, bool hasAlphaChannel);
Do not access the bits again until calling EsPaintTargetDestroy!
void EsPaintTargetGetSize(EsPaintTarget *target, size_t *width, size_t *height);
Returns the width and height of the paint target.
void EsPaintTargetDestroy(EsPaintTarget *target);
Frees the paint target and its bits.
EsTextPlan *EsTextPlanCreate(EsElement *element, EsTextPlanProperties *properties, EsRectangle bounds, const char *string, const EsTextRun *textRuns, size_t textRunCount);
textRuns should point to an array of (textRunCount + 1) EsTextRuns; the last one should have its offset set to the total number of bytes in the string. The passed string must remain valid until the plan is destroyed. The element is used for UI scaling calculations.
int EsTextPlanGetWidth(EsTextPlan *plan);
Returns the width of the text plan, in pixels.
int EsTextPlanGetHeight(EsTextPlan *plan);
Returns the height of the text plan, in pixels.
size_t EsTextPlanGetLineCount(EsTextPlan *plan);
Returns the number of lines in the text plan.
void EsTextPlanDestroy(EsTextPlan *plan);
Frees a text plan created with EsTextPlanCreate.
void EsTextPlanReplaceStyleRenderProperties(EsTextPlan *plan, const EsTextStyle *style);
Only render properties - like color or underline, but not font weight - will be replaced.
void EsRichTextParse(const char *inString, ptrdiff_t inStringBytes, char **outString, EsTextRun **outTextRuns, size_t *outTextRunCount, EsTextStyle *baseStyle);
Parses rich text markup into a plain string and an array of text runs. Free both with EsHeapFree.
EsFontInformation *EsFontDatabaseEnumerate(size_t *count);
Returns an array of all fonts in the database. Returns NULL on failure. Free with EsHeapFree.
bool EsFontDatabaseLookupByName(STRING name, EsFontInformation *information);
Returns false if the font does not exist in the database.
bool EsFontDatabaseLookupByID(EsFontFamily id, EsFontInformation *information);
Returns false if the font does not exist in the database.
EsFontFamily EsFontDatabaseInsertFile(const EsFontInformation *information, EsFileStore *store);
Don't set the `id` field in EsFontInformation. The assigned ID will be returned. If nameBytes is 0, then the system will not try to match it with an existing font family. Set the corresponding bit in availableWeightsNormal/availableWeightsItalic for the file being added. The request is ignored if the specific variant is already in the database.
EsStyleID EsStyleIntern(const EsStyle *style);
Once a style has been interned, it cannot be removed. Duplicate styles will be given the same ID.