g4tools  5.4.0
buffer
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_zb_buffer
5 #define tools_zb_buffer
6 
7 #include <cfloat> //DBL_MAX
8 
9 #include "polygon"
10 
11 namespace tools {
12 namespace zb {
13 
14 // ZPos, ZZ defined in point.
15 
16 class buffer {
17 
18  typedef double ZReal;
19  static ZReal ZREAL_HUGE() {return DBL_MAX;}
20 
21 public:
22  typedef unsigned int ZPixel;
23  //NOTE : with X11, bits_per_pixel can't be > 32.
24 protected:
25 
26  class writer {
27  public:
28  virtual void write(ZPos,ZPos,ZZ) = 0;
29  public:
30  writer(ZPixel a_pixel):m_pixel(a_pixel){}
31  virtual ~writer(){}
32  public:
33  writer(const writer& a_from):m_pixel(a_from.m_pixel){}
34  writer& operator=(const writer& a_from){
35  m_pixel = a_from.m_pixel;
36  return *this;
37  }
38  public:
40  };
41 
42  class point_writer : public virtual writer {
43  public:
44  virtual void write(ZPos a_x,ZPos a_y,ZZ a_z) {
45  if(m_size>=1) { //see zb_action::npix().
46  ZPos x,y;
47  for(int i=-int(m_size);i<=int(m_size);i++) {
48  x = a_x + i;
49  for(int j=-int(m_size);j<=int(m_size);j++) {
50  y = a_y + j;
51  _write(x,y,a_z);
52  }
53  }
54  } else {
55  _write(a_x,a_y,a_z);
56  }
57  }
58  public:
59  point_writer(ZPixel a_pixel,buffer& a_buffer,unsigned int a_size)
60  :writer(a_pixel)
61  ,m_buffer(a_buffer)
62  ,m_size(a_size)
63  {}
64  virtual ~point_writer(){}
65  public:
66  point_writer(const point_writer& a_from)
67  :writer(a_from)
68  ,m_buffer(a_from.m_buffer)
69  ,m_size(a_from.m_size)
70  {}
72  writer::operator=(a_from);
73  m_size = a_from.m_size;
74  return *this;
75  }
76  public:
77  bool get_pixel(ZPos a_x,ZPos a_y,ZZ /*a_z*/,ZPixel& a_pixel) const {
78  if((a_x<m_buffer.m_begX) || (a_x>m_buffer.m_endX)) {a_pixel=0;return false;}
79  if((a_y<m_buffer.m_begY) || (a_y>m_buffer.m_endY)) {a_pixel=0;return false;}
80  unsigned long offset = a_y * m_buffer.m_zbw + a_x;
81  ZPixel* zimage = m_buffer.m_zimage + offset;
82  a_pixel = *zimage;
83  return true;
84  }
85  protected:
86  void _write(ZPos a_x,ZPos a_y,ZZ a_z) {
87  if((a_x<m_buffer.m_begX) || (a_x>m_buffer.m_endX)) return;
88  if((a_y<m_buffer.m_begY) || (a_y>m_buffer.m_endY)) return;
89 
90  ZReal zpoint = (ZReal)a_z;
91  unsigned long offset = a_y * m_buffer.m_zbw + a_x;
92  ZReal* zbuff = m_buffer.m_zbuffer + offset;
93 
94  if(m_buffer.m_depth_test) {if(zpoint<*zbuff) return;}
95 
96  ZPixel* zimage = m_buffer.m_zimage + offset;
97 
98  /* transparency :
99  ZPixel old_pix = *zimage;
100  // need the alpha of m_pixel !
101  */
102 
103  *zbuff = zpoint;
104  *zimage = m_pixel;
105  }
106  protected:
108  unsigned int m_size;
109  };
110 
111 /*
112  class edge_point_writer : public virtual writer {
113  public:
114  virtual void write(ZPos a_x,ZPos a_y,ZZ) {
115  if((a_x<m_buffer.m_begX) || (a_x>m_buffer.m_endX)) return;
116  if((a_y<m_buffer.m_begY) || (a_y>m_buffer.m_endY)) return;
117 
118  // Computing must be the same as in WriteScanLine routine.
119  ZReal zpoint =
120  (ZReal)(- m_buffer.m_planeDC
121  - m_buffer.m_planeAC * a_x
122  - m_buffer.m_planeBC * a_y);
123 
124  // for edge plane quite perpandicular to screen
125  //if((zpoint<m_buffer.m_zmin)||(zpoint>m_buffer.m_zmax)) return;
126 
127  unsigned long offset = a_y * m_buffer.m_zbw + a_x;
128  ZReal* zbuff = m_buffer.m_zbuffer + offset;
129 
130  if(m_buffer.m_depth_test) {if(zpoint<*zbuff) return;}
131 
132  ZPixel* zimage = m_buffer.m_zimage + offset;
133  *zbuff = zpoint;
134  *zimage = m_pixel;
135  }
136  public:
137  edge_point_writer(ZPixel a_pixel,buffer& a_buffer)
138  :writer(a_pixel)
139  ,m_buffer(a_buffer)
140  {}
141  virtual ~edge_point_writer(){}
142  public:
143  edge_point_writer(const edge_point_writer& a_from)
144  :writer(a_from)
145  ,m_buffer(a_from.m_buffer)
146  {}
147  edge_point_writer& operator=(const edge_point_writer& a_from){
148  writer::operator=(a_from);
149  return *this;
150  }
151  protected:
152  buffer& m_buffer;
153  };
154 */
155 
156 public:
158  :m_depth_test(true)
159  ,m_zbuffer(0)
160  //,m_zmin(0),m_zmax(0)
161  ,m_zimage(0)
162  ,m_zbw(0),m_zbh(0)
163  ,m_begX(0),m_begY(0),m_endX(0),m_endY(0)
164  ,m_scan_pixel(0L)
165  ,m_planeAC(0),m_planeBC(0),m_planeDC(0)
166  //,m_zboundPrec(10)
167  {}
168  virtual ~buffer(){
171  m_zbw = 0;
172  m_zbh = 0;
173  m_polygon.clear();
174  }
175 protected:
176  buffer(const buffer& a_from)
177  :m_depth_test(a_from.m_depth_test)
178  {}
179  buffer& operator=(const buffer& a_from){
180  m_depth_test = a_from.m_depth_test;
181  return *this;
182  }
183 public:
184  void set_depth_test(bool a_on) {m_depth_test = a_on;}
185  //bool depth_test() const {return m_depth_test;}
186 
187  bool change_size(unsigned int a_width,unsigned int a_height){
188  if(!a_width||!a_height) return false;
189 
190  if(m_zbuffer && (m_zbw==a_width) && (m_zbh==a_height) ) return true;
191 
192  if(m_zbuffer){
195  }
196 
197  //printf ("debug:ZBufferChangeSize:%d %d\n",a_width,a_height);
198  m_zbw = a_width;
199  m_zbh = a_height;
200  m_zbuffer = cmem_alloc<ZReal>(m_zbw*m_zbh);
201  if(!m_zbuffer){
202  m_zbw = 0;
203  m_zbh = 0;
204  return false;
205  }
206 
207  m_zimage = cmem_alloc<ZPixel>(m_zbw*m_zbh);
208  if(!m_zimage){
210  m_zbw = 0;
211  m_zbh = 0;
212  return false;
213  }
214 
215  // Init buffer done by further call to ZBufferErase.
216  /*
217  unsigned int size = m_zbw * m_zbh;
218  ZReal* zbuffer = m_zbuffer;
219  ZPixel* zimage = m_zimage;
220  for(unsigned int count=0;count<size;count++,zbuffer++,zimage++){
221  *zimage = 0;
222  *zbuffer = - ZREAL_HUGE();
223  }
224  */
225 
227  m_polygon.clear();
228  return true;
229  }
230 
231  ZPixel* get_color_buffer(unsigned int& a_width,
232  unsigned int& a_height) const {
233  a_width = m_zbw;
234  a_height = m_zbh;
235  return m_zimage;
236  }
237 
238  void clear_color_buffer(ZPixel a_pixel) {
239  // Erase acoording clip region.
240  ZPos row,col;
241  for(row=m_begY;row<=m_endY;row++){
242  ZPixel* zimage = m_zimage + row * m_zbw + m_begX;
243  for(col=m_begX;col<=m_endX;col++,zimage++) *zimage = a_pixel;
244  }
245  }
246 
248  // Erase acoording clip region.
249  ZPos row,col;
250  //printf("debug:ZBufferClearDepthBuffer: %g.\n",a_depth);
251 
252  for(row=m_begY;row<=m_endY;row++) {
253  ZReal* zbuff = m_zbuffer + row * m_zbw + m_begX;
254  for(col=m_begX;col<=m_endX;col++,zbuff++){
255  *zbuff = - ZREAL_HUGE();
256  }
257  }
258  }
259 
260  //ZPixel get_pixel(ZPos a_x,ZPos a_y) const {
261  // return *(m_zimage + a_y * m_zbw + a_x);
262  //}
263 
264  bool get_clipped_pixel(ZPos a_x,ZPos a_y,ZPixel& a_pixel) const {
265  if((a_x<m_begX) || (a_x>m_endX)) return false;
266  if((a_y<m_begY) || (a_y>m_endY)) return false;
267  a_pixel = *(m_zimage + a_y * m_zbw + a_x);
268  return true;
269  }
270 
271 public:
272  void set_clip_region(ZPos a_x,ZPos a_y,unsigned int a_width,unsigned int a_height){
273  // if a_width or a_height is zero, clip region is empty.
274 
275  m_begX = a_x;
276  m_begY = a_y;
277  m_endX = a_x + a_width - 1;
278  m_endY = a_y + a_height - 1;
279 
280  if(m_begX<0) m_begX = 0;
281  if(m_begY<0) m_begY = 0;
282  if(m_endX>ZPos(m_zbw-1)) m_endX = m_zbw-1;
283  if(m_endY>ZPos(m_zbh-1)) m_endY = m_zbh-1;
284  }
285 
286  void draw_point(const point& a_p,ZPixel a_pixel,unsigned int a_size){
287  point_writer pw(a_pixel,*this,a_size);
288  pw.write(a_p.x,a_p.y,a_p.z);
289  }
290 
291  bool get_pixel(const point& a_p,ZPixel& a_pixel){
292  point_writer pw(a_pixel,*this,1);
293  return pw.get_pixel(a_p.x,a_p.y,a_p.z,a_pixel);
294  }
295 
296  void draw_line(const point& a_beg,const point& a_end,ZPixel a_pixel,unsigned int a_size){
297  point_writer pw(a_pixel,*this,a_size);
298  WriteLine(a_beg,a_end,pw);
299  }
300 
301  void draw_lines(int a_number,const point* a_list,ZPixel a_pixel,unsigned int a_size){
302  point_writer pw(a_pixel,*this,a_size);
303  for(int count=1;count<a_number;count++) {
304  WriteLine(a_list[count-1],a_list[count],pw);
305  }
306  }
307 
308  void draw_segments(int a_number,const point* a_list,ZPixel a_pixel,unsigned int a_size){
309  point_writer pw(a_pixel,*this,a_size);
310  int segment_number = a_number/2;
311  for(int count=0;count<segment_number;count++) {
312  WriteLine(a_list[2*count],a_list[2*count+1],pw);
313  }
314  }
315  void draw_markers(int a_number,const point* a_list,ZPixel a_pixel,unsigned int a_size){
316  point_writer pw(a_pixel,*this,a_size);
317  for(int count=0;count<a_number;count++){
318  const point& p = a_list[count];
319  pw.write(p.x,p.y,p.z);
320  }
321  }
322 
323  void draw_polygon(int a_number,const point* a_list,
324  ZZ a_A,ZZ a_B,ZZ a_C,ZZ a_D,
325  //ZZ a_zmin,ZZ a_zmax,
326  ZPixel a_pixel){
327  // Assume a_list is closed.
328  if(a_number<3) return;
329  if(a_C==0) return; //polygone seen from edge
330  //if(m_zboundPrec<0) m_zboundPrec = 0;
331 
332  m_scan_pixel = a_pixel;
333  m_planeAC = a_A/a_C;
334  m_planeBC = a_B/a_C;
335  m_planeDC = a_D/a_C;
336 
337  //if this polygon A is quite perpandicular to screen and close
338  //to an other B than |dz| then some pixel of A could overwrite
339  //pixel of B. Your have then to give a lower m_zboundPrec
340 
341  //ZZ dz = m_zboundPrec * (a_zmax - a_zmin)/100.;
342  //m_zmin = (ZReal)(a_zmin - dz);
343  //m_zmax = (ZReal)(a_zmax + dz);
344 
345  m_polygon.scan(a_number,a_list,0,WriteScanLine,this);
346 
347  }
348 
349 /*
350  void draw_edged_polygon(int a_number,const point* a_list,
351  ZZ a_A,ZZ a_B,ZZ a_C,ZZ a_D,
352  //ZZ a_zmin,ZZ a_zmax,
353  ZPixel a_pixel){
354  // Assume a_list is closed.
355  if(a_number<3) return;
356  if(a_C==0) return; // polygone seen from edge
357  //if(m_zboundPrec<0) m_zboundPrec = 0;
358 
359  m_scan_pixel = a_pixel;
360  m_planeAC = a_A/a_C;
361  m_planeBC = a_B/a_C;
362  m_planeDC = a_D/a_C;
363 
364  //if this polygon A is quite perpandicular to screen and close
365  //to an other B than |dz| then some pixel of A could overwrite
366  //pixel of B. Your have then to give a lower m_zboundPrec
367 
368  //ZZ dz = m_zboundPrec * (a_zmax - a_zmin)/100.;
369  //m_zmin = (ZReal)(a_zmin - dz);
370  //m_zmax = (ZReal)(a_zmax + dz);
371 
372  // draw edge :
373 
374  edge_point_writer pw(a_pixel,*this);
375 
376  // some pixel could be out of range [plane.zmin,plane.zmax].
377  for(int count=1;count<a_number;count++) {
378  WriteLine(a_list[count-1],a_list[count],pw);
379  }
380  }
381 */
382 protected:
383  class scan_writer {
384  public:
385  virtual void write(ZPos,ZPos,ZZ,ZPos) = 0;
386  public:
387  virtual ~scan_writer(){}
388  };
389 
390  class scan_writer_1 : public virtual scan_writer {
391  public:
392  virtual void write(ZPos a_x,ZPos a_y,ZZ a_z,ZPos) {
393  m_writer.write(a_x,a_y,a_z);
394  }
395  public:
396  scan_writer_1(writer& a_writer):m_writer(a_writer){}
397  virtual ~scan_writer_1(){}
398  public:
400  :scan_writer(a_from)
401  ,m_writer(a_from.m_writer)
402  {}
403  scan_writer_1& operator=(const scan_writer_1&){return *this;}
404  protected:
406  };
407 
408  class scan_writer_2 : public virtual scan_writer {
409  public:
410  virtual void write(ZPos a_x,ZPos a_y,ZZ a_z,ZPos) {
411  m_writer.write(a_y,a_x,a_z);
412  }
413  public:
414  scan_writer_2(writer& a_writer):m_writer(a_writer){}
415  virtual ~scan_writer_2(){}
416  public:
418  :scan_writer(a_from)
419  ,m_writer(a_from.m_writer)
420  {}
421  scan_writer_2& operator=(const scan_writer_2&){return *this;}
422  protected:
424  };
425 
426  class scan_writer_3 : public virtual scan_writer {
427  public:
428  virtual void write(ZPos a_x,ZPos a_y,ZZ a_z,ZPos a_beg) {
429  m_writer.write(a_x,2*a_beg-a_y,a_z);
430  }
431  public:
432  scan_writer_3(writer& a_writer):m_writer(a_writer){}
433  virtual ~scan_writer_3(){}
434  public:
436  :scan_writer(a_from)
437  ,m_writer(a_from.m_writer)
438  {}
439  scan_writer_3& operator=(const scan_writer_3&){return *this;}
440  protected:
442  };
443 
444  class scan_writer_4 : public virtual scan_writer {
445  public:
446  virtual void write(ZPos a_x,ZPos a_y,ZZ a_z,ZPos a_beg) {
447  m_writer.write(2*a_beg-a_y,a_x,a_z);
448  }
449  public:
450  scan_writer_4(writer& a_writer):m_writer(a_writer){}
451  virtual ~scan_writer_4(){}
452  public:
454  :scan_writer(a_from)
455  ,m_writer(a_from.m_writer)
456  {}
457  scan_writer_4& operator=(const scan_writer_4&){return *this;}
458  protected:
460  };
461 
462  static void WriteScanLine(void* a_tag,int a_beg,int a_end,int a_y){
463  buffer& a_buffer = *((buffer*)a_tag);
464 
465  if((a_y<a_buffer.m_begY) || (a_y>a_buffer.m_endY)) return;
466  if(a_end<=a_beg) return;
467 
468  if(a_beg>a_buffer.m_endX) return;
469  if(a_end<a_buffer.m_begX) return;
470 
471  // border clip :
472  int beg = mx(a_beg,(int)a_buffer.m_begX);
473  int end = mn(a_end,(int)a_buffer.m_endX);
474 
475  unsigned long offset = a_y * a_buffer.m_zbw + beg;
476  ZReal* zbuff = a_buffer.m_zbuffer + offset;
477  ZPixel* zimage = a_buffer.m_zimage + offset;
478 
479  ZReal zpoint;
480  for(int x=beg;x<=end;x++){
481  // Computing must be the same as in edge_point_writer routine.
482  zpoint =
483  (ZReal)(- a_buffer.m_planeDC
484  - a_buffer.m_planeAC * x
485  - a_buffer.m_planeBC * a_y);
486  if(a_buffer.m_depth_test) {
487  if((zpoint>=(*zbuff))
488 // &&(zpoint>=a_buffer.m_zmin) //for plane quite perpandicular to screen.
489 // &&(zpoint<=a_buffer.m_zmax)
490  ){
491  *zbuff = zpoint;
492  *zimage = a_buffer.m_scan_pixel;
493  }
494  } else {
495  *zbuff = zpoint;
496  *zimage = a_buffer.m_scan_pixel;
497  }
498  zbuff ++;
499  zimage ++;
500  }
501  }
502 
503  static void WriteLine(const point& a_beg,
504  const point& a_end,
505  writer& a_writer){
506  ZPos dx = a_end.x - a_beg.x;
507  ZPos dy = a_end.y - a_beg.y;
508  ZZ dz = a_end.z - a_beg.z;
509 
510  // 6 2
511  // 5 1
512  // 7 3
513  // 8 4
514  scan_writer_1 sw1(a_writer);
515  scan_writer_2 sw2(a_writer);
516  scan_writer_3 sw3(a_writer);
517  scan_writer_4 sw4(a_writer);
518 
519  if( (dx==0) && (dy==0) ) {
520  a_writer.write(a_beg.x,a_beg.y,a_beg.z);
521  a_writer.write(a_end.x,a_end.y,a_end.z);
522 
523  } else if(dx==0) {
524  if(dy>0)
525  ScanLine ( a_beg.y, a_beg.x,a_beg.z, dy, dx, dz,sw2);
526  else
527  ScanLine ( a_end.y, a_end.x,a_end.z,-dy, dx,-dz,sw2);
528 
529  } else if(dx>0) {
530  if((0<=dy) && (dy<=dx)) /*1*/
531  ScanLine ( a_beg.x, a_beg.y,a_beg.z, dx, dy, dz,sw1);
532  else if(dx<dy) /*2*/
533  ScanLine ( a_beg.y, a_beg.x,a_beg.z, dy, dx, dz,sw2);
534  else if((-dx<=dy) && (dy<0) ) /*3*/
535  ScanLine ( a_beg.x, a_beg.y,a_beg.z, dx,-dy, dz,sw3);
536  else if(dy<-dx) /*4*/
537  ScanLine ( a_end.y, a_end.x,a_end.z,-dy, dx,-dz,sw4);
538 
539  } else { //dx<0
540  if((0<=dy) && (dy<=-dx)) /*5*/
541  ScanLine ( a_end.x, a_end.y,a_end.z,-dx, dy,-dz,sw3);
542  else if(-dx<dy) /*6*/
543  ScanLine ( a_beg.y, a_beg.x,a_beg.z, dy,-dx, dz,sw4);
544  else if((dx<=dy) && (dy<0) ) /*7*/
545  ScanLine ( a_end.x, a_end.y,a_end.z,-dx,-dy,-dz,sw1);
546  else if(dy<dx) /*8*/
547  ScanLine ( a_end.y, a_end.x,a_end.z,-dy,-dx,-dz,sw2);
548  }
549 
550  }
551 
552  static void ScanLine(ZPos a_x,ZPos a_y,ZZ a_z,
553  ZPos a_dx,ZPos a_dy,ZZ a_dz,
554  scan_writer& a_proc){
555  // Mid point algorithm
556  // assume 0<dx 0<=dy<=dx
557 
558  ZPos end = a_x + a_dx;
559  ZPos beg = a_y;
560  ZZ incz = a_dz/(ZZ)a_dx;
561  if(a_dy==0) {
562  a_proc.write(a_x,a_y,a_z,beg);
563  while(a_x<end){
564  a_x++;
565  a_z += incz;
566  a_proc.write(a_x,a_y,a_z,beg);
567  }
568  } else if(a_dy==a_dx) {
569  a_proc.write(a_x,a_y,a_z,beg);
570  while(a_x<end){
571  a_x++;
572  a_y++;
573  a_z += incz;
574  a_proc.write(a_x,a_y,a_z,beg);
575  }
576  } else {
577  ZPos d = 2 * a_dy - a_dx;
578  ZPos incrE = 2 * a_dy;
579  ZPos incrNE = 2 * ( a_dy - a_dx);
580  a_proc.write(a_x,a_y,a_z,beg);
581  while(a_x<end){
582  if(d<=0){
583  d += incrE;
584  a_x++;
585  }else{
586  d += incrNE;
587  a_x++;
588  a_y++;
589  }
590  a_z += incz;
591  a_proc.write(a_x,a_y,a_z,beg);
592  }
593  }
594  }
595 
596 protected:
598  ZReal* m_zbuffer;
599 //ZReal m_zmin,m_zmax;
600 
602 
603  unsigned int m_zbw,m_zbh;
605  ZPos m_endX,m_endY; //could be <0
606 
611  //int m_zboundPrec;
613 };
614 
615 }}
616 
617 #endif
tools::zb::buffer::point_writer
Definition: buffer:42
tools::zb::buffer::set_depth_test
void set_depth_test(bool a_on)
Definition: buffer:184
tools::zb::buffer::m_depth_test
bool m_depth_test
Definition: buffer:597
tools::zb::buffer::scan_writer::write
virtual void write(ZPos, ZPos, ZZ, ZPos)=0
tools::zb::buffer::change_size
bool change_size(unsigned int a_width, unsigned int a_height)
Definition: buffer:187
tools::zb::buffer::writer::~writer
virtual ~writer()
Definition: buffer:31
tools::zb::buffer::writer::write
virtual void write(ZPos, ZPos, ZZ)=0
tools::zb::buffer::scan_writer_4::~scan_writer_4
virtual ~scan_writer_4()
Definition: buffer:451
tools::zb::buffer::get_pixel
bool get_pixel(const point &a_p, ZPixel &a_pixel)
Definition: buffer:291
tools::zb::buffer::m_polygon
polygon m_polygon
Definition: buffer:612
tools::zb::buffer::~buffer
virtual ~buffer()
Definition: buffer:168
tools::zb::buffer::clear_depth_buffer
void clear_depth_buffer()
Definition: buffer:247
tools::zb::buffer::get_clipped_pixel
bool get_clipped_pixel(ZPos a_x, ZPos a_y, ZPixel &a_pixel) const
Definition: buffer:264
tools::zb::buffer::scan_writer_2::operator=
scan_writer_2 & operator=(const scan_writer_2 &)
Definition: buffer:421
tools::zb::buffer::scan_writer_4::scan_writer_4
scan_writer_4(writer &a_writer)
Definition: buffer:450
tools::zb::buffer::scan_writer_1::m_writer
writer & m_writer
Definition: buffer:405
tools::zb::buffer::scan_writer_3::~scan_writer_3
virtual ~scan_writer_3()
Definition: buffer:433
tools::zb::buffer::point_writer::m_buffer
buffer & m_buffer
Definition: buffer:107
tools::zb::buffer::scan_writer_1::~scan_writer_1
virtual ~scan_writer_1()
Definition: buffer:397
tools::zb::buffer::m_zbuffer
ZReal * m_zbuffer
Definition: buffer:598
tools::zb::buffer::get_color_buffer
ZPixel * get_color_buffer(unsigned int &a_width, unsigned int &a_height) const
Definition: buffer:231
tools::zb::point::y
ZPos y
Definition: point:26
tools::zb::buffer::writer
Definition: buffer:26
tools::zb::buffer::scan_writer_2::scan_writer_2
scan_writer_2(const scan_writer_2 &a_from)
Definition: buffer:417
tools::cmem_free
void cmem_free(T *&a_p)
Definition: cmemT:16
tools::zb::polygon::clear
void clear()
Definition: polygon:33
tools::zb::buffer::scan_writer_2::write
virtual void write(ZPos a_x, ZPos a_y, ZZ a_z, ZPos)
Definition: buffer:410
tools::zb::buffer::point_writer::operator=
point_writer & operator=(const point_writer &a_from)
Definition: buffer:71
tools::mn
T mn(const T &a, const T &b)
Definition: mnmx:10
tools::zb::buffer::m_planeAC
ZZ m_planeAC
Definition: buffer:608
tools::mx
T mx(const T &a, const T &b)
Definition: mnmx:13
tools::zb::buffer::m_zimage
ZPixel * m_zimage
Definition: buffer:601
tools::zb::buffer::WriteLine
static void WriteLine(const point &a_beg, const point &a_end, writer &a_writer)
Definition: buffer:503
tools::zb::buffer::scan_writer_3::write
virtual void write(ZPos a_x, ZPos a_y, ZZ a_z, ZPos a_beg)
Definition: buffer:428
polygon
tools::zb::buffer::scan_writer_4::operator=
scan_writer_4 & operator=(const scan_writer_4 &)
Definition: buffer:457
tools::zb::buffer::scan_writer
Definition: buffer:383
tools::zb::ZZ
double ZZ
Definition: point:11
tools::zb::buffer::point_writer::~point_writer
virtual ~point_writer()
Definition: buffer:64
tools::zb::buffer::draw_point
void draw_point(const point &a_p, ZPixel a_pixel, unsigned int a_size)
Definition: buffer:286
tools::zb::buffer::ScanLine
static void ScanLine(ZPos a_x, ZPos a_y, ZZ a_z, ZPos a_dx, ZPos a_dy, ZZ a_dz, scan_writer &a_proc)
Definition: buffer:552
tools::zb::buffer::point_writer::get_pixel
bool get_pixel(ZPos a_x, ZPos a_y, ZZ, ZPixel &a_pixel) const
Definition: buffer:77
tools::zb::buffer::scan_writer_2::scan_writer_2
scan_writer_2(writer &a_writer)
Definition: buffer:414
tools::zb::buffer::m_zbh
unsigned int m_zbh
Definition: buffer:603
tools::zb::buffer::m_planeDC
ZZ m_planeDC
Definition: buffer:610
tools::zb::buffer::m_planeBC
ZZ m_planeBC
Definition: buffer:609
tools::zb::buffer::scan_writer_4::m_writer
writer & m_writer
Definition: buffer:459
tools::zb::point::z
ZZ z
Definition: point:27
tools::zb::point::x
ZPos x
Definition: point:25
tools::zb::buffer::m_begX
ZPos m_begX
Definition: buffer:604
tools::zb::buffer::clear_color_buffer
void clear_color_buffer(ZPixel a_pixel)
Definition: buffer:238
tools::zb::buffer::m_endX
ZPos m_endX
Definition: buffer:605
tools::zb::point
Definition: point:13
tools::zb::buffer::scan_writer_2::~scan_writer_2
virtual ~scan_writer_2()
Definition: buffer:415
tools::zb::buffer::draw_segments
void draw_segments(int a_number, const point *a_list, ZPixel a_pixel, unsigned int a_size)
Definition: buffer:308
tools::zb::buffer::draw_lines
void draw_lines(int a_number, const point *a_list, ZPixel a_pixel, unsigned int a_size)
Definition: buffer:301
tools::zb::buffer::scan_writer_4::scan_writer_4
scan_writer_4(const scan_writer_4 &a_from)
Definition: buffer:453
tools::zb::buffer::buffer
buffer(const buffer &a_from)
Definition: buffer:176
tools::zb::polygon::scan
void scan(int Count, const point *Pts, int rule, scan_func a_proc, void *a_tag)
Definition: polygon:48
tools::zb::polygon
Definition: polygon:13
tools::zb::buffer::m_scan_pixel
ZPixel m_scan_pixel
Definition: buffer:607
tools::zb::buffer::scan_writer_4::write
virtual void write(ZPos a_x, ZPos a_y, ZZ a_z, ZPos a_beg)
Definition: buffer:446
tools::zb::buffer::draw_markers
void draw_markers(int a_number, const point *a_list, ZPixel a_pixel, unsigned int a_size)
Definition: buffer:315
tools::zb::buffer::scan_writer_3::scan_writer_3
scan_writer_3(writer &a_writer)
Definition: buffer:432
tools::zb::buffer::operator=
buffer & operator=(const buffer &a_from)
Definition: buffer:179
tools::zb::buffer::scan_writer_1::write
virtual void write(ZPos a_x, ZPos a_y, ZZ a_z, ZPos)
Definition: buffer:392
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::zb::buffer::ZPixel
unsigned int ZPixel
Definition: buffer:22
tools::zb::buffer
Definition: buffer:16
tools::zb::buffer::draw_line
void draw_line(const point &a_beg, const point &a_end, ZPixel a_pixel, unsigned int a_size)
Definition: buffer:296
tools::zb::buffer::point_writer::point_writer
point_writer(ZPixel a_pixel, buffer &a_buffer, unsigned int a_size)
Definition: buffer:59
tools::zb::buffer::scan_writer_2
Definition: buffer:408
tools::waxml::end
void end(std::ostream &a_writer)
Definition: begend:31
tools::zb::ZPos
int ZPos
Definition: point:10
tools::zb::buffer::scan_writer_4
Definition: buffer:444
tools::zb::buffer::point_writer::m_size
unsigned int m_size
Definition: buffer:108
tools::zb::buffer::scan_writer_1::operator=
scan_writer_1 & operator=(const scan_writer_1 &)
Definition: buffer:403
tools::zb::buffer::m_begY
ZPos m_begY
Definition: buffer:604
tools::zb::buffer::writer::writer
writer(const writer &a_from)
Definition: buffer:33
tools::zb::buffer::scan_writer::~scan_writer
virtual ~scan_writer()
Definition: buffer:387
tools::zb::buffer::draw_polygon
void draw_polygon(int a_number, const point *a_list, ZZ a_A, ZZ a_B, ZZ a_C, ZZ a_D, ZPixel a_pixel)
Definition: buffer:323
tools::zb::buffer::point_writer::point_writer
point_writer(const point_writer &a_from)
Definition: buffer:66
tools::zb::buffer::writer::operator=
writer & operator=(const writer &a_from)
Definition: buffer:34
tools::zb::buffer::scan_writer_3::operator=
scan_writer_3 & operator=(const scan_writer_3 &)
Definition: buffer:439
tools::zb::buffer::point_writer::write
virtual void write(ZPos a_x, ZPos a_y, ZZ a_z)
Definition: buffer:44
tools::zb::buffer::scan_writer_1::scan_writer_1
scan_writer_1(writer &a_writer)
Definition: buffer:396
tools::zb::buffer::buffer
buffer()
Definition: buffer:157
tools::zb::buffer::m_endY
ZPos m_endY
Definition: buffer:605
tools::zb::buffer::scan_writer_3::scan_writer_3
scan_writer_3(const scan_writer_3 &a_from)
Definition: buffer:435
tools::zb::buffer::scan_writer_3::m_writer
writer & m_writer
Definition: buffer:441
tools::zb::buffer::WriteScanLine
static void WriteScanLine(void *a_tag, int a_beg, int a_end, int a_y)
Definition: buffer:462
tools::zb::buffer::set_clip_region
void set_clip_region(ZPos a_x, ZPos a_y, unsigned int a_width, unsigned int a_height)
Definition: buffer:272
tools::zb::buffer::scan_writer_1
Definition: buffer:390
tools::zb::buffer::scan_writer_1::scan_writer_1
scan_writer_1(const scan_writer_1 &a_from)
Definition: buffer:399
tools::zb::buffer::scan_writer_3
Definition: buffer:426
tools::zb::buffer::m_zbw
unsigned int m_zbw
Definition: buffer:603
tools::zb::buffer::writer::m_pixel
ZPixel m_pixel
Definition: buffer:39
tools::zb::buffer::writer::writer
writer(ZPixel a_pixel)
Definition: buffer:30
tools::zb::buffer::scan_writer_2::m_writer
writer & m_writer
Definition: buffer:423
tools::zb::buffer::point_writer::_write
void _write(ZPos a_x, ZPos a_y, ZZ a_z)
Definition: buffer:86