libxputty 0.1
Loading...
Searching...
No Matches
Functions
xplayhead_private.h File Reference

Go to the source code of this file.

Functions

void _create_playhead_image (Widget_t *w, int width, int height)
 _create_playhead_image - internal draw the playhead image to the cairo image surface
 
void _draw_playhead (void *w_, void *user_data)
 _draw_playhead - internal draw the playhead to the buffer
 

Function Documentation

◆ _create_playhead_image()

void _create_playhead_image ( Widget_t w,
int  width,
int  height 
)

_create_playhead_image - internal draw the playhead image to the cairo image surface

Parameters
*w- pointer to the Widget_t meter
width- widget width
height- widget height

Definition at line 25 of file xplayhead_private.c.

25 {
26 w->image = cairo_surface_create_similar (w->surface,
27 CAIRO_CONTENT_COLOR_ALPHA, width, height*2);
28 cairo_t *cri = cairo_create (w->image);
30
31 //cairo_rectangle(cri,0.0, 0.0, width, height*2);
32 //cairo_set_source_rgba (cri, c->bg[0], c->bg[1], c->bg[2], c->bg[3]);
33 //cairo_fill(cri);
34
35 cairo_set_source_rgba (cri, c->shadow[0], c->shadow[1], c->shadow[2], c->shadow[3]);
36
37 int h = height ;
38 int ci = h-2;
39
40 int i = 1;
41 for(;i<width;) {
42 cairo_rectangle(cri,i,1,2,ci);
43 cairo_fill(cri);
44 i +=3;
45 }
46
47 cairo_set_source_rgba (cri, c->text[0], c->text[1], c->text[2], c->text[3]);
48
49 i = 1;
50 for(;i<width;) {
51 cairo_rectangle(cri,i,height+1,2,ci);
52 cairo_fill(cri);
53 i +=3;
54 }
55
56 cairo_destroy(cri);
57}
Color_t - struct used to set cairo color for Widget_t.
Definition xcolor.h:85
double text[4]
Definition xcolor.h:89
double shadow[4]
Definition xcolor.h:90
cairo_surface_t * image
Definition xwidget.h:491
cairo_surface_t * surface
Definition xwidget.h:483
Colors * get_color_scheme(Widget_t *wid, Color_state st)
get_color_scheme - get pointer to the Colors struct to use in relation to the Color_state
Definition xcolor.c:197
@ NORMAL_
Definition xcolor.h:44

References get_color_scheme(), Widget_t::image, NORMAL_, Colors::shadow, Widget_t::surface, and Colors::text.

Referenced by add_playhead().

◆ _draw_playhead()

void _draw_playhead ( void *  w_,
void *  user_data 
)

_draw_playhead - internal draw the playhead to the buffer

Parameters
*w_- void pointer to the Widget_t button
*user_data- void pointer to attached user_data

Definition at line 59 of file xplayhead_private.c.

59 {
60 Widget_t *w = (Widget_t*)w_;
61
62 int width, height;
63 os_get_surface_size(w->image, &width, &height);
64 double state = adj_get_state(w->adj);
65 double clip = adj_get_state(w->adj_x);
66 double cut = adj_get_state(w->adj_y);
68 cairo_set_source_surface (w->crb, w->image, 0, 0);
69 cairo_rectangle(w->crb,0, 0, width, height/2);
70 cairo_fill(w->crb);
71 cairo_set_source_surface (w->crb, w->image, 0, -height/2);
72 cairo_rectangle(w->crb, width*state,0,3, height/2);
73 cairo_fill(w->crb);
74
75 cairo_set_source_rgba (w->crb, 0.5, 0.0, 0.0, 0.4);
76 cairo_rectangle(w->crb, 0,0,width*clip, height/2);
77 cairo_fill(w->crb);
78
79 cairo_rectangle(w->crb, width,0,(width*cut)-width, height/2);
80 cairo_fill(w->crb);
81
83}
Widget_t - struct to hold the basic Widget_t info.
Definition xwidget.h:457
Adjustment_t * adj_y
Definition xwidget.h:495
Adjustment_t * adj_x
Definition xwidget.h:493
Adjustment_t * adj
Definition xwidget.h:497
cairo_t * crb
Definition xwidget.h:489
float adj_get_state(Adjustment_t *adj)
adj_get_state - get the current state of the Adjustment_t
void os_get_surface_size(cairo_surface_t *surface, int *width, int *height)
os_get_surface_size - get the size of the cairo surface
void widget_set_scale(Widget_t *w)
widget_set_scale - set scaling mode to scale a image surface to the size of the Widget_t surface
Definition xwidget.c:159
void widget_reset_scale(Widget_t *w)
widget_reset_scale - used to reset scaling mode after a image surface is drawn to the Widget_t surfac...
Definition xwidget.c:155

References Widget_t::adj, adj_get_state(), Widget_t::adj_x, Widget_t::adj_y, Widget_t::crb, Widget_t::image, os_get_surface_size(), widget_reset_scale(), and widget_set_scale().

Referenced by add_playhead().