libxputty  0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xplayhead_private.h File Reference
#include "xplayhead.h"
Include dependency graph for xplayhead_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define XPLAYHEAD_PRIVATE_H_
 

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 More...
 
void _draw_playhead (void *w_, void *user_data)
 _draw_playhead - internal draw the playhead to the buffer More...
 

Macro Definition Documentation

◆ XPLAYHEAD_PRIVATE_H_

#define XPLAYHEAD_PRIVATE_H_

Definition at line 24 of file xplayhead_private.h.

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
Returns
void

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 }

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

◆ _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
Returns
void

Definition at line 59 of file xplayhead_private.c.

59  {
60  Widget_t *w = (Widget_t*)w_;
61 
62  int width = cairo_xlib_surface_get_width(w->image);
63  int height = cairo_xlib_surface_get_height(w->image);
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 }

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

Colors::text
double text[4]
Definition: xcolor.h:77
Widget_t::image
cairo_surface_t * image
Definition: xwidget.h:320
adj_get_state
float adj_get_state(Adjustment_t *adj)
adj_get_state - get the current state of the Adjustment_t
Definition: xadjustment.c:148
widget_set_scale
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:141
Widget_t::crb
cairo_t * crb
Definition: xwidget.h:318
Widget_t::adj
Adjustment_t * adj
Definition: xwidget.h:334
Widget_t::app
Xputty * app
Definition: xwidget.h:300
Colors
Color_t - struct used to set cairo color for Widget_t.
Definition: xcolor.h:73
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition: xwidget.h:298
NORMAL_
@ NORMAL_
Definition: xcolor.h:39
widget_reset_scale
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:137
Widget_t::surface
cairo_surface_t * surface
Definition: xwidget.h:312
Widget_t::adj_y
Adjustment_t * adj_y
Definition: xwidget.h:332
get_color_scheme
Colors * get_color_scheme(Xputty *main, Color_state st)
get_color_scheme - get pointer to the Colors struct to use in relation to the Color_state
Definition: xcolor.c:130
Widget_t::adj_x
Adjustment_t * adj_x
Definition: xwidget.h:330
Colors::shadow
double shadow[4]
Definition: xcolor.h:78