static void glw_displacement_render(glw_t *w, glw_rctx_t *rc) { glw_displacement_t *gd = (glw_displacement_t *)w; glw_t *c; glw_rctx_t rc0 = *rc; rc0.rc_alpha = rc->rc_alpha * w->glw_alpha; if(rc0.rc_alpha < 0.01) return; if((c = TAILQ_FIRST(&w->glw_childs)) == NULL) return; glw_Translatef(&rc0, gd->gd_translate_x, gd->gd_translate_y, gd->gd_translate_z); glw_Scalef(&rc0, gd->gd_scale_x, gd->gd_scale_y, gd->gd_scale_z); if(gd->gd_rotate_a) glw_Rotatef(&rc0, gd->gd_rotate_a, gd->gd_rotate_x, gd->gd_rotate_y, gd->gd_rotate_z); glw_repositionf(&rc0, gd->gd_padding_left, rc->rc_height - gd->gd_padding_top, rc->rc_width - gd->gd_padding_right, gd->gd_padding_bottom); if(glw_is_focusable(w)) glw_store_matrix(w, &rc0); glw_render0(c, &rc0); }
static void glw_text_bitmap_render(glw_t *w, const glw_rctx_t *rc) { glw_text_bitmap_t *gtb = (glw_text_bitmap_t *)w; float alpha; float blur = 1 - (rc->rc_sharpness * w->glw_sharpness); glw_rctx_t rc0 = *rc; if(glw_is_focusable_or_clickable(w)) glw_store_matrix(w, rc); alpha = rc->rc_alpha * w->glw_alpha; if(alpha < GLW_ALPHA_EPSILON) return; if(gtb->gtb_background_alpha > GLW_ALPHA_EPSILON) { glw_renderer_draw(>b->gtb_background_renderer, w->glw_root, &rc0, NULL, NULL, >b->gtb_background_color, NULL, gtb->gtb_background_alpha * alpha, blur, NULL); glw_zinc(&rc0); } if(glw_is_tex_inited(>b->gtb_texture) && gtb->gtb_image != NULL) { glw_renderer_draw(>b->gtb_text_renderer, w->glw_root, &rc0, >b->gtb_texture, NULL, >b->gtb_color, NULL, alpha, blur, NULL); } if(gtb->gtb_paint_cursor) { glw_root_t *gr = w->glw_root; float a = cos((gr->gr_frames & 2047) * (360.0f / 2048.0f)) * 0.5f + 0.5f; glw_zinc(&rc0); glw_renderer_draw(>b->gtb_cursor_renderer, w->glw_root, &rc0, NULL, NULL, NULL, NULL, alpha * a, blur, NULL); } }
static void glw_slider_render_y(glw_t *w, const glw_rctx_t *rc) { glw_slider_t *s = (glw_slider_t *)w; glw_t *c; glw_rctx_t rc0; if(glw_is_focusable_or_clickable(w)) glw_store_matrix(w, rc); if((c = TAILQ_FIRST(&w->glw_childs)) == NULL) return; rc0 = *rc; rc0.rc_alpha *= w->glw_alpha; glw_reposition(&rc0, 0, s->knob_pos_px + s->knob_size_px / 2, rc->rc_width, s->knob_pos_px - s->knob_size_px / 2); glw_render0(c, &rc0); }
static void glw_image_render(glw_t *w, const glw_rctx_t *rc) { glw_image_t *gi = (void *)w; const glw_loadable_texture_t *glt = gi->gi_current; float alpha_self; float blur = 1 - (rc->rc_sharpness * w->glw_sharpness); glw_rctx_t rc0; alpha_self = rc->rc_alpha * w->glw_alpha * gi->gi_alpha_self * gi->gi_autofade; if(gi->gi_mode == GI_MODE_NORMAL || gi->gi_mode == GI_MODE_ALPHA_EDGES) { if(glt == NULL || !glw_is_tex_inited(&glt->glt_texture)) return; rc0 = *rc; glw_align_1(&rc0, w->glw_alignment); if(gi->gi_bitmap_flags & GLW_IMAGE_FIXED_SIZE) glw_scale_to_pixels(&rc0, glt->glt_xs, glt->glt_ys); else if(w->glw_class == &glw_image || w->glw_class == &glw_icon) glw_scale_to_aspect(&rc0, glt->glt_aspect); if(gi->gi_angle != 0) glw_Rotatef(&rc0, -gi->gi_angle, 0, 0, 1); glw_align_2(&rc0, w->glw_alignment); if(glw_is_focusable(w)) glw_store_matrix(w, &rc0); if(w->glw_class == &glw_frontdrop) render_child_simple(w, &rc0); if(alpha_self > 0.01f) { if(w->glw_flags2 & GLW2_SHADOW && !rc0.rc_inhibit_shadows) { float xd = 6.0f / rc0.rc_width; float yd = -6.0f / rc0.rc_height; glw_Translatef(&rc0, xd, yd, 0.0f); static const glw_rgb_t black = {0,0,0}; glw_renderer_draw(&gi->gi_gr, w->glw_root, &rc0, &glt->glt_texture, &black, NULL, alpha_self * 0.75f, 1); glw_Translatef(&rc0, -xd, -yd, 0.0f); } if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE) glw_blendmode(w->glw_root, GLW_BLEND_ADDITIVE); glw_renderer_draw(&gi->gi_gr, w->glw_root, &rc0, &glt->glt_texture, &gi->gi_col_mul, &gi->gi_col_off, alpha_self, blur); if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE) glw_blendmode(w->glw_root, GLW_BLEND_NORMAL); } if(w->glw_class != &glw_frontdrop) render_child_simple(w, &rc0); } else { if(glw_is_focusable(w)) glw_store_matrix(w, rc); if(w->glw_class == &glw_frontdrop) render_child_autocentered(gi, rc); if(glt && glw_is_tex_inited(&glt->glt_texture) && alpha_self > 0.01f) { if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE) glw_blendmode(w->glw_root, GLW_BLEND_ADDITIVE); glw_renderer_draw(&gi->gi_gr, w->glw_root, rc, &glt->glt_texture, &gi->gi_col_mul, &gi->gi_col_off, alpha_self, blur); if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE) glw_blendmode(w->glw_root, GLW_BLEND_NORMAL); } if(w->glw_class != &glw_frontdrop) render_child_autocentered(gi, rc); } }