summaryrefslogtreecommitdiff
path: root/src/gdk/cdgdk.h
blob: ba7efe0ccb621b312ac8038664612d4808047be7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/** \file
 * \brief Gdk Base Driver
 *
 * See Copyright Notice in cd.h
 */

#ifndef __CDGDK_H
#define __CDGDK_H

#include <gdk/gdk.h>

#include "cd.h"
#include "cd_private.h"


struct _cdCtxImage {
  unsigned int w, h, depth;
  GdkPixmap* img;
  GdkScreen* scr;
  GdkVisual* vis;
};

struct _cdCtxCanvas {
  cdCanvas* canvas;
  GdkVisual* vis;            /* visual of the application */
  GdkScreen *scr;
  GdkGC* gc;                 /* graphic context */
  GdkDrawable* wnd;          /* drawable */
  GdkColor fg, bg;

  GdkGCValues gcval;

  GdkPixmap* last_hatch;     /* last hatch   set by user */
  GdkPixmap* last_stipple;   /* last stipple set by user */
  GdkPixmap* last_pattern;   /* last pattern set by user */
  GdkGC* last_stipple_gc;
  int last_stipple_w;
  int last_stipple_h;

  GdkGC* last_pattern_gc;
  int last_pattern_w;
  int last_pattern_h;

  unsigned int depth;        /* canvas depth */
  GdkPixmap* clip_polygon;   /* clipping polygon */
  GdkPixmap* new_region;
  GdkPixmap* region_aux;
  GdkGC* region_aux_gc;
  long int *xidata;          /* Image cache */
  int xisize;
  GdkColormap* colormap;     /* Color map default */
  GdkColor* color_table;     /* Color table of the color map */
  int num_colors;            /* Size of the color table  */
  int rshift;                /* Red constant to calculate the true color */
  int gshift;                /* Green constant to calculate the true color */
  int bshift;                /* Blue constant to calculate the true color */
  double xmatrix[6];         /* Transformation matrix that includes axis inversion */
  float rotate_angle;
  int rotate_center_x;
  int rotate_center_y;

  PangoContext *fontcontext;
  PangoFontDescription *fontdesc;
  PangoLayout *fontlayout;
  PangoMatrix fontmatrix;
  char* gdkLastConvertUTF8;

  cdImage* image_dbuffer;       /* Used by double buffer driver */
  cdCanvas* canvas_dbuffer;
};

#define cdCOLOR8TO16(_x) (_x*257)  /* 65535/255 = 257 */
#define cdCOLOR16TO8(_x) ((unsigned char)(_x/257))

cdCtxCanvas *cdgdkCreateCanvas(cdCanvas* canvas, GdkDrawable* wnd, GdkScreen* scr, GdkVisual* vis);
void cdgdkInitTable(cdCanvas* canvas);
void cdgdkKillCanvas(cdCtxCanvas *ctxcanvas);
int cdgdkClip(cdCtxCanvas *ctxcanvas, int clip_mode);
void cdgdkPoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n);

#endif