Permalink
Browse files

A lot of fixes and improvements

  • Loading branch information...
svgpp committed Aug 12, 2014
1 parent d85099a commit a0a323c74a0edc3f5e44181db86ffe6942f18fd6
View
@@ -0,0 +1,2 @@
doc/sphinx/_build/
doc/html/
View
@@ -6,6 +6,7 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
BUILDDIR_html = ../html
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
@@ -50,9 +51,9 @@ clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR_html)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
@echo "Build finished. The HTML pages are in $(BUILDDIR_html)."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@@ -22,6 +22,8 @@
namespace svgpp
{
// TODO: option to request arc by bezier estimation error from user code (now it is set by maximum angle step)
namespace detail
{
template<class Coordinate>
@@ -615,6 +617,7 @@ class path_adapter:
coordinate_type y,
tag::absolute_coordinate tag)
{
x_axis_rotation *= boost::math::constants::degree<coordinate_type>();
coordinate_type cx, cy, theta1, theta2;
arc_endpoint_to_center(current_x, current_y, x, y,
rx, ry, x_axis_rotation, large_arc_flag, sweep_flag,
@@ -180,20 +180,20 @@ class matrix_only_transform_adapter: public Base
}
};
template<class Context, class TransformPolicy, class LoadPolicy>
template<class Context, class TransformPolicy, class LoadPolicy, class Number>
struct transform_adapter_base
{
typedef typename boost::mpl::if_c<
TransformPolicy::join_transforms,
matrix_only_transform_adapter<
join_transform_adapter<Context, typename TransformPolicy::number_type, LoadPolicy>
join_transform_adapter<Context, Number, LoadPolicy>
>,
typename boost::mpl::if_c<
TransformPolicy::only_matrix_transform,
matrix_only_transform_adapter<
passthrough_transform_adapter<Context, typename TransformPolicy::number_type, LoadPolicy>
passthrough_transform_adapter<Context, Number, LoadPolicy>
>,
passthrough_transform_adapter<Context, typename TransformPolicy::number_type, LoadPolicy>
passthrough_transform_adapter<Context, Number, LoadPolicy>
>::type
>::type type;
};
@@ -204,30 +204,32 @@ template<
class Context,
class TransformPolicy = typename policy::transform::by_context<Context>::type,
class LoadPolicy = policy::load_transform::default_policy<Context>,
class Number = double,
class Enable = void>
class transform_adapter;
template<
class Context,
class TransformPolicy,
class LoadPolicy>
class transform_adapter<Context, TransformPolicy, LoadPolicy,
class LoadPolicy,
class Number
>
class transform_adapter<Context, TransformPolicy, LoadPolicy, Number,
typename boost::enable_if_c<
TransformPolicy::no_shorthands
|| TransformPolicy::only_matrix_transform
|| TransformPolicy::join_transforms>::type
>:
public detail::transform_adapter_base<Context, TransformPolicy, LoadPolicy>::type
public detail::transform_adapter_base<Context, TransformPolicy, LoadPolicy, Number>::type
{
typedef typename detail::transform_adapter_base<Context, TransformPolicy, LoadPolicy>::type base;
typedef typename detail::transform_adapter_base<Context, TransformPolicy, LoadPolicy, Number>::type base;
public:
typedef typename TransformPolicy::number_type number_type;
typedef Number number_type;
transform_adapter(Context & context)
: base(context)
{
}
{}
using base::append_transform_translate;
using base::append_transform_scale;
@@ -254,22 +256,23 @@ class transform_adapter<Context, TransformPolicy, LoadPolicy,
template<
class Context,
class TransformPolicy,
class LoadPolicy>
class transform_adapter<Context, TransformPolicy, LoadPolicy,
class LoadPolicy,
class Number
>
class transform_adapter<Context, TransformPolicy, LoadPolicy, Number,
typename boost::disable_if_c<
TransformPolicy::no_shorthands
|| TransformPolicy::only_matrix_transform
|| TransformPolicy::join_transforms>::type
>:
public detail::transform_adapter_base<Context, TransformPolicy, LoadPolicy>::type
public detail::transform_adapter_base<Context, TransformPolicy, LoadPolicy, Number>::type
{
typedef typename detail::transform_adapter_base<Context, TransformPolicy, LoadPolicy>::type base;
typedef typename detail::transform_adapter_base<Context, TransformPolicy, LoadPolicy, Number>::type base;
public:
transform_adapter(Context & context)
: base(context)
{
}
{}
};
namespace detail
@@ -312,12 +315,14 @@ struct transform_adapter_if_needed<OriginalContext,
private:
typedef typename detail::unwrap_context<OriginalContext, tag::transform_policy>::policy transform_policy;
typedef typename detail::unwrap_context<OriginalContext, tag::load_transform_policy>::policy original_load_transform_policy;
typedef typename detail::unwrap_context<OriginalContext, tag::number_type>::policy number_type;
public:
typedef transform_adapter<
typename original_load_transform_policy::context_type,
transform_policy,
original_load_transform_policy
original_load_transform_policy,
number_type
> type;
typedef const adapted_context_wrapper<
@@ -110,6 +110,12 @@ namespace value
#undef SVGPP_ON_VALUE
#undef SVGPP_ON_VALUE2
struct rect {}; // Used as shape in 'clip' property
struct underline {};
struct overline {};
struct line_through {};
struct blink {};
struct meet {};
struct slice {};
struct xMinYMin { typedef min_tag x; typedef min_tag y; };
@@ -6,6 +6,7 @@
// See http://github.com/svgpp/svgpp for library home page.
SVGPP_ON_VALUE(A)
SVGPP_ON_VALUE(accumulate)
SVGPP_ON_VALUE(align)
SVGPP_ON_VALUE(all)
SVGPP_ON_VALUE(alphabetic)
@@ -10,24 +10,12 @@
#include <boost/spirit/include/qi.hpp>
#include <svgpp/definitions.hpp>
namespace boost { namespace spirit
{
BOOST_SPIRIT_TERMINAL(svgpp_noop_directive)
///////////////////////////////////////////////////////////////////////////
// Enablers
///////////////////////////////////////////////////////////////////////////
template <>
struct use_directive<
qi::domain, tag::svgpp_noop_directive> // enables encoding
: mpl::true_ {};
template <>
struct is_modifier_directive<qi::domain, tag::svgpp_noop_directive>
: mpl::true_ {};
}}
namespace svgpp
{
BOOST_SPIRIT_TERMINAL(noop_directive)
namespace svgpp { namespace detail
namespace detail
{
namespace character_encoding_namespace = boost::spirit::ascii;
@@ -118,9 +106,24 @@ inline character_encoding_namespace::no_case_type const & no_case_if_css(tag::so
return character_encoding_namespace::no_case;
}
inline boost::spirit::svgpp_noop_directive_type const & no_case_if_css(tag::source::attribute)
inline noop_directive_type const & no_case_if_css(tag::source::attribute)
{
return boost::spirit::svgpp_noop_directive;
return noop_directive;
}
}}
namespace boost { namespace spirit
{
///////////////////////////////////////////////////////////////////////////
// Enablers
///////////////////////////////////////////////////////////////////////////
template <>
struct use_directive<
qi::domain, svgpp::tag::noop_directive> // enables encoding
: mpl::true_ {};
template <>
struct is_modifier_directive<qi::domain, svgpp::tag::noop_directive>
: mpl::true_ {};
}}
@@ -47,6 +47,8 @@ class color_grammar: public qi::grammar<Iterator, typename ColorFactory::color_t
{
namespace phx = boost::phoenix;
using qi::_1;
using qi::_2;
using qi::_3;
using qi::_a;
using qi::_b;
using qi::_c;
@@ -79,24 +81,23 @@ class color_grammar: public qi::grammar<Iterator, typename ColorFactory::color_t
);
components_rule
=
integer [_a = _1]
= ( integer
>> comma
>> integer [_b = _1]
>> integer
>> comma
>> integer
[_val = phx::bind(&color_grammar::absolute_components, _a, _b, _1)];
>> integer
) [_val = phx::bind(&color_grammar::absolute_components, _1, _2, _3)];
percentage_rule
= number [_a = _1]
= ( number
>> '%'
>> comma
>> number [_b = _1]
>> number
>> '%'
>> comma
>> number
[_val = phx::bind(&color_grammar::percent_components, _a, _b, _1)]
>> '%' ;
>> '%'
) [_val = phx::bind(&color_grammar::percent_components, _1, _2, _3)];
}
private:
@@ -105,8 +106,8 @@ class color_grammar: public qi::grammar<Iterator, typename ColorFactory::color_t
typename this_type::start_type color;
qi::rule<Iterator> comma;
qi::rule<Iterator, color_type (), qi::locals<unsigned int> > hex_rule;
qi::rule<Iterator, color_type (), qi::locals<unsigned char, unsigned char> > components_rule;
qi::rule<Iterator, color_type (), qi::locals<number_type, number_type> > percentage_rule;
qi::rule<Iterator, color_type ()> components_rule;
qi::rule<Iterator, color_type ()> percentage_rule;
qi::uint_parser<unsigned char, 10, 1, 3> integer;
// There was mistake in SVG 1.1 that limits percentage to integer values, while CSS permits floating point numbers.
// Till fixed version is not released, we will use CSS version of percentage definition.
Oops, something went wrong.

0 comments on commit a0a323c

Please sign in to comment.