~ubuntu-branches/ubuntu/trusty/python-enable/trusty-proposed

« back to all changes in this revision

Viewing changes to enthought/kiva/agg/src/kiva_graphics_context.h

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2010-02-28 14:56:36 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100228145636-9ghfhe3uy37tt3q6
Tags: 3.3.0-1
* New upstream release
* Bump Standards-Version to 3.8.4
* Switch to source format 3.0
* Update patches/freetype2.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
#include "agg_scanline_u.h"
28
28
#include "agg_scanline_bin.h"
 
29
#include "agg_scanline_p.h"
29
30
 
30
31
#include "agg_renderer_mclip.h"
31
32
#include "agg_renderer_scanline.h"
456
457
        void linear_gradient(double x1, double y1,
457
458
                            double x2, double y2,
458
459
                            std::vector<kiva::gradient_stop> stops,
459
 
                            const char* spread_method)
 
460
                            const char* spread_method,
 
461
                            const char* units="userSpaceOnUse")
460
462
        {
461
463
            typedef std::pair<double, double> point_type;
462
464
            std::vector<gradient_stop> stops_list;
465
467
            points.push_back(point_type(x1, y1));
466
468
            points.push_back(point_type(x2, y2));
467
469
 
468
 
            this->state.gradient_fill = gradient(kiva::grad_linear, points, stops, spread_method);
 
470
            this->state.gradient_fill = gradient(kiva::grad_linear, points,
 
471
                                                                                                stops, spread_method, units);
 
472
            this->state.gradient_fill.set_ctm(this->get_ctm());
469
473
        }
470
474
 
471
475
        void radial_gradient(double cx, double cy, double r,
472
476
                            double fx, double fy,
473
477
                            std::vector<kiva::gradient_stop> stops,
474
 
                            const char* spread_method)
 
478
                            const char* spread_method,
 
479
                            const char* units="userSpaceOnUse")
475
480
        {
476
481
            typedef std::pair<double, double> point_type;
477
482
            std::vector<point_type> points;
480
485
            points.push_back(point_type(r, 0));
481
486
            points.push_back(point_type(fx, fy));
482
487
 
483
 
            this->state.gradient_fill = gradient(kiva::grad_radial, points, stops, spread_method);
 
488
            this->state.gradient_fill = gradient(kiva::grad_radial, points,
 
489
                                                                                                stops, spread_method, units);
 
490
            this->state.gradient_fill.set_ctm(this->get_ctm());
484
491
        }
485
492
 
486
493
 
732
739
        }
733
740
        else
734
741
        {
735
 
            throw clipping_path_unsupported;
 
742
                this->renderer.reset_clipping(true);
 
743
                this->state.clipping_path = this->path;
736
744
        }
737
745
    }
738
746
 
743
751
    template <class agg_pixfmt>
744
752
    void graphics_context<agg_pixfmt>::clip()
745
753
    {
746
 
        throw kiva::not_implemented_error;
 
754
//      this->state.clipping_path = this->path;
 
755
 
 
756
        agg::scanline_p8 scanline;
 
757
 
 
758
        agg::renderer_scanline_aa_solid< renderer_base_type >
 
759
                    aa_renderer(this->renderer);
 
760
 
 
761
        agg::rgba transparent = this->state.fill_color;
 
762
        transparent.a = 0;
 
763
 
 
764
        aa_renderer.color(transparent);
 
765
 
 
766
        this->stroke_path_scanline_aa(this->state.clipping_path,
 
767
                                      aa_renderer, scanline);
747
768
    }
748
769
 
749
770
    template <class agg_pixfmt>