~kalon33/corsix-th/master

« back to all changes in this revision

Viewing changes to agg/include/agg_renderer_markers.h

  • Committer: corsixth.bot at gmail
  • Date: 2014-03-31 23:30:23 UTC
  • Revision ID: svn-v4:c39591fa-788f-11de-a72b-d90af8dea425:trunk:2687
Remove trailing whitespaces in .h, .cpp, .c and .lua files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// Anti-Grain Geometry - Version 2.4
3
3
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
4
4
//
5
 
// Permission to copy, use, modify, sell and distribute this software 
6
 
// is granted provided this copyright notice appears in all copies. 
 
5
// Permission to copy, use, modify, sell and distribute this software
 
6
// is granted provided this copyright notice appears in all copies.
7
7
// This software is provided "as is" without express or implied
8
8
// warranty, and with no claim as to its suitability for any purpose.
9
9
//
47
47
        marker_dash,
48
48
        marker_dot,
49
49
        marker_pixel,
50
 
        
 
50
 
51
51
        end_of_markers
52
52
    };
53
53
 
71
71
        bool visible(int x, int y, int r) const
72
72
        {
73
73
            rect_i rc(x-r, y-r, x+y, y+r);
74
 
            return rc.clip(base_type::ren().bounding_clip_box());  
 
74
            return rc.clip(base_type::ren().bounding_clip_box());
75
75
        }
76
76
 
77
77
        //--------------------------------------------------------------------
78
78
        void square(int x, int y, int r)
79
79
        {
80
 
            if(visible(x, y, r)) 
81
 
            {  
 
80
            if(visible(x, y, r))
 
81
            {
82
82
                if(r) base_type::outlined_rectangle(x-r, y-r, x+r, y+r);
83
83
                else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
84
84
            }
99
99
                        base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
100
100
                        base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
101
101
                        base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
102
 
                        
 
102
 
103
103
                        if(dx)
104
104
                        {
105
105
                            base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full);
168
168
                    {
169
169
                        dx += ei.dx();
170
170
                        dy += ei.dy();
171
 
                        
 
171
 
172
172
                        base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full);
173
173
                        base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full);
174
 
                        
 
174
 
175
175
                        if(ei.dy() && dx)
176
176
                        {
177
177
                            base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
204
204
                    {
205
205
                        dx += ei.dx();
206
206
                        dy += ei.dy();
207
 
                        
 
207
 
208
208
                        base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full);
209
209
                        base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full);
210
 
                        
 
210
 
211
211
                        if(ei.dy() && dx)
212
212
                        {
213
213
                            base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
240
240
                    {
241
241
                        dx += ei.dx();
242
242
                        dy += ei.dy();
243
 
                        
 
243
 
244
244
                        base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
245
245
                        base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
246
 
                        
 
246
 
247
247
                        if(ei.dy() && dx)
248
248
                        {
249
249
                            base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full);
276
276
                    {
277
277
                        dx += ei.dx();
278
278
                        dy += ei.dy();
279
 
                        
 
279
 
280
280
                        base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
281
281
                        base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
282
 
                        
 
282
 
283
283
                        if(ei.dy() && dx)
284
284
                        {
285
285
                            base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full);
312
312
                    {
313
313
                        base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full);
314
314
                        base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full);
315
 
                        
 
315
 
316
316
                        if(dx)
317
317
                        {
318
318
                            base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
347
347
                    {
348
348
                        base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full);
349
349
                        base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full);
350
 
                        
 
350
 
351
351
                        if(dx)
352
352
                        {
353
353
                            base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
382
382
                    {
383
383
                        base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
384
384
                        base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
385
 
                        
 
385
 
386
386
                        if(dx)
387
387
                        {
388
388
                            base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full);
417
417
                    {
418
418
                        base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
419
419
                        base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
420
 
                        
 
420
 
421
421
                        if(dx)
422
422
                        {
423
423
                            base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full);
458
458
                        base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full);
459
459
                        base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full);
460
460
                        base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full);
461
 
                        
 
461
 
462
462
                        if(dx)
463
463
                        {
464
464
                            base_type::ren().blend_hline(x-dx+1, y+dy,   x+dx-1, base_type::fill_color(), cover_full);
497
497
                }
498
498
            }
499
499
        }
500
 
        
501
 
        
 
500
 
 
501
 
502
502
        //--------------------------------------------------------------------
503
503
        void xing(int x, int y, int r)
504
504
        {
520
520
                base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
521
521
            }
522
522
        }
523
 
        
524
 
        
 
523
 
 
524
 
525
525
        //--------------------------------------------------------------------
526
526
        void dash(int x, int y, int r)
527
527
        {
528
 
            if(visible(x, y, r)) 
 
528
            if(visible(x, y, r))
529
529
            {
530
530
                if(r) base_type::ren().blend_hline(x-r, y, x+r, base_type::line_color(), cover_full);
531
531
                else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
532
532
            }
533
533
        }
534
 
        
535
 
        
 
534
 
 
535
 
536
536
        //--------------------------------------------------------------------
537
537
        void dot(int x, int y, int r)
538
538
        {
539
 
            if(visible(x, y, r)) 
 
539
            if(visible(x, y, r))
540
540
            {
541
541
                if(r) base_type::solid_ellipse(x, y, r, r);
542
542
                else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
543
543
            }
544
544
        }
545
 
        
 
545
 
546
546
        //--------------------------------------------------------------------
547
547
        void pixel(int x, int y, int)
548
548
        {
549
549
            base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
550
550
        }
551
 
        
 
551
 
552
552
        //--------------------------------------------------------------------
553
553
        void marker(int x, int y, int r, marker_e type)
554
554
        {
592
592
                while(--n);
593
593
                return;
594
594
            }
595
 
            
 
595
 
596
596
            switch(type)
597
597
            {
598
598
                case marker_square:            do { square           (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
613
613
                case marker_dash:              do { dash             (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
614
614
                case marker_dot:               do { dot              (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
615
615
                case marker_pixel:             do { pixel            (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
616
 
            }                                                                                  
 
616
            }
617
617
        }
618
 
        
 
618
 
619
619
        //--------------------------------------------------------------------
620
620
        template<class T>
621
621
        void markers(int n, const T* x, const T* y, const T* r, marker_e type)
641
641
                case marker_dash:              do { dash             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
642
642
                case marker_dot:               do { dot              (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
643
643
                case marker_pixel:             do { pixel            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
644
 
            }                                                                                  
 
644
            }
645
645
        }
646
 
        
 
646
 
647
647
        //--------------------------------------------------------------------
648
648
        template<class T>
649
649
        void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, marker_e type)
671
671
                case marker_pixel:             do { base_type::fill_color(*fc); pixel            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
672
672
            }
673
673
        }
674
 
        
 
674
 
675
675
        //--------------------------------------------------------------------
676
676
        template<class T>
677
677
        void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, const color_type* lc, marker_e type)