UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZBarBuffer.H
1 // ZBarBuffer.H $Revision: 1.4 $ $Date: 2003/12/10 08:54:35 $
2 
3 #if !defined __ZBarBuffer_H
4 
5 #define __ZBarBuffer_H
6 
7 #include <zm/ZBarDraw.H>
8 
9 
10 /*************************************************************
11  * Draw color bars (sticks) with smart bufferization by
12  * merging two overlapped sticks of the same color into one
13  * stick.
14  *************************************************************/
15 
16 class ZBarBuffer : public ZBarDraw
17 {
18 protected:
19 
20  int prev_nocolor_bar;
21  int *start_vect; /* line of sticks' starts */
22  int *end_vect; /* line of sticks' ends */
23  unsigned *color_vect; /* line of color indeces */
24  ColorPixel *pixel_vect; /* line of real color pixels */
25  enum SpecType {
26  NoStick = 0,
27  ColorWillBeLater,
28  StickIsHere, /* see color_vect */
29  ExactColor /* see pixel_vect */
30  };
31 
32  enum SpecType *spec_vect; /* species */
33 
34  /* merges two bars and returns TRUE if it's needed flush bar
35  with returned coords. */
36  Logic merge_2_bars (int& pos, int& start, int& end);
37 
38 public:
39 
40  ZBarBuffer (const ZConnect& zconnect, Drawable drawable);
41  ZBarBuffer (const ZDrawable& zdrawable);
42  virtual ~ZBarBuffer ();
43 
44  /* set rectangle of clip drawings */
45  virtual void set_cliprect (ZRect& r);
46 
47  /* interpret position as x-coord (vertical bars -- flip FALSE)
48  or as y-coord (horizontal bars -- flip TRUE) */
49  virtual void flip (Logic new_flag);
50 
51  /* draw one bar in pointed position from start to end
52  with color index in attached palette (Not ColorPixel!!!) */
53  virtual void draw_bar (int pos, int start, int end,
54  unsigned color);
55 
56  /* draw one bar in pointed position from start to end
57  with undefined color index -- will be known after set_color() */
58  virtual void draw_bar (int pos, int start, int end);
59 
60  /* assign color index to all previously "drawn" bars */
61  virtual void set_color (unsigned color);
62 
63  /* draw one bar in pointed position from start to end
64  with exact ColorPixel as a color */
65  virtual void draw_bar_cp (int pos, int start, int end,
66  ColorPixel cp);
67 
68  /* send all segment buffers to X-server */
69  virtual void flush_bars ();
70 
71 };
72 
73 #endif // ZBarBuffer.H
Definition: ZBase.H:87
Definition: ZBase.H:118
Definition: ZBase.H:259
Definition: ZBarDraw.H:19
Definition: ZBarBuffer.H:16