MCPcopy Create free account
hub / github.com/cococry/leif / lf_image

Function lf_image

leif.c:3543–3564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3541}
3542
3543void lf_image(LfTexture tex) {
3544 // Retrieving the property data of the image
3545 LfUIElementProps props = get_props_for(state.theme.image_props);
3546 float margin_left = props.margin_left, margin_right = props.margin_right,
3547 margin_top = props.margin_top, margin_bottom = props.margin_bottom;
3548 LfColor color = props.color;
3549
3550 // Advancing to the next line if the image does not fit on the current div
3551 next_line_on_overflow((vec2s){tex.width + margin_left + margin_right, tex.height + margin_top + margin_bottom},
3552 state.div_props.border_width);
3553
3554 // Advancing the position pointer by the margins
3555 state.pos_ptr.x += margin_left;
3556 state.pos_ptr.y += margin_top;
3557
3558 // Rendering the image
3559 lf_image_render(state.pos_ptr, color, tex, props.border_color, props.border_width, props.corner_radius);
3560
3561 // Advancing the position pointer by the width of the image
3562 state.pos_ptr.x += tex.width + margin_right;
3563 state.pos_ptr.y -= margin_top;
3564}
3565
3566void lf_rect(float width, float height, LfColor color, float corner_radius) {
3567 // Rendering the rect

Callers

nothing calls this directly

Calls 3

get_props_forFunction · 0.85
next_line_on_overflowFunction · 0.85
lf_image_renderFunction · 0.85

Tested by

no test coverage detected