Example #1
0
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(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);
}
Example #2
0
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);
  }
}