128
gimp_view_renderer_render_buffer (renderer, temp_buf, -1,
129
gimp_view_renderer_render_surface (renderer, temp_buf, -1,
132
133
temp_buf_free (temp_buf);
134
#define INDICATOR_WIDTH 7
135
#define INDICATOR_HEIGHT 7
137
if (renderer->width >= INDICATOR_WIDTH * 2 &&
138
renderer->height >= INDICATOR_HEIGHT * 2 &&
139
(renderer->width < brush_width ||
140
renderer->height < brush_height ||
141
GIMP_IS_BRUSH_PIPE (renderer->viewable) ||
142
GIMP_IS_BRUSH_GENERATED (renderer->viewable)))
144
#define WHT { 255, 255, 255 }
145
#define BLK { 0, 0, 0 }
146
#define RED { 255, 127, 127 }
147
#define BLU { 127, 150, 255 }
149
static const guchar scale_indicator_bits[7][7][3] =
151
{ WHT, WHT, WHT, WHT, WHT, WHT, WHT },
152
{ WHT, WHT, WHT, BLK, WHT, WHT, WHT },
153
{ WHT, WHT, WHT, BLK, WHT, WHT, WHT },
154
{ WHT, BLK, BLK, BLK, BLK, BLK, WHT },
155
{ WHT, WHT, WHT, BLK, WHT, WHT, WHT },
156
{ WHT, WHT, WHT, BLK, WHT, WHT, WHT },
157
{ WHT, WHT, WHT, WHT, WHT, WHT, WHT }
160
static const guchar scale_pipe_indicator_bits[7][7][3] =
162
{ WHT, WHT, WHT, WHT, WHT, WHT, WHT },
163
{ WHT, WHT, WHT, BLK, WHT, WHT, RED },
164
{ WHT, WHT, WHT, BLK, WHT, RED, RED },
165
{ WHT, BLK, BLK, BLK, BLK, BLK, RED },
166
{ WHT, WHT, WHT, BLK, RED, RED, RED },
167
{ WHT, WHT, RED, BLK, RED, RED, RED },
168
{ WHT, RED, RED, RED, RED, RED, RED }
171
static const guchar pipe_indicator_bits[7][7][3] =
173
{ WHT, WHT, WHT, WHT, WHT, WHT, WHT },
174
{ WHT, WHT, WHT, WHT, WHT, WHT, RED },
175
{ WHT, WHT, WHT, WHT, WHT, RED, RED },
176
{ WHT, WHT, WHT, WHT, RED, RED, RED },
177
{ WHT, WHT, WHT, RED, RED, RED, RED },
178
{ WHT, WHT, RED, RED, RED, RED, RED },
179
{ WHT, RED, RED, RED, RED, RED, RED }
182
static const guchar scale_genbrush_indicator_bits[7][7][3] =
184
{ WHT, WHT, WHT, WHT, WHT, WHT, WHT },
185
{ WHT, WHT, WHT, BLK, WHT, WHT, BLU },
186
{ WHT, WHT, WHT, BLK, WHT, BLU, BLU },
187
{ WHT, BLK, BLK, BLK, BLK, BLK, BLU },
188
{ WHT, WHT, WHT, BLK, WHT, BLU, BLU },
189
{ WHT, WHT, BLU, BLK, BLU, BLU, BLU },
190
{ WHT, WHT, BLU, BLU, BLU, BLU, BLU }
193
static const guchar genbrush_indicator_bits[7][7][3] =
195
{ WHT, WHT, WHT, WHT, WHT, WHT, WHT },
196
{ WHT, WHT, WHT, WHT, WHT, WHT, BLU },
197
{ WHT, WHT, WHT, WHT, WHT, BLU, BLU },
198
{ WHT, WHT, WHT, WHT, BLU, BLU, BLU },
199
{ WHT, WHT, WHT, BLU, BLU, BLU, BLU },
200
{ WHT, WHT, BLU, BLU, BLU, BLU, BLU },
201
{ WHT, BLU, BLU, BLU, BLU, BLU, BLU }
219
offset_x = renderer->width - INDICATOR_WIDTH;
220
offset_y = renderer->height - INDICATOR_HEIGHT;
222
buf = renderer->buffer + (offset_y * renderer->rowstride +
223
offset_x * renderer->bytes);
225
pipe = GIMP_IS_BRUSH_PIPE (renderer->viewable);
226
genbrush = GIMP_IS_BRUSH_GENERATED (renderer->viewable);
227
scale = (renderer->width < brush_width ||
228
renderer->height < brush_height);
229
alpha = (renderer->bytes == 4);
231
for (y = 0; y < INDICATOR_HEIGHT; y++)
235
for (x = 0; x < INDICATOR_WIDTH; x++)
241
*b++ = scale_pipe_indicator_bits[y][x][0];
242
*b++ = scale_pipe_indicator_bits[y][x][1];
243
*b++ = scale_pipe_indicator_bits[y][x][2];
247
*b++ = scale_genbrush_indicator_bits[y][x][0];
248
*b++ = scale_genbrush_indicator_bits[y][x][1];
249
*b++ = scale_genbrush_indicator_bits[y][x][2];
253
*b++ = scale_indicator_bits[y][x][0];
254
*b++ = scale_indicator_bits[y][x][1];
255
*b++ = scale_indicator_bits[y][x][2];
260
*b++ = pipe_indicator_bits[y][x][0];
261
*b++ = pipe_indicator_bits[y][x][1];
262
*b++ = pipe_indicator_bits[y][x][2];
266
*b++ = genbrush_indicator_bits[y][x][0];
267
*b++ = genbrush_indicator_bits[y][x][1];
268
*b++ = genbrush_indicator_bits[y][x][2];
275
buf += renderer->rowstride;
279
#undef INDICATOR_WIDTH
280
#undef INDICATOR_HEIGHT
186
gimp_view_renderer_brush_draw (GimpViewRenderer *renderer,
189
const GdkRectangle *area)
191
GIMP_VIEW_RENDERER_CLASS (parent_class)->draw (renderer, widget, cr, area);
193
#define INDICATOR_WIDTH 7
194
#define INDICATOR_HEIGHT 7
196
if (renderer->width > 2 * INDICATOR_WIDTH &&
197
renderer->height > 2 * INDICATOR_HEIGHT)
199
gboolean pipe = GIMP_IS_BRUSH_PIPE (renderer->viewable);
200
gboolean generated = GIMP_IS_BRUSH_GENERATED (renderer->viewable);
204
if (generated || pipe)
206
cairo_move_to (cr, area->x + area->width, area->y + area->height);
207
cairo_rel_line_to (cr, - INDICATOR_WIDTH, 0);
208
cairo_rel_line_to (cr, INDICATOR_WIDTH, - INDICATOR_HEIGHT);
209
cairo_rel_line_to (cr, 0, INDICATOR_HEIGHT);
212
cairo_set_source_rgb (cr, 1.0, 0.5, 0.5);
214
cairo_set_source_rgb (cr, 0.5, 0.6, 1.0);
219
gimp_viewable_get_size (renderer->viewable, &brush_width, &brush_height);
221
if (renderer->width < brush_width || renderer->height < brush_height)
224
area->x + area->width - INDICATOR_WIDTH + 1,
225
area->y + area->height - INDICATOR_HEIGHT / 2.0);
226
cairo_rel_line_to (cr, INDICATOR_WIDTH - 2, 0);
229
area->x + area->width - INDICATOR_WIDTH / 2.0,
230
area->y + area->height - INDICATOR_HEIGHT + 1);
231
cairo_rel_line_to (cr, 0, INDICATOR_WIDTH - 2);
233
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
234
cairo_set_line_width (cr, 1);
239
#undef INDICATOR_WIDTH
240
#undef INDICATOR_HEIGHT