Logo Search packages:      
Sourcecode: cairo-dock version File versions

void cairo_dock_draw_bar_on_icon ( cairo_t *  pIconContext,
double  fValue,
Icon *  pIcon,
CairoContainer *  pContainer 
)

Dessine une barre degradee rouge->vert representant une valeur donnee a la base de l'icone.

Parameters:
pIconContext le contexte du dessin; est modifie par la fonction.
fValue la valeur representant un pourcentage, <=1.
pIcon l'icone.
pContainer le container de l'icone.

Definition at line 167 of file cairo-dock-applet-facility.c.

{
      double fMaxScale = (CAIRO_DOCK_IS_DOCK (pContainer) ? (1 + g_fAmplitude) / CAIRO_DOCK (pContainer)->fRatio : 1);
      cairo_pattern_t *pGradationPattern = cairo_pattern_create_linear (0.,
            0.,
            pIcon->fWidth * fMaxScale,
            0.);  // de gauche a droite.
      g_return_if_fail (cairo_pattern_status (pGradationPattern) == CAIRO_STATUS_SUCCESS);
      
      cairo_pattern_set_extend (pGradationPattern, CAIRO_EXTEND_NONE);
      cairo_pattern_add_color_stop_rgba (pGradationPattern,
            0.,
            1.,
            0.,
            0.,
            1.);
      cairo_pattern_add_color_stop_rgba (pGradationPattern,
            1.,
            0.,
            1.,
            0.,
            1.);
      
      cairo_set_operator (pIconContext, CAIRO_OPERATOR_OVER);
      
      cairo_set_line_width (pIconContext, 6);
      cairo_set_line_cap (pIconContext, CAIRO_LINE_CAP_ROUND);
      
      cairo_move_to (pIconContext, 3, pIcon->fHeight * fMaxScale - 3);
      cairo_rel_line_to (pIconContext, (pIcon->fWidth * fMaxScale - 6) * fValue, 0);
      
      cairo_set_source (pIconContext, pGradationPattern);
      cairo_stroke (pIconContext);
      
      cairo_pattern_destroy (pGradationPattern);
}


Generated by  Doxygen 1.6.0   Back to index