Use font shadows for all elements except tooltips

git-svn-id: http://tint2.googlecode.com/svn/trunk@766 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
o9000
2015-04-18 13:22:07 +00:00
committed by mrovi9000@gmail.com
parent 6ba25fa945
commit b4f15db397
10 changed files with 37 additions and 32 deletions

View File

@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <glib.h>
#include "common.h"
@@ -381,3 +382,24 @@ void render_image(Drawable d, int x, int y, int w, int h)
XRenderFreePicture(server.dsp, pict_image);
XRenderFreePicture(server.dsp, pict_drawable);
}
void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color, int font_shadow)
{
if (font_shadow) {
const int shadow_size = 3;
const double shadow_edge_alpha = 0.0;
int i, j;
for (i = -shadow_size; i <= shadow_size; i++) {
for (j = -shadow_size; j <= shadow_size; j++) {
cairo_set_source_rgba(c, 0.0, 0.0, 0.0, 1.0 - (1.0 - shadow_edge_alpha) * sqrt((i*i + j*j)/(double)(shadow_size*shadow_size)));
pango_cairo_update_layout(c, layout);
cairo_move_to(c, posx + i, posy + j);
pango_cairo_show_layout(c, layout);
}
}
}
cairo_set_source_rgba (c, color->color[0], color->color[1], color->color[2], color->alpha);
pango_cairo_update_layout (c, layout);
cairo_move_to (c, posx, posy);
pango_cairo_show_layout (c, layout);
}

View File

@@ -10,6 +10,7 @@
#define WM_CLASS_TINT "panel"
#include <Imlib2.h>
#include <pango/pangocairo.h>
#include "area.h"
/*
@@ -64,5 +65,8 @@ void adjust_asb(DATA32 *data, int w, int h, int alpha, float satur, float bright
void createHeuristicMask(DATA32* data, int w, int h);
void render_image(Drawable d, int x, int y, int w, int h);
void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color, int font_shadow);
#endif