~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to drivers/plplotcanvas-hacktext.c

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
2
/*
 
3
 *  plplotcanvas-hacktext.c: Hacktext CanvasItem, cloned from the
 
4
 *                            gnome-print project
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or
 
7
 *  modify it under the terms of the GNU Library General Public License
 
8
 *  as published by the Free Software Foundation; either version 2 of
 
9
 *  the License, or (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU Library General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU Library General Public
 
17
 *  License along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 *
 
20
 *  Authors:
 
21
 *    Federico Mena <federico@nuclecu.unam.mx>
 
22
 *    Raph Levien <raph@acm.org>
 
23
 *    Lauris Kaplinski <lauris@helixcode.com>
 
24
 *
 
25
 *  Copyright (C) 1998-1999 The Free Software Foundation
 
26
 *  Copyright (C) 2000-2002 Ximian Inc.
 
27
 *
 
28
 */
 
29
 
 
30
/*
 
31
 * FIXME: TODO: Clipping
 
32
 */
 
33
 
 
34
#include <config.h>
 
35
 
 
36
#include <math.h>
 
37
#include <string.h>
 
38
 
 
39
#include <libgnomeprint/gnome-pgl.h>
 
40
#include <libgnomeprint/gnome-font.h>
 
41
#include <libgnomeprint/gnome-rfont.h>
 
42
 
 
43
#include "plplotcanvas-hacktext.h"
 
44
 
 
45
 
 
46
/*
 
47
 * Macros from gnome-print-i18n.h in gnome-print
 
48
 */
 
49
 
 
50
#ifndef __GNOME_PRINT_I18N_H__
 
51
#define __GNOME_PRINT_I18N_H__
 
52
#    define textdomain(String) (String)
 
53
#    define gettext(String) (String)
 
54
#    define dgettext(Domain,Message) (Message)
 
55
#    define dcgettext(Domain,Message,Type) (Message)
 
56
#    define bindtextdomain(Domain,Directory) (Domain)
 
57
#    define _(String) (String)
 
58
#    define N_(String) (String)
 
59
#endif /* __GNOME_PRINT_I18N_H__ */
 
60
 
 
61
 
 
62
/*
 
63
 * Continue with hacktext code
 
64
 */
 
65
 
 
66
enum {
 
67
        PROP_0,
 
68
        PROP_TEXT,
 
69
        PROP_GLYPHLIST,
 
70
        PROP_FILL_COLOR,
 
71
        PROP_FILL_COLOR_RGBA,
 
72
        PROP_FONT,
 
73
        PROP_X,
 
74
        PROP_Y
 
75
};
 
76
 
 
77
 
 
78
static void plplot_canvas_hacktext_class_init    (PlplotCanvasHacktextClass *class);
 
79
static void plplot_canvas_hacktext_init          (PlplotCanvasHacktext      *hacktext);
 
80
static void plplot_canvas_hacktext_destroy       (GtkObject                *object);
 
81
static void plplot_canvas_hacktext_set_property  (GObject                  *object,
 
82
                                                  guint                    param_id,
 
83
                                                  const GValue             *value,
 
84
                                                  GParamSpec               *pspec);
 
85
static void plplot_canvas_hacktext_get_property  (GObject                  *object,
 
86
                                                  guint                    param_id,
 
87
                                                  GValue                   *value,
 
88
                                                  GParamSpec               *pspec);
 
89
static void   plplot_canvas_hacktext_update      (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags);
 
90
static void   plplot_canvas_hacktext_realize     (GnomeCanvasItem *item);
 
91
static void   plplot_canvas_hacktext_unrealize   (GnomeCanvasItem *item);
 
92
static double plplot_canvas_hacktext_point       (GnomeCanvasItem *item, double x, double y,
 
93
                                                  int cx, int cy, GnomeCanvasItem **actual_item);
 
94
static void   plplot_canvas_hacktext_bounds      (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2);
 
95
static void   plplot_canvas_hacktext_render      (GnomeCanvasItem *item, GnomeCanvasBuf *buf);
 
96
static void   plplot_canvas_hacktext_req_repaint (PlplotCanvasHacktext *hacktext, ArtIRect *bbox);
 
97
 
 
98
 
 
99
static GnomeCanvasItemClass *parent_class;
 
100
 
 
101
struct _PlplotCanvasHacktextPriv {
 
102
        GnomeFont * font;
 
103
 
 
104
        GnomeGlyphList * glyphlist;
 
105
        GnomePosGlyphList * pgl;
 
106
        double affine[6]; /* the text to world transform (NB! mirrored Y) */
 
107
};
 
108
 
 
109
GType
 
110
plplot_canvas_hacktext_get_type (void)
 
111
{
 
112
        static GType type = 0;
 
113
        if (!type) {
 
114
                GTypeInfo info = {
 
115
                        sizeof (PlplotCanvasHacktextClass),
 
116
                        NULL, NULL,
 
117
                        (GClassInitFunc) plplot_canvas_hacktext_class_init,
 
118
                        NULL, NULL,
 
119
                        sizeof (PlplotCanvasHacktext),
 
120
                        0,
 
121
                        (GInstanceInitFunc) plplot_canvas_hacktext_init,
 
122
                        NULL
 
123
                };
 
124
                type = g_type_register_static (GNOME_TYPE_CANVAS_ITEM, "PlplotCanvasHacktext", &info, 0);
 
125
        }
 
126
        return type;
 
127
}
 
128
 
 
129
static void
 
130
plplot_canvas_hacktext_class_init (PlplotCanvasHacktextClass *class)
 
131
{
 
132
        GObjectClass *gobject_class;
 
133
        GtkObjectClass *object_class;
 
134
        GnomeCanvasItemClass *item_class;
 
135
 
 
136
        object_class = (GtkObjectClass *) class;
 
137
        gobject_class = (GObjectClass *) class;
 
138
        item_class = (GnomeCanvasItemClass *) class;
 
139
 
 
140
        parent_class = g_type_class_peek_parent (class);
 
141
 
 
142
        gobject_class->set_property = plplot_canvas_hacktext_set_property;
 
143
        gobject_class->get_property = plplot_canvas_hacktext_get_property;
 
144
 
 
145
        g_object_class_install_property
 
146
                (gobject_class,
 
147
                 PROP_TEXT,
 
148
                 g_param_spec_string ("text",
 
149
                                      _("Text"),
 
150
                                      _("Text to render"),
 
151
                                      NULL,
 
152
                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
 
153
        g_object_class_install_property
 
154
                (gobject_class,
 
155
                 PROP_X,
 
156
                 g_param_spec_double ("x", NULL, NULL,
 
157
                                      -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
 
158
                                      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
 
159
        g_object_class_install_property
 
160
                (gobject_class,
 
161
                 PROP_Y,
 
162
                 g_param_spec_double ("y", NULL, NULL,
 
163
                                      -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
 
164
                                      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
 
165
         g_object_class_install_property
 
166
                (gobject_class,
 
167
                 PROP_GLYPHLIST,
 
168
                 g_param_spec_pointer ("glyphlist",
 
169
                                       _("Glyphlist"),
 
170
                                       _("Glyphlist"),
 
171
                                       (G_PARAM_READABLE | G_PARAM_WRITABLE)));
 
172
         g_object_class_install_property
 
173
                (gobject_class,
 
174
                 PROP_FILL_COLOR,
 
175
                 g_param_spec_string ("fill_color",
 
176
                                      _("Color"),
 
177
                                      _("Text color, as string"),
 
178
                                      NULL,
 
179
                                      G_PARAM_WRITABLE));
 
180
         g_object_class_install_property
 
181
                (gobject_class,
 
182
                 PROP_FILL_COLOR_RGBA,
 
183
                 g_param_spec_uint ("fill_color_rgba",
 
184
                                    _("Color"),
 
185
                                    _("Text color, as an R/G/B/A combined integer"),
 
186
                                    0, G_MAXUINT, 0,
 
187
                                    (G_PARAM_READABLE | G_PARAM_WRITABLE)));
 
188
         g_object_class_install_property
 
189
                 (gobject_class,
 
190
                  PROP_FONT,
 
191
                  g_param_spec_object ("font",
 
192
                                       _("Font"),
 
193
                                       _("Font as a GnomeFont struct"),
 
194
                                       GNOME_TYPE_FONT,
 
195
                                       (G_PARAM_READABLE | G_PARAM_WRITABLE)));
 
196
 
 
197
        object_class->destroy = plplot_canvas_hacktext_destroy;
 
198
 
 
199
        item_class->update    = plplot_canvas_hacktext_update;
 
200
        item_class->realize   = plplot_canvas_hacktext_realize;
 
201
        item_class->unrealize = plplot_canvas_hacktext_unrealize;
 
202
        item_class->point     = plplot_canvas_hacktext_point;
 
203
        item_class->bounds    = plplot_canvas_hacktext_bounds;
 
204
        item_class->render    = plplot_canvas_hacktext_render;
 
205
}
 
206
 
 
207
static void
 
208
plplot_canvas_hacktext_init (PlplotCanvasHacktext *hacktext)
 
209
{
 
210
        hacktext->text = NULL;
 
211
        hacktext->priv = g_new (PlplotCanvasHacktextPriv, 1);
 
212
        hacktext->priv->pgl = NULL;
 
213
        hacktext->priv->font = NULL;
 
214
        hacktext->priv->glyphlist = NULL;
 
215
 
 
216
        art_affine_identity (hacktext->priv->affine);
 
217
}
 
218
 
 
219
static void
 
220
plplot_canvas_hacktext_destroy (GtkObject *object)
 
221
{
 
222
        PlplotCanvasHacktext *hacktext;
 
223
 
 
224
        g_return_if_fail (object != NULL);
 
225
        g_return_if_fail (PLPLOT_IS_CANVAS_HACKTEXT (object));
 
226
 
 
227
        hacktext = PLPLOT_CANVAS_HACKTEXT (object);
 
228
 
 
229
        if (hacktext->text) {
 
230
                g_free (hacktext->text);
 
231
                hacktext->text = NULL;
 
232
        }
 
233
 
 
234
        if (hacktext->priv) {
 
235
                if (hacktext->priv->font)
 
236
                        gnome_font_unref (hacktext->priv->font);
 
237
                if (hacktext->priv->glyphlist)
 
238
                        gnome_glyphlist_unref (hacktext->priv->glyphlist);
 
239
                if (hacktext->priv->pgl)
 
240
                        gnome_pgl_destroy (hacktext->priv->pgl);
 
241
                g_free (hacktext->priv);
 
242
                hacktext->priv = NULL;
 
243
        }
 
244
 
 
245
        if (GTK_OBJECT_CLASS (parent_class)->destroy)
 
246
                (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
 
247
}
 
248
 
 
249
static void
 
250
art_drect_hacktext (ArtDRect *bbox, PlplotCanvasHacktext *hacktext)
 
251
{
 
252
        g_assert (bbox != NULL);
 
253
        g_assert (hacktext != NULL);
 
254
 
 
255
        g_return_if_fail (hacktext->priv);
 
256
 
 
257
        if (GTK_OBJECT_FLAGS (hacktext) & GNOME_CANVAS_UPDATE_REQUESTED) {
 
258
                gnome_canvas_update_now (GNOME_CANVAS_ITEM (hacktext)->canvas);
 
259
        }
 
260
 
 
261
        if (!hacktext->priv->pgl)
 
262
                return;
 
263
 
 
264
        gnome_pgl_bbox (hacktext->priv->pgl, bbox);
 
265
}
 
266
 
 
267
/* Computes the bounding box of the hacktext.  Assumes that the number of points in the hacktext is
 
268
 * not zero.
 
269
 */
 
270
static void
 
271
get_bounds (PlplotCanvasHacktext *hacktext, double *bx1, double *by1, double *bx2, double *by2)
 
272
{
 
273
        ArtDRect bbox;
 
274
 
 
275
        /* Compute bounds of hacktext */
 
276
        art_drect_hacktext (&bbox, hacktext);
 
277
 
 
278
        /* Done */
 
279
 
 
280
        *bx1 = bbox.x0;
 
281
        *by1 = bbox.y0;
 
282
        *bx2 = bbox.x1;
 
283
        *by2 = bbox.y1;
 
284
}
 
285
 
 
286
static void
 
287
plplot_canvas_hacktext_set_property (GObject               *object,
 
288
                                     guint                 param_id,
 
289
                                     const GValue          *value,
 
290
                                     GParamSpec            *pspec)
 
291
{
 
292
        GnomeCanvasItem *item;
 
293
        PlplotCanvasHacktext *bp;
 
294
        GnomeGlyphList * gl;
 
295
        GdkColor color;
 
296
        GnomeFont * font;
 
297
 
 
298
        item = GNOME_CANVAS_ITEM (object);
 
299
        bp = PLPLOT_CANVAS_HACKTEXT (object);
 
300
 
 
301
        switch (param_id) {
 
302
        case PROP_TEXT:
 
303
                if (bp->text) {
 
304
                        g_free (bp->text);
 
305
                        bp->text = NULL;
 
306
                }
 
307
 
 
308
                if (bp->priv->glyphlist) {
 
309
                        gnome_glyphlist_unref (bp->priv->glyphlist);
 
310
                        bp->priv->glyphlist = NULL;
 
311
                }
 
312
 
 
313
                bp->text = g_value_dup_string (value);
 
314
 
 
315
                gnome_canvas_item_request_update (item);
 
316
                break;
 
317
 
 
318
        case PROP_GLYPHLIST:
 
319
                gl = g_value_get_pointer (value);
 
320
 
 
321
                if (bp->text) {
 
322
                        g_free (bp->text);
 
323
                        bp->text = NULL;
 
324
                }
 
325
 
 
326
                if (bp->priv->glyphlist) {
 
327
                        gnome_glyphlist_unref (bp->priv->glyphlist);
 
328
                        bp->priv->glyphlist = NULL;
 
329
                }
 
330
 
 
331
                /* FIXME: should be duplicate() (Lauris) */
 
332
                if (gl)
 
333
                        gnome_glyphlist_ref (gl);
 
334
 
 
335
                bp->priv->glyphlist = gl;
 
336
 
 
337
                gnome_canvas_item_request_update (item);
 
338
 
 
339
                break;
 
340
 
 
341
        case PROP_FILL_COLOR:
 
342
                if (gnome_canvas_get_color (item->canvas, g_value_get_string (value), &color)) {
 
343
                        bp->fill_set = TRUE;
 
344
                        bp->fill_pixel = color.pixel;
 
345
                        bp->fill_rgba =
 
346
                                ((color.red & 0xff00) << 16) |
 
347
                                ((color.green & 0xff00) << 8) |
 
348
                                (color.blue & 0xff00) |
 
349
                                0xff;
 
350
                } else {
 
351
                        bp->fill_set = FALSE;
 
352
                        bp->fill_rgba = 0;
 
353
                }
 
354
 
 
355
                gnome_canvas_item_request_update (item);
 
356
                break;
 
357
 
 
358
        case PROP_FILL_COLOR_RGBA:
 
359
                bp->fill_set = TRUE;
 
360
                bp->fill_rgba = g_value_get_uint (value);
 
361
 
 
362
                /* should probably request repaint on the fill_svp */
 
363
                gnome_canvas_item_request_update (item);
 
364
 
 
365
                break;
 
366
 
 
367
        case PROP_FONT:
 
368
                font = g_value_get_object (value);
 
369
                if (font)
 
370
                        gnome_font_ref (font);
 
371
                if (bp->priv->font)
 
372
                        gnome_font_unref (bp->priv->font);
 
373
                bp->priv->font = font;
 
374
                bp->size = gnome_font_get_size (bp->priv->font);
 
375
                gnome_canvas_item_request_update (item);
 
376
                break;
 
377
 
 
378
        case PROP_X:
 
379
                bp->x = g_value_get_double (value);
 
380
                gnome_canvas_item_request_update (item);
 
381
                break;
 
382
 
 
383
        case PROP_Y:
 
384
                bp->y = g_value_get_double (value);
 
385
                gnome_canvas_item_request_update (item);
 
386
                break;
 
387
 
 
388
        default:
 
389
                break;
 
390
        }
 
391
}
 
392
 
 
393
static void
 
394
plplot_canvas_hacktext_get_property (GObject               *object,
 
395
                                     guint                 param_id,
 
396
                                     GValue                *value,
 
397
                                     GParamSpec            *pspec)
 
398
{
 
399
        PlplotCanvasHacktextPriv *priv;
 
400
        PlplotCanvasHacktext *bp;
 
401
 
 
402
        bp = PLPLOT_CANVAS_HACKTEXT (object);
 
403
        priv = (PlplotCanvasHacktextPriv *) bp->priv;
 
404
 
 
405
        switch (param_id) {
 
406
        case PROP_TEXT:
 
407
                g_value_set_string (value, bp->text);
 
408
                break;
 
409
        case PROP_GLYPHLIST:
 
410
                g_value_set_pointer (value, priv->glyphlist);
 
411
                break;          
 
412
        case PROP_FILL_COLOR_RGBA:
 
413
                g_value_set_uint (value, bp->fill_color);
 
414
                break;
 
415
        case PROP_FONT:
 
416
                g_value_set_object (value, bp->priv->font);
 
417
                break;
 
418
        case PROP_X:
 
419
                g_value_set_double (value, bp->x);
 
420
                break;
 
421
        case PROP_Y:
 
422
                g_value_set_double (value, bp->y);
 
423
                break;
 
424
        default:
 
425
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
 
426
                break;
 
427
        }
 
428
}
 
429
 
 
430
static void
 
431
plplot_canvas_hacktext_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
 
432
{
 
433
        PlplotCanvasHacktext *hacktext;
 
434
        ArtIRect ibbox = {0, 0, 0, 0};
 
435
 
 
436
        hacktext = (PlplotCanvasHacktext *) item;
 
437
 
 
438
        if (parent_class->update)
 
439
                (* parent_class->update) (item, affine, clip_path, flags);
 
440
 
 
441
        if (hacktext->priv->pgl)
 
442
                plplot_canvas_hacktext_req_repaint (hacktext, NULL);
 
443
 
 
444
        gnome_canvas_item_reset_bounds (item);
 
445
 
 
446
        hacktext->priv->affine[0] = affine[0];
 
447
        hacktext->priv->affine[1] = affine[1];
 
448
        hacktext->priv->affine[2] = -affine[2];
 
449
        hacktext->priv->affine[3] = -affine[3];
 
450
        hacktext->priv->affine[4] = affine[4] + hacktext->x * affine[0] + hacktext->y * affine[2];
 
451
        hacktext->priv->affine[5] = affine[5] + hacktext->x * affine[1] + hacktext->y * affine[3];
 
452
 
 
453
        if (hacktext->text) {
 
454
                if (hacktext->priv->glyphlist) {
 
455
                        gnome_glyphlist_unref (hacktext->priv->glyphlist);
 
456
                        hacktext->priv->glyphlist = NULL;
 
457
                }
 
458
 
 
459
                if (!hacktext->priv->font)
 
460
                        return;
 
461
 
 
462
                hacktext->priv->glyphlist = gnome_glyphlist_from_text_dumb (hacktext->priv->font, hacktext->fill_rgba,
 
463
                                                                            0.0, 0.0,
 
464
                                                                            hacktext->text);
 
465
        }
 
466
 
 
467
        if (hacktext->priv->glyphlist) {
 
468
                GnomePosGlyphList * pgl;
 
469
 
 
470
                pgl = gnome_pgl_from_gl (hacktext->priv->glyphlist, hacktext->priv->affine, GNOME_PGL_RENDER_DEFAULT);
 
471
 
 
472
                if (hacktext->priv->pgl)
 
473
                        gnome_pgl_destroy (hacktext->priv->pgl);
 
474
 
 
475
                hacktext->priv->pgl = pgl;
 
476
        }
 
477
               
 
478
        plplot_canvas_hacktext_req_repaint (hacktext, &ibbox);
 
479
 
 
480
        hacktext->item.x1 = ibbox.x0;
 
481
        hacktext->item.y1 = ibbox.y0;
 
482
        hacktext->item.x2 = ibbox.x1;
 
483
        hacktext->item.y2 = ibbox.y1;
 
484
}
 
485
 
 
486
static void
 
487
plplot_canvas_hacktext_realize (GnomeCanvasItem *item)
 
488
{
 
489
        PlplotCanvasHacktext *hacktext;
 
490
 
 
491
        hacktext = (PlplotCanvasHacktext *) item;
 
492
 
 
493
        if (parent_class->realize)
 
494
                (* parent_class->realize) (item);
 
495
}
 
496
 
 
497
static void
 
498
plplot_canvas_hacktext_unrealize (GnomeCanvasItem *item)
 
499
{
 
500
        PlplotCanvasHacktext *hacktext;
 
501
 
 
502
        hacktext = (PlplotCanvasHacktext *) item;
 
503
 
 
504
        if (parent_class->unrealize)
 
505
                (* parent_class->unrealize) (item);
 
506
}
 
507
 
 
508
static double
 
509
plplot_canvas_hacktext_point (GnomeCanvasItem *item, double mx, double my,
 
510
                              int cx, int cy, GnomeCanvasItem **actual_item)
 
511
{
 
512
        PlplotCanvasHacktext * hacktext;
 
513
 
 
514
        hacktext = (PlplotCanvasHacktext *) item;
 
515
 
 
516
        if (!hacktext->priv->pgl)
 
517
                return 1e18;
 
518
 
 
519
        *actual_item = item;
 
520
 
 
521
        if (gnome_pgl_test_point (hacktext->priv->pgl, cx, cy))
 
522
                return 0.0;
 
523
 
 
524
        return 1e18;
 
525
}
 
526
 
 
527
static void
 
528
plplot_canvas_hacktext_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
 
529
{
 
530
        PlplotCanvasHacktext *hacktext;
 
531
 
 
532
        g_return_if_fail (item != NULL);
 
533
        g_return_if_fail (PLPLOT_IS_CANVAS_HACKTEXT (item));
 
534
 
 
535
        hacktext = PLPLOT_CANVAS_HACKTEXT (item);
 
536
 
 
537
        if (hacktext->text == NULL) {
 
538
                *x1 = *y1 = *x2 = *y2 = 0.0;
 
539
                return;
 
540
        }
 
541
 
 
542
        get_bounds (hacktext, x1, y1, x2, y2);
 
543
}
 
544
 
 
545
static void
 
546
plplot_canvas_hacktext_req_repaint (PlplotCanvasHacktext *hacktext,
 
547
                                    ArtIRect *bbox)
 
548
{
 
549
        ArtDRect gbbox;
 
550
 
 
551
        g_return_if_fail (hacktext->priv);
 
552
 
 
553
        if (!hacktext->priv->pgl)
 
554
                return;
 
555
 
 
556
        if (gnome_pgl_bbox (hacktext->priv->pgl, &gbbox)) {
 
557
                ArtIRect ibox;
 
558
                art_drect_to_irect (&ibox, &gbbox);
 
559
                gnome_canvas_request_redraw (hacktext->item.canvas, ibox.x0, ibox.y0, ibox.x1, ibox.y1);
 
560
                if (bbox) art_irect_union (bbox, bbox, &ibox);
 
561
        }
 
562
}
 
563
 
 
564
static void
 
565
plplot_canvas_hacktext_render (GnomeCanvasItem *item,
 
566
                               GnomeCanvasBuf *buf)
 
567
{
 
568
        PlplotCanvasHacktext * hacktext;
 
569
 
 
570
        hacktext = (PlplotCanvasHacktext *) item;
 
571
 
 
572
        g_return_if_fail (hacktext->priv);
 
573
 
 
574
        if (!hacktext->priv->pgl)
 
575
                return;
 
576
 
 
577
        gnome_canvas_buf_ensure_buf (buf);
 
578
        buf->is_buf = TRUE;
 
579
        buf->is_bg = FALSE;
 
580
 
 
581
        gnome_rfont_render_pgl_rgb8 (hacktext->priv->pgl,
 
582
                                     -buf->rect.x0, -buf->rect.y0,
 
583
                                     buf->buf,
 
584
                                     buf->rect.x1 - buf->rect.x0,
 
585
                                     buf->rect.y1 - buf->rect.y0,
 
586
                                     buf->buf_rowstride,
 
587
                                     GNOME_RFONT_RENDER_DEFAULT);
 
588
}
 
589
 
 
590
 
 
591
 
 
592
 
 
593
 
 
594
 
 
595
 
 
596
 
 
597
 
 
598
 
 
599
 
 
600