mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-02 20:51:23 -07:00
WIP: SVG import & rasterization
Updated AntiGrain (agg) library to 2.5 Added agg_svg library from AntiGrain 2.5 added src/slic3r/Utils/SVGImport.cpp/hpp
This commit is contained in:
parent
a2478b7faa
commit
9b15908a47
59 changed files with 10646 additions and 3586 deletions
|
|
@ -1,16 +1,25 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry - Version 2.4
|
||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||
//
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all copies.
|
||||
// This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry (AGG) - Version 2.5
|
||||
// A high quality rendering engine for C++
|
||||
// Copyright (C) 2002-2006 Maxim Shemanarev
|
||||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://www.antigrain.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AGG_PATH_STORAGE_INCLUDED
|
||||
|
|
@ -490,14 +499,14 @@ namespace agg
|
|||
m_stop(false)
|
||||
{}
|
||||
|
||||
poly_container_reverse_adaptor(Container& data, bool closed) :
|
||||
poly_container_reverse_adaptor(const Container& data, bool closed) :
|
||||
m_container(&data),
|
||||
m_index(-1),
|
||||
m_closed(closed),
|
||||
m_stop(false)
|
||||
{}
|
||||
|
||||
void init(Container& data, bool closed)
|
||||
void init(const Container& data, bool closed)
|
||||
{
|
||||
m_container = &data;
|
||||
m_index = m_container->size() - 1;
|
||||
|
|
@ -531,7 +540,7 @@ namespace agg
|
|||
}
|
||||
|
||||
private:
|
||||
Container* m_container;
|
||||
const Container* m_container;
|
||||
int m_index;
|
||||
bool m_closed;
|
||||
bool m_stop;
|
||||
|
|
@ -835,43 +844,6 @@ namespace agg
|
|||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// If the end points of a path are very, very close then make them
|
||||
// exactly equal so that the stroke converter is not confused.
|
||||
//--------------------------------------------------------------------
|
||||
unsigned align_path(unsigned idx = 0)
|
||||
{
|
||||
if (idx >= total_vertices() || !is_move_to(command(idx)))
|
||||
{
|
||||
return total_vertices();
|
||||
}
|
||||
|
||||
double start_x, start_y;
|
||||
for (; idx < total_vertices() && is_move_to(command(idx)); ++idx)
|
||||
{
|
||||
vertex(idx, &start_x, &start_y);
|
||||
}
|
||||
while (idx < total_vertices() && is_drawing(command(idx)))
|
||||
++idx;
|
||||
|
||||
double x, y;
|
||||
if (is_drawing(vertex(idx - 1, &x, &y)) &&
|
||||
is_equal_eps(x, start_x, 1e-8) &&
|
||||
is_equal_eps(y, start_y, 1e-8))
|
||||
{
|
||||
modify_vertex(idx - 1, start_x, start_y);
|
||||
}
|
||||
|
||||
while (idx < total_vertices() && !is_move_to(command(idx)))
|
||||
++idx;
|
||||
return idx;
|
||||
}
|
||||
|
||||
void align_all_paths()
|
||||
{
|
||||
for (unsigned i = 0; i < total_vertices(); i = align_path(i));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
unsigned perceive_polygon_orientation(unsigned start, unsigned end);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue