summaryrefslogtreecommitdiffstats
path: root/kernel/kls_ttf/ftview/grobjs.h
blob: 038ec540142ed49dc88229373159241def351bc7 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/***************************************************************************
 *
 *  grobjs.h
 *
 *    basic object classes defintions
 *
 *  Copyright 1999 - The FreeType Development Team - www.freetype.org
 *
 *
 *
 *
 ***************************************************************************/

#ifndef GROBJS_H
#define GROBJS_H

#include "graph.h"
#include "grconfig.h"
#include "grtypes.h"


  typedef struct grBiColor_
  {
    grColor   foreground;
    grColor   background;

    int       num_levels;
    int       max_levels;
    grColor*  levels;

  } grBiColor;



 /**********************************************************************
  *
  * Technical note : explaining how the blitter works.
  *
  *   The blitter is used to "draw" a given source bitmap into
  *   a given target bitmap.
  *
  *   The function called 'compute_clips' is used to compute clipping
  *   constraints. These lead us to compute two areas :
  *
  *   - the read area : is the rectangle, within the source bitmap,
  *                     which will be effectively "drawn" in the
  *                     target bitmap.
  *
  *   - the write area : is the rectangle, within the target bitmap,
  *                      which will effectively "receive" the pixels
  *                      from the read area
  *
  *   Note that both areas have the same dimensions, but are
  *   located in distinct surfaces.
  *
  *   These areas are computed by 'compute_clips' which is called
  *   by each blitting function.
  *
  *   Note that we use the Y-downwards convention within the blitter
  *
  **********************************************************************/

  typedef struct grBlitter_
  {
    int  width;   /* width in pixels of the areas  */
    int  height;  /* height in pixels of the areas */

    int  xread;   /* x position of start point in read area */
    int  yread;   /* y position of start point in read area */

    int  xwrite;  /* x position of start point in write area */
    int  ywrite;  /* y position of start point in write area */

    int  right_clip;   /* amount of right clip               */

    unsigned char*  read;   /* top left corner of read area in source map  */
    unsigned char*  write;  /* top left corner of write area in target map */

    int    read_line;  /* byte increment to go down one row in read area  */
    int    write_line; /* byte increment to go down one row in write area */

    grBitmap  source;  /* source bitmap descriptor */
    grBitmap  target;  /* target bitmap descriptor */

  } grBlitter;



  typedef void (*grBlitterFunc)( grBlitter*  blitter,
                                 grColor     color );

  typedef void (*grSetTitleFunc)( grSurface*   surface,
                                  const char*  title_string );

  typedef void (*grRefreshRectFunc)( grSurface*  surface,
                                     int         x,
                                     int         y,
                                     int         width,
                                     int         height );

  typedef void (*grDoneSurfaceFunc)( grSurface*  surface );

  typedef int  (*grListenEventFunc)( grSurface* surface,
                                     int        event_mode,
                                     grEvent   *event );



  struct grSurface_
  {
    grDevice*          device;
    grBitmap           bitmap;
    grBool             refresh;
    grBool             owner;

    const byte*        saturation;  /* used for gray surfaces only   */
    grBlitterFunc      blit_mono;   /* 0 by default, set by grBlit.. */

    grRefreshRectFunc  refresh_rect;
    grSetTitleFunc     set_title;
    grListenEventFunc  listen_event;
    grDoneSurfaceFunc  done;
  };



 /********************************************************************
  *
  * <Function>
  *   grAlloc
  *
  * <Description>
  *   Simple memory allocation. The returned block is always zero-ed
  *
  * <Input>
  *   size  :: size in bytes of the requested block
  *
  * <Return>
  *   the memory block address. 0 in case of error
  *
  ********************************************************************/

  extern  unsigned char*  grAlloc( long size );


 /********************************************************************
  *
  * <Function>
  *   grRealloc
  *
  * <Description>
  *   Simple memory re-allocation.
  *
  * <Input>
  *   block :: original memory block address
  *   size  :: new requested block size in bytes
  *
  * <Return>
  *   the memory block address. 0 in case of error
  *
  ********************************************************************/

  extern unsigned char*  grRealloc( const unsigned char*  block, long size );


 /********************************************************************
  *
  * <Function>
  *   grFree
  *
  * <Description>
  *   Simple memory release
  *
  * <Input>
  *   block :: target block
  *
  ********************************************************************/

  extern void  grFree( const void*  block );


#endif /* GROBJS_H */