~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/ui/widget/color-preview.cpp

  • Committer: JazzyNico
  • Date: 2011-08-29 20:25:30 UTC
  • Revision ID: nicoduf@yahoo.fr-20110829202530-6deuoz11q90usldv
Code refactoring and merging with trunk (revision 10599).

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 * Released under GNU GPL, read the file 'COPYING' for more information
12
12
 */
13
13
 
14
 
#include "display/nr-plain-stuff-gdk.h"
15
 
#include "color-preview.h"
 
14
#include "ui/widget/color-preview.h"
 
15
#include "display/cairo-utils.h"
16
16
 
17
17
#define SPCP_DEFAULT_WIDTH 32
18
18
#define SPCP_DEFAULT_HEIGHT 12
76
76
    if (!gdk_rectangle_intersect (area, &warea, &wpaint)) 
77
77
        return;
78
78
 
 
79
    GtkWidget *widget = GTK_WIDGET(this->gobj());
 
80
    cairo_t *ct = gdk_cairo_create(widget->window);
 
81
 
79
82
    /* Transparent area */
80
83
 
81
84
    w2 = warea.width / 2;
86
89
    carea.height = warea.height;
87
90
 
88
91
    if (gdk_rectangle_intersect (area, &carea, &cpaint)) {
89
 
        nr_gdk_draw_rgba32_solid (get_window()->gobj(), 
90
 
                                    get_style()->get_black_gc()->gobj(),
91
 
                                    cpaint.x, cpaint.y,
92
 
                                    cpaint.width, cpaint.height,
93
 
                                    _rgba);
 
92
        cairo_pattern_t *checkers = ink_cairo_pattern_create_checkerboard();
 
93
 
 
94
        cairo_rectangle(ct, carea.x, carea.y, carea.width, carea.height);
 
95
        cairo_set_source(ct, checkers);
 
96
        cairo_fill_preserve(ct);
 
97
        ink_cairo_set_source_rgba32(ct, _rgba);
 
98
        cairo_fill(ct);
 
99
 
 
100
        cairo_pattern_destroy(checkers);
94
101
    }
95
102
 
96
103
    /* Solid area */
101
108
    carea.height = warea.height;
102
109
 
103
110
    if (gdk_rectangle_intersect (area, &carea, &cpaint)) {
104
 
        nr_gdk_draw_rgba32_solid (get_window()->gobj(), 
105
 
                                          get_style()->get_black_gc()->gobj(),
106
 
                                          cpaint.x, cpaint.y,
107
 
                                          cpaint.width, cpaint.height,
108
 
                                          _rgba | 0xff);
 
111
        cairo_rectangle(ct, carea.x, carea.y, carea.width, carea.height);
 
112
        ink_cairo_set_source_rgba32(ct, _rgba | 0xff);
 
113
        cairo_fill(ct);
109
114
    }
 
115
 
 
116
    cairo_destroy(ct);
110
117
}
111
118
 
112
119
}}}