rename COLOR_OVERLAY to OVERLAY_COLOR for consistency

This commit is contained in:
Nic Barker 2026-03-31 12:37:11 +11:00
parent 5d0649efc2
commit aa724ff493
3 changed files with 11 additions and 11 deletions

View file

@ -1205,7 +1205,7 @@ Uses [Clay_Color](#clay_color). Conventionally accepts `rgba` float values betwe
Uses [Clay_Color](#clay_color). Conventionally accepts `rgba` float values between 0 and 255, but interpretation is left up to the renderer and does not affect layout.
Specifying `.overlayColor` will cause two new render commands to be emitted: `COLOR_OVERLAY_BEGIN` immediately, and `COLOR_OVERLAY_END` after this elements subtree has been emitted.
Specifying `.overlayColor` will cause two new render commands to be emitted: `OVERLAY_COLOR_BEGIN` immediately, and `OVERLAY_COLOR_END` after this elements subtree has been emitted.
This instructs the renderer to begin applying a color overlay to this element, and all child elements. The color overlay effect is similar to glsl's `mix(source, target, alpha)`. As a result, the strength of the color overlay is controlled by the `.a` channel of `.overlayColor`.
Zero alpha means "all child colors remain the same", full alpha means "all child colours are replaced by the RGB overlayColor", and values in between mean "lerp from the child color to the overlay color by the alpha".
@ -2498,8 +2498,8 @@ An enum indicating how this render command should be handled. Possible values in
- `CLAY_RENDER_COMMAND_TYPE_IMAGE` - An image should be drawn, configured with `.renderData.image`
- `CLAY_RENDER_COMMAND_TYPE_SCISSOR_START` - Named after [glScissor](https://registry.khronos.org/OpenGL-Refpages/gl4/html/glScissor.xhtml), this indicates that the renderer should begin culling any subsequent pixels that are drawn outside the `.boundingBox` of this render command.
- `CLAY_RENDER_COMMAND_TYPE_SCISSOR_END` - Only ever appears after a matching `CLAY_RENDER_COMMAND_TYPE_SCISSOR_START` command, and indicates that the scissor has ended.
- `CLAY_RENDER_COMMAND_TYPE_COLOR_OVERLAY_START` - The renderer should begin applying an overlay color to all subsequent render commands, similar to glsl's `mix(source, target, alpha)`.
- `CLAY_RENDER_COMMAND_TYPE_COLOR_OVERLAY_END` - The previous `COLOR_OVERLAY` should be removed. Note: nested color overlays may require a stack data structure on the renderer side.
- `CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_START` - The renderer should begin applying an overlay color to all subsequent render commands, similar to glsl's `mix(source, target, alpha)`.
- `CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_END` - The previous `OVERLAY_COLOR` should be removed. Note: nested color overlays may require a stack data structure on the renderer side.
- `CLAY_RENDER_COMMAND_TYPE_CUSTOM` - A custom render command controlled by the user, configured with `.renderData.custom`
---

12
clay.h
View file

@ -699,7 +699,7 @@ typedef struct Clay_ClipRenderData {
bool vertical;
} Clay_ClipRenderData;
// Render command data when commandType == CLAY_RENDER_COMMAND_TYPE_SCISSOR_START || commandType == CLAY_RENDER_COMMAND_TYPE_SCISSOR_END
// Render command data when commandType == CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_START || commandType == CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_END
typedef struct Clay_OverlayColorRenderData {
Clay_Color color;
} Clay_OverlayColorRenderData;
@ -730,7 +730,7 @@ typedef union Clay_RenderData {
Clay_BorderRenderData border;
// Render command data when commandType == CLAY_RENDER_COMMAND_TYPE_SCISSOR_START|END
Clay_ClipRenderData clip;
// Render command data when commandType == CLAY_RENDER_COMMAND_TYPE_COLOR_OVERLAY_START|END
// Render command data when commandType == CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_START|END
Clay_OverlayColorRenderData overlayColor;
} Clay_RenderData;
@ -776,9 +776,9 @@ typedef CLAY_PACKED_ENUM {
// The renderer should finish any previously active clipping, and begin rendering elements in full again.
CLAY_RENDER_COMMAND_TYPE_SCISSOR_END,
// The renderer should begin performing a "color overlay" on all subsequent render commands until disabled again.
CLAY_RENDER_COMMAND_TYPE_COLOR_OVERLAY_START,
CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_START,
// The renderer should disable any previously active "color overlay" and render elements with their standard colors again.
CLAY_RENDER_COMMAND_TYPE_COLOR_OVERLAY_END,
CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_END,
// The renderer should provide a custom implementation for handling this render command based on its .customData
CLAY_RENDER_COMMAND_TYPE_CUSTOM,
} Clay_RenderCommandType;
@ -2865,7 +2865,7 @@ void Clay__CalculateFinalLayout(float deltaTime, bool useStoredBoundingBoxes, bo
.userData = currentElement->config.userData,
.id = currentElement->id,
.zIndex = root->zIndex,
.commandType = CLAY_RENDER_COMMAND_TYPE_COLOR_OVERLAY_END,
.commandType = CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_END,
};
Clay__AddRenderCommand(renderCommand);
}
@ -2976,7 +2976,7 @@ void Clay__CalculateFinalLayout(float deltaTime, bool useStoredBoundingBoxes, bo
.userData = currentElement->config.userData,
.id = currentElement->id,
.zIndex = root->zIndex,
.commandType = CLAY_RENDER_COMMAND_TYPE_COLOR_OVERLAY_START,
.commandType = CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_START,
};
Clay__AddRenderCommand(renderCommand);
}

View file

@ -245,11 +245,11 @@ void Clay_Raylib_Render(Clay_RenderCommandArray renderCommands, Font* fonts)
EndScissorMode();
break;
}
case CLAY_RENDER_COMMAND_TYPE_COLOR_OVERLAY_START: {
case CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_START: {
SetColorOverlay(CLAY_COLOR_TO_RAYLIB_COLOR(renderCommand->renderData.overlayColor.color));
break;
}
case CLAY_RENDER_COMMAND_TYPE_COLOR_OVERLAY_END: {
case CLAY_RENDER_COMMAND_TYPE_OVERLAY_COLOR_END: {
DisableColorOverlay();
}
case CLAY_RENDER_COMMAND_TYPE_RECTANGLE: {