Merge commit 'aa122ea907fa1f31ed76f6e0f12ea9549c86a964' into harfbuzz
This commit is contained in:
commit
4beed29cf2
6 changed files with 76 additions and 38 deletions
36
COPYING
36
COPYING
|
@ -1,8 +1,8 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
|||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
|
@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know
|
|||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
|
@ -111,8 +111,8 @@ modification follow. Pay close attention to the difference between a
|
|||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
|
@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
|
|||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
|
@ -158,7 +158,7 @@ Library.
|
|||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
|
@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
|
|||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
@ -267,7 +267,7 @@ Library will still fall under Section 6.)
|
|||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
|
@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
|
|||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
|
@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
|
|||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
|
@ -422,7 +422,7 @@ conditions either of that version or of any later version published by
|
|||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
|
@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
|
|||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
|
@ -455,8 +455,8 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
|
@ -485,7 +485,7 @@ convey the exclusion of warranty; and each file should have at least the
|
|||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
|
|
|
@ -417,12 +417,18 @@ void apply_filter(Src & src, colorize_alpha const& op)
|
|||
|
||||
double step = 1.0/(size-1);
|
||||
double offset = 0.0;
|
||||
BOOST_FOREACH( mapnik::color const& c, op)
|
||||
BOOST_FOREACH( mapnik::filter::color_stop const& stop, op)
|
||||
{
|
||||
grad_lut.add_color(offset, agg::rgba(c.red()/256.0,
|
||||
c.green()/256.0,
|
||||
c.blue()/256.0,
|
||||
c.alpha()/256.0));
|
||||
mapnik::color const& c = stop.color;
|
||||
double stop_offset = stop.offset;
|
||||
if (stop_offset == 0)
|
||||
{
|
||||
stop_offset = offset;
|
||||
}
|
||||
grad_lut.add_color(stop_offset, agg::rgba(c.red()/256.0,
|
||||
c.green()/256.0,
|
||||
c.blue()/256.0,
|
||||
c.alpha()/256.0));
|
||||
offset += step;
|
||||
}
|
||||
grad_lut.build_lut();
|
||||
|
|
|
@ -25,17 +25,40 @@
|
|||
|
||||
// boost
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
// mapnik
|
||||
#include <mapnik/css_color_grammar.hpp>
|
||||
#include <mapnik/image_filter.hpp>
|
||||
// stl
|
||||
#include <vector>
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
mapnik::filter::color_stop,
|
||||
(mapnik::color, color )
|
||||
(double, offset)
|
||||
)
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
namespace qi = boost::spirit::qi;
|
||||
|
||||
struct percent_offset_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef double type;
|
||||
};
|
||||
|
||||
double operator() (double val) const
|
||||
{
|
||||
double result = std::abs(val/100.0);
|
||||
if (result > 1.0) result = 1.0;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Iterator, typename ContType>
|
||||
struct image_filter_grammar :
|
||||
qi::grammar<Iterator, ContType(), qi::ascii::space_type>
|
||||
|
@ -46,10 +69,12 @@ struct image_filter_grammar :
|
|||
qi::rule<Iterator, qi::locals<int,int>, void(ContType&), qi::ascii::space_type> agg_blur_filter;
|
||||
qi::rule<Iterator, qi::locals<double,double,double,double,double,double,double,double>,
|
||||
void(ContType&), qi::ascii::space_type> hsla_filter;
|
||||
qi::rule<Iterator, qi::locals<mapnik::filter::colorize_alpha>, void(ContType&), qi::ascii::space_type> colorize_alpha_filter;
|
||||
qi::rule<Iterator, qi::locals<mapnik::filter::colorize_alpha, mapnik::filter::color_stop>, void(ContType&), qi::ascii::space_type> colorize_alpha_filter;
|
||||
qi::rule<Iterator, qi::ascii::space_type> no_args;
|
||||
qi::uint_parser< unsigned, 10, 1, 3 > radius_;
|
||||
css_color_grammar<Iterator> css_color_;
|
||||
qi::rule<Iterator,void(mapnik::filter::color_stop &),qi::ascii::space_type> color_stop_offset;
|
||||
phoenix::function<percent_offset_impl> percent_offset;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -98,16 +98,18 @@ struct hsla
|
|||
double a1;
|
||||
};
|
||||
|
||||
struct colorize_alpha : std::vector<mapnik::color>
|
||||
struct color_stop
|
||||
{
|
||||
color_stop() {}
|
||||
color_stop(mapnik::color const& c, double val = 0.0)
|
||||
: color(c),offset(val) {}
|
||||
mapnik::color color;
|
||||
double offset;
|
||||
};
|
||||
|
||||
struct colorize_alpha : std::vector<color_stop>
|
||||
{
|
||||
colorize_alpha() {}
|
||||
colorize_alpha(mapnik::color const& c0, mapnik::color const& c1)
|
||||
{
|
||||
this->push_back(c0);
|
||||
this->push_back(c1);
|
||||
// TODO: support multiple color-stops
|
||||
// https://developer.mozilla.org/en-US/docs/CSS/linear-gradient
|
||||
}
|
||||
};
|
||||
|
||||
typedef boost::variant<filter::blur,
|
||||
|
|
|
@ -344,11 +344,10 @@ void agg_renderer<T>::render_marker(pixel_position const& pos,
|
|||
{
|
||||
double width = (*marker.get_bitmap_data())->width();
|
||||
double height = (*marker.get_bitmap_data())->height();
|
||||
double cx = 0.5 * width;
|
||||
double cy = 0.5 * height;
|
||||
|
||||
if (std::fabs(1.0 - scale_factor_) < 0.001 && tr.is_identity())
|
||||
{
|
||||
double cx = 0.5 * width;
|
||||
double cy = 0.5 * height;
|
||||
composite(current_buffer_->data(), **marker.get_bitmap_data(),
|
||||
comp_op, opacity,
|
||||
boost::math::iround(pos.x - cx),
|
||||
|
|
|
@ -57,7 +57,7 @@ image_filter_grammar<Iterator,ContType>::image_filter_grammar()
|
|||
using boost::spirit::ascii::string;
|
||||
using phoenix::push_back;
|
||||
using phoenix::construct;
|
||||
|
||||
using phoenix::at_c;
|
||||
#if BOOST_VERSION >= 104700
|
||||
using qi::no_skip;
|
||||
start = -(filter % no_skip[*char_(", ")])
|
||||
|
@ -111,11 +111,17 @@ image_filter_grammar<Iterator,ContType>::image_filter_grammar()
|
|||
|
||||
colorize_alpha_filter = lit("colorize-alpha")[_a = construct<mapnik::filter::colorize_alpha>()]
|
||||
>> lit('(')
|
||||
>> css_color_[push_back(_a, _1)]
|
||||
>> +(lit(',') >> css_color_[push_back(_a, _1)])
|
||||
>> (css_color_[at_c<0>(_b) = _1, at_c<1>(_b) = 0]
|
||||
>> -color_stop_offset(_b)) [push_back(_a,_b)]
|
||||
>> +(lit(',') >> css_color_[at_c<0>(_b) =_1,at_c<1>(_b) = 0]
|
||||
>> -color_stop_offset(_b))[push_back(_a,_b)]
|
||||
>> lit(')') [push_back(_r1,_a)]
|
||||
;
|
||||
|
||||
color_stop_offset = (double_ >> lit('%'))[at_c<1>(_r1) = percent_offset(_1)]
|
||||
|
|
||||
double_[at_c<1>(_r1) = _1]
|
||||
;
|
||||
no_args = -(lit('(') >> lit(')'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue