Created
August 3, 2016 19:19
-
-
Save anonymous/94ac0c7ce22cb77137505a12b0229fc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -rup wxsvg-1.5.8/include/wxSVG/SVGCanvasItem.h wxsvg/include/wxSVG/SVGCanvasItem.h | |
--- wxsvg-1.5.8/include/wxSVG/SVGCanvasItem.h 2016-01-09 23:31:15.000000000 +0000 | |
+++ wxsvg/include/wxSVG/SVGCanvasItem.h 2016-07-27 09:54:21.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: Canvas items | |
// Author: Alex Thuering | |
// Created: 2005/05/09 | |
-// RCS-ID: $Id: SVGCanvasItem.h,v 1.28 2016/01/09 23:31:15 ntalex Exp $ | |
+// RCS-ID: $Id: SVGCanvasItem.h,v 1.29 2016/07/27 08:54:21 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
///////////////////////////////////////////////////////////////////////////// | |
@@ -44,9 +44,9 @@ class wxSVGCanvasItem { | |
wxSVGCanvasItemType GetType() { return m_type; } | |
/** returns the bounding box of the item */ | |
- virtual wxSVGRect GetBBox(const wxSVGMatrix& matrix = *(wxSVGMatrix*)NULL) { return wxSVGRect(); } | |
+ virtual wxSVGRect GetBBox(const wxSVGMatrix* matrix = NULL) { return wxSVGRect(); } | |
virtual wxSVGRect GetResultBBox(const wxCSSStyleDeclaration& style, | |
- const wxSVGMatrix& matrix = *(wxSVGMatrix*)NULL) { return GetBBox(); } | |
+ const wxSVGMatrix* matrix = NULL) { return GetBBox(matrix); } | |
protected: | |
wxSVGCanvasItemType m_type; | |
@@ -114,8 +114,8 @@ struct wxSVGCanvasTextChunk { | |
wxSVGCanvasTextCharList chars; | |
wxCSSStyleDeclaration style; | |
wxSVGMatrix matrix; | |
- wxSVGRect GetBBox(const wxSVGMatrix& matrix); | |
- wxSVGRect GetBBox() { return GetBBox(*(wxSVGMatrix*)NULL); } | |
+ wxSVGRect GetBBox(const wxSVGMatrix* matrix); | |
+ wxSVGRect GetBBox() { return GetBBox(NULL); } | |
}; | |
WX_DECLARE_OBJARRAY(wxSVGCanvasTextChunk, wxSVGCanvasTextChunkList); | |
@@ -128,7 +128,7 @@ class wxSVGCanvasText: public wxSVGCanva | |
virtual ~wxSVGCanvasText(); | |
virtual void Init(wxSVGTextElement& element, const wxCSSStyleDeclaration& style, wxSVGMatrix* matrix); | |
- virtual wxSVGRect GetBBox(const wxSVGMatrix& matrix = *(wxSVGMatrix*)NULL); | |
+ virtual wxSVGRect GetBBox(const wxSVGMatrix* matrix = NULL); | |
virtual long GetNumberOfChars(); | |
virtual double GetComputedTextLength(); | |
virtual double GetSubStringLength(unsigned long charnum, unsigned long nchars); | |
diff -rup wxsvg-1.5.8/src/cairo/SVGCanvasCairo.cpp wxsvg/src/cairo/SVGCanvasCairo.cpp | |
--- wxsvg-1.5.8/src/cairo/SVGCanvasCairo.cpp 2015-09-19 18:18:23.000000000 +0100 | |
+++ wxsvg/src/cairo/SVGCanvasCairo.cpp 2016-07-27 09:54:21.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: Cairo render | |
// Author: Alex Thuering | |
// Created: 2005/05/12 | |
-// RCS-ID: $Id: SVGCanvasCairo.cpp,v 1.33 2015/09/19 17:18:23 ntalex Exp $ | |
+// RCS-ID: $Id: SVGCanvasCairo.cpp,v 1.34 2016/07/27 08:54:21 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -451,7 +451,8 @@ void wxSVGCanvasCairo::DrawCanvasPath(wx | |
int dx = int(floor(stdX * 3 * sqrt(2 * M_PI) / 4 + 0.5)); | |
int dy = int(floor(stdY * 3 * sqrt(2 * M_PI) / 4 + 0.5)); | |
- wxSVGRect rect = canvasPath.GetResultBBox(style, matrix.Inverse()); | |
+ wxSVGMatrix invMatrix = matrix.Inverse(); | |
+ wxSVGRect rect = canvasPath.GetResultBBox(style, &invMatrix); | |
rect.SetX(rect.GetX() - 2*dx); | |
rect.SetY(rect.GetY() - 2*dy); | |
rect.SetWidth(rect.GetWidth() + 4*dx); | |
diff -rup wxsvg-1.5.8/src/cairo/SVGCanvasPathCairo.cpp wxsvg/src/cairo/SVGCanvasPathCairo.cpp | |
--- wxsvg-1.5.8/src/cairo/SVGCanvasPathCairo.cpp 2014-11-23 11:36:16.000000000 +0000 | |
+++ wxsvg/src/cairo/SVGCanvasPathCairo.cpp 2016-07-27 09:54:21.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: Cairo canvas path | |
// Author: Alex Thuering | |
// Created: 2005/05/12 | |
-// RCS-ID: $Id: SVGCanvasPathCairo.cpp,v 1.14 2014/11/23 11:36:16 ntalex Exp $ | |
+// RCS-ID: $Id: SVGCanvasPathCairo.cpp,v 1.15 2016/07/27 08:54:21 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -35,15 +35,16 @@ cairo_path_t* wxSVGCanvasPathCairo::GetP | |
return cairo_copy_path(m_cr); | |
} | |
-wxSVGRect wxSVGCanvasPathCairo::GetBBox(const wxSVGMatrix& matrix) { | |
- if (&matrix) { | |
+wxSVGRect wxSVGCanvasPathCairo::GetBBox(const wxSVGMatrix* matrix) { | |
+ if (matrix) { | |
cairo_matrix_t m; | |
- cairo_matrix_init(&m, matrix.GetA(), matrix.GetB(), matrix.GetC(), matrix.GetD(), matrix.GetE(), matrix.GetF()); | |
+ cairo_matrix_init(&m, matrix->GetA(), matrix->GetB(), matrix->GetC(), matrix->GetD(), | |
+ matrix->GetE(), matrix->GetF()); | |
cairo_set_matrix(m_cr, &m); | |
} | |
double x1, y1, x2, y2; | |
cairo_fill_extents(m_cr, &x1, &y1, &x2, &y2); | |
- if (&matrix) { | |
+ if (matrix) { | |
cairo_matrix_t mat; | |
cairo_matrix_init(&mat, 1, 0, 0, 1, 0, 0); | |
cairo_set_matrix(m_cr, &mat); | |
@@ -51,10 +52,11 @@ wxSVGRect wxSVGCanvasPathCairo::GetBBox( | |
return wxSVGRect(x1, y1, x2 - x1, y2 - y1); | |
} | |
-wxSVGRect wxSVGCanvasPathCairo::GetResultBBox(const wxCSSStyleDeclaration& style, const wxSVGMatrix& matrix) { | |
- if (&matrix) { | |
+wxSVGRect wxSVGCanvasPathCairo::GetResultBBox(const wxCSSStyleDeclaration& style, const wxSVGMatrix* matrix) { | |
+ if (matrix) { | |
cairo_matrix_t m; | |
- cairo_matrix_init(&m, matrix.GetA(), matrix.GetB(), matrix.GetC(), matrix.GetD(), matrix.GetE(), matrix.GetF()); | |
+ cairo_matrix_init(&m, matrix->GetA(), matrix->GetB(), matrix->GetC(), matrix->GetD(), | |
+ matrix->GetE(), matrix->GetF()); | |
cairo_set_matrix(m_cr, &m); | |
} | |
ApplyStrokeStyle(m_cr, style); | |
@@ -63,7 +65,7 @@ wxSVGRect wxSVGCanvasPathCairo::GetResul | |
cairo_stroke_extents(m_cr, &x1, &y1, &x2, &y2); | |
else | |
cairo_fill_extents(m_cr, &x1, &y1, &x2, &y2); | |
- if (&matrix) { | |
+ if (matrix) { | |
cairo_matrix_t mat; | |
cairo_matrix_init(&mat, 1, 0, 0, 1, 0, 0); | |
cairo_set_matrix(m_cr, &mat); | |
diff -rup wxsvg-1.5.8/src/cairo/SVGCanvasPathCairo.h wxsvg/src/cairo/SVGCanvasPathCairo.h | |
--- wxsvg-1.5.8/src/cairo/SVGCanvasPathCairo.h 2013-01-19 18:26:28.000000000 +0000 | |
+++ wxsvg/src/cairo/SVGCanvasPathCairo.h 2016-07-27 09:54:21.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: Cairo canvas path | |
// Author: Alex Thuering | |
// Created: 2005/05/12 | |
-// RCS-ID: $Id: SVGCanvasPathCairo.h,v 1.6 2013/01/19 18:26:28 ntalex Exp $ | |
+// RCS-ID: $Id: SVGCanvasPathCairo.h,v 1.7 2016/07/27 08:54:21 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -24,8 +24,8 @@ public: | |
virtual ~wxSVGCanvasPathCairo(); | |
void End(); | |
- wxSVGRect GetBBox(const wxSVGMatrix& matrix = *(wxSVGMatrix*) NULL); | |
- wxSVGRect GetResultBBox(const wxCSSStyleDeclaration& style, const wxSVGMatrix& matrix = *(wxSVGMatrix*) NULL); | |
+ wxSVGRect GetBBox(const wxSVGMatrix* matrix = NULL); | |
+ wxSVGRect GetResultBBox(const wxCSSStyleDeclaration& style, const wxSVGMatrix* matrix = NULL); | |
cairo_t* GetCr() { return m_cr; } | |
cairo_path_t* GetPath(); | |
diff -rup wxsvg-1.5.8/src/SVGCanvasItem.cpp wxsvg/src/SVGCanvasItem.cpp | |
--- wxsvg-1.5.8/src/SVGCanvasItem.cpp 2016-05-16 22:08:51.000000000 +0100 | |
+++ wxsvg/src/SVGCanvasItem.cpp 2016-07-28 10:05:28.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: | |
// Author: Alex Thuering | |
// Created: 2005/05/09 | |
-// RCS-ID: $Id: SVGCanvasItem.cpp,v 1.53 2016/05/16 21:08:51 ntalex Exp $ | |
+// RCS-ID: $Id: SVGCanvasItem.cpp,v 1.55 2016/07/28 09:05:28 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -1164,12 +1164,12 @@ void wxSVGCanvasText::EndTextAnchor() { | |
} | |
} | |
-wxSVGRect wxSVGCanvasTextChunk::GetBBox(const wxSVGMatrix& matrix) { | |
+wxSVGRect wxSVGCanvasTextChunk::GetBBox(const wxSVGMatrix* matrix) { | |
wxSVGRect bbox; | |
for (int i = 0; i < (int) chars.Count(); i++) { | |
wxSVGRect elemBBox = chars[i].path->GetBBox(matrix); | |
if (elemBBox.IsEmpty()) | |
- elemBBox = &matrix ? chars[i].bbox.MatrixTransform(matrix) : chars[i].bbox; | |
+ elemBBox = matrix ? chars[i].bbox.MatrixTransform(*matrix) : chars[i].bbox; | |
if (i == 0) | |
bbox = elemBBox; | |
else { | |
@@ -1190,15 +1190,15 @@ wxSVGRect wxSVGCanvasTextChunk::GetBBox( | |
return bbox; | |
} | |
-wxSVGRect wxSVGCanvasText::GetBBox(const wxSVGMatrix& matrix) | |
+wxSVGRect wxSVGCanvasText::GetBBox(const wxSVGMatrix* matrix) | |
{ | |
wxSVGRect bbox; | |
for (int i=0; i<(int)m_chunks.Count(); i++) | |
{ | |
wxSVGMatrix tmpMatrix = m_chunks[i].matrix; | |
- if (&matrix) | |
- tmpMatrix = ((wxSVGMatrix&) matrix).Multiply(m_chunks[i].matrix); | |
- wxSVGRect elemBBox = m_chunks[i].GetBBox(tmpMatrix); | |
+ if (matrix) | |
+ tmpMatrix = (*matrix).Multiply(m_chunks[i].matrix); | |
+ wxSVGRect elemBBox = m_chunks[i].GetBBox(&tmpMatrix); | |
if (i == 0) | |
bbox = elemBBox; | |
else | |
diff -rup wxsvg-1.5.8/src/SVGLineElement.cpp wxsvg/src/SVGLineElement.cpp | |
--- wxsvg-1.5.8/src/SVGLineElement.cpp 2006-01-08 12:44:30.000000000 +0000 | |
+++ wxsvg/src/SVGLineElement.cpp 2016-07-28 10:05:28.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: | |
// Author: Alex Thuering | |
// Created: 2005/05/10 | |
-// RCS-ID: $Id: SVGLineElement.cpp,v 1.4 2006/01/08 12:44:30 ntalex Exp $ | |
+// RCS-ID: $Id: SVGLineElement.cpp,v 1.5 2016/07/28 09:05:28 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -11,55 +11,53 @@ | |
#include "SVGLineElement.h" | |
#include "SVGCanvas.h" | |
-wxSVGRect wxSVGLineElement::GetBBox(wxSVG_COORDINATES coordinates) | |
-{ | |
- wxSVGPoint p1 = wxSVGPoint(GetX1().GetAnimVal(), GetY1().GetAnimVal()); | |
- wxSVGPoint p2 = wxSVGPoint(GetX2().GetAnimVal(), GetY2().GetAnimVal()); | |
- if (coordinates != wxSVG_COORDINATES_USER) | |
- { | |
- wxSVGMatrix matrix = GetMatrix(coordinates); | |
- p1 = p1.MatrixTransform(matrix); | |
- p2 = p2.MatrixTransform(matrix); | |
- } | |
- | |
- double x1 = p1.GetX(); | |
- double y1 = p1.GetY(); | |
- double x2 = p2.GetX(); | |
- double y2 = p2.GetY(); | |
- | |
- wxSVGRect bbox(x1, y1, x2 - x1, y2 - y1); | |
- | |
- if (x1 > x2) | |
- { | |
- bbox.SetX(x2); | |
- bbox.SetWidth(x1 - x2); | |
- } | |
- | |
- if (y1 > y2) | |
- { | |
- bbox.SetY(y2); | |
- bbox.SetHeight(y1 - y2); | |
- } | |
- | |
- return bbox; | |
+wxSVGRect wxSVGLineElement::GetBBox(wxSVG_COORDINATES coordinates) { | |
+ wxSVGPoint p1 = wxSVGPoint(GetX1().GetAnimVal(), GetY1().GetAnimVal()); | |
+ wxSVGPoint p2 = wxSVGPoint(GetX2().GetAnimVal(), GetY2().GetAnimVal()); | |
+ if (coordinates != wxSVG_COORDINATES_USER) { | |
+ wxSVGMatrix matrix = GetMatrix(coordinates); | |
+ p1 = p1.MatrixTransform(matrix); | |
+ p2 = p2.MatrixTransform(matrix); | |
+ } | |
+ | |
+ double x1 = p1.GetX(); | |
+ double y1 = p1.GetY(); | |
+ double x2 = p2.GetX(); | |
+ double y2 = p2.GetY(); | |
+ | |
+ wxSVGRect bbox(x1, y1, x2 - x1, y2 - y1); | |
+ | |
+ if (x1 > x2) { | |
+ bbox.SetX(x2); | |
+ bbox.SetWidth(x1 - x2); | |
+ } | |
+ | |
+ if (y1 > y2) { | |
+ bbox.SetY(y2); | |
+ bbox.SetHeight(y1 - y2); | |
+ } | |
+ | |
+ return bbox; | |
} | |
-wxSVGRect wxSVGLineElement::GetResultBBox(wxSVG_COORDINATES coordinates) | |
-{ | |
- wxCSSStyleDeclaration style = GetResultStyle(*this); | |
- if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
- return GetBBox(coordinates); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect bbox = coordinates == wxSVG_COORDINATES_USER ? | |
- m_canvasItem->GetResultBBox(style) : | |
- m_canvasItem->GetResultBBox(style, GetMatrix(coordinates)); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return bbox; | |
+wxSVGRect wxSVGLineElement::GetResultBBox(wxSVG_COORDINATES coordinates) { | |
+ wxCSSStyleDeclaration style = GetResultStyle(*this); | |
+ if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
+ return GetBBox(coordinates); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ wxSVGRect bbox; | |
+ if (coordinates == wxSVG_COORDINATES_USER) { | |
+ bbox = m_canvasItem->GetResultBBox(style); | |
+ } else { | |
+ wxSVGMatrix m = GetMatrix(coordinates); | |
+ bbox = m_canvasItem->GetResultBBox(style, &m); | |
+ } | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return bbox; | |
} | |
-void wxSVGLineElement::SetCanvasItem(wxSVGCanvasItem* canvasItem) | |
-{ | |
- if (m_canvasItem) | |
- delete m_canvasItem; | |
- m_canvasItem = canvasItem; | |
+void wxSVGLineElement::SetCanvasItem(wxSVGCanvasItem* canvasItem) { | |
+ if (m_canvasItem) | |
+ delete m_canvasItem; | |
+ m_canvasItem = canvasItem; | |
} | |
diff -rup wxsvg-1.5.8/src/SVGPathElement.cpp wxsvg/src/SVGPathElement.cpp | |
--- wxsvg-1.5.8/src/SVGPathElement.cpp 2014-08-09 12:13:02.000000000 +0100 | |
+++ wxsvg/src/SVGPathElement.cpp 2016-07-28 10:05:28.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: Implementation of wxSVGPathElement | |
// Author: Alex Thuering | |
// Created: 2005/05/10 | |
-// RCS-ID: $Id: SVGPathElement.cpp,v 1.7 2014/08/09 11:13:02 ntalex Exp $ | |
+// RCS-ID: $Id: SVGPathElement.cpp,v 1.8 2016/07/28 09:05:28 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -14,8 +14,13 @@ | |
wxSVGRect wxSVGPathElement::GetBBox(wxSVG_COORDINATES coordinates) { | |
WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect bbox = coordinates == wxSVG_COORDINATES_USER ? m_canvasItem->GetBBox() : | |
- m_canvasItem->GetBBox(GetMatrix(coordinates)); | |
+ wxSVGRect bbox; | |
+ if (coordinates == wxSVG_COORDINATES_USER) { | |
+ bbox = m_canvasItem->GetBBox(); | |
+ } else { | |
+ wxSVGMatrix m = GetMatrix(coordinates); | |
+ bbox = m_canvasItem->GetBBox(&m); | |
+ } | |
WX_SVG_CLEAR_M_CANVAS_ITEM | |
return bbox; | |
} | |
@@ -25,8 +30,13 @@ wxSVGRect wxSVGPathElement::GetResultBBo | |
if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
return GetBBox(coordinates); | |
WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect bbox = coordinates == wxSVG_COORDINATES_USER ? m_canvasItem->GetResultBBox(style) : | |
- m_canvasItem->GetResultBBox(style, GetMatrix(coordinates)); | |
+ wxSVGRect bbox; | |
+ if (coordinates == wxSVG_COORDINATES_USER) { | |
+ bbox = m_canvasItem->GetResultBBox(style); | |
+ } else { | |
+ wxSVGMatrix m = GetMatrix(coordinates); | |
+ bbox = m_canvasItem->GetResultBBox(style, &m); | |
+ } | |
WX_SVG_CLEAR_M_CANVAS_ITEM | |
return bbox; | |
} | |
@@ -77,38 +87,38 @@ wxSVGPathSegLinetoRel wxSVGPathElement:: | |
return res; | |
} | |
-wxSVGPathSegCurvetoCubicAbs wxSVGPathElement::CreateSVGPathSegCurvetoCubicAbs( | |
- double x, double y, double x1, double y1, double x2, double y2) const { | |
+wxSVGPathSegCurvetoCubicAbs wxSVGPathElement::CreateSVGPathSegCurvetoCubicAbs(double x, double y, double x1, double y1, | |
+ double x2, double y2) const { | |
wxSVGPathSegCurvetoCubicAbs res; | |
return res; | |
} | |
-wxSVGPathSegCurvetoCubicRel wxSVGPathElement::CreateSVGPathSegCurvetoCubicRel( | |
- double x, double y, double x1, double y1, double x2, double y2) const { | |
+wxSVGPathSegCurvetoCubicRel wxSVGPathElement::CreateSVGPathSegCurvetoCubicRel(double x, double y, double x1, double y1, | |
+ double x2, double y2) const { | |
wxSVGPathSegCurvetoCubicRel res; | |
return res; | |
} | |
-wxSVGPathSegCurvetoQuadraticAbs wxSVGPathElement::CreateSVGPathSegCurvetoQuadraticAbs( | |
- double x, double y, double x1, double y1) const { | |
+wxSVGPathSegCurvetoQuadraticAbs wxSVGPathElement::CreateSVGPathSegCurvetoQuadraticAbs(double x, double y, double x1, | |
+ double y1) const { | |
wxSVGPathSegCurvetoQuadraticAbs res; | |
return res; | |
} | |
-wxSVGPathSegCurvetoQuadraticRel wxSVGPathElement::CreateSVGPathSegCurvetoQuadraticRel( | |
- double x, double y, double x1, double y1) const { | |
+wxSVGPathSegCurvetoQuadraticRel wxSVGPathElement::CreateSVGPathSegCurvetoQuadraticRel(double x, double y, double x1, | |
+ double y1) const { | |
wxSVGPathSegCurvetoQuadraticRel res; | |
return res; | |
} | |
-wxSVGPathSegArcAbs wxSVGPathElement::CreateSVGPathSegArcAbs(double x, double y, | |
- double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag) const { | |
+wxSVGPathSegArcAbs wxSVGPathElement::CreateSVGPathSegArcAbs(double x, double y, double r1, double r2, double angle, | |
+ bool largeArcFlag, bool sweepFlag) const { | |
wxSVGPathSegArcAbs res; | |
return res; | |
} | |
-wxSVGPathSegArcRel wxSVGPathElement::CreateSVGPathSegArcRel(double x, double y, | |
- double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag) const { | |
+wxSVGPathSegArcRel wxSVGPathElement::CreateSVGPathSegArcRel(double x, double y, double r1, double r2, double angle, | |
+ bool largeArcFlag, bool sweepFlag) const { | |
wxSVGPathSegArcRel res; | |
return res; | |
} | |
@@ -133,26 +143,26 @@ wxSVGPathSegLinetoVerticalRel wxSVGPathE | |
return res; | |
} | |
-wxSVGPathSegCurvetoCubicSmoothAbs wxSVGPathElement::CreateSVGPathSegCurvetoCubicSmoothAbs( | |
- double x, double y, double x2, double y2) const { | |
+wxSVGPathSegCurvetoCubicSmoothAbs wxSVGPathElement::CreateSVGPathSegCurvetoCubicSmoothAbs(double x, double y, double x2, | |
+ double y2) const { | |
wxSVGPathSegCurvetoCubicSmoothAbs res; | |
return res; | |
} | |
-wxSVGPathSegCurvetoCubicSmoothRel wxSVGPathElement::CreateSVGPathSegCurvetoCubicSmoothRel( | |
- double x, double y, double x2, double y2) const { | |
+wxSVGPathSegCurvetoCubicSmoothRel wxSVGPathElement::CreateSVGPathSegCurvetoCubicSmoothRel(double x, double y, double x2, | |
+ double y2) const { | |
wxSVGPathSegCurvetoCubicSmoothRel res; | |
return res; | |
} | |
-wxSVGPathSegCurvetoQuadraticSmoothAbs wxSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothAbs( | |
- double x, double y) const { | |
+wxSVGPathSegCurvetoQuadraticSmoothAbs wxSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothAbs(double x, | |
+ double y) const { | |
wxSVGPathSegCurvetoQuadraticSmoothAbs res; | |
return res; | |
} | |
-wxSVGPathSegCurvetoQuadraticSmoothRel wxSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothRel( | |
- double x, double y) const { | |
+wxSVGPathSegCurvetoQuadraticSmoothRel wxSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothRel(double x, | |
+ double y) const { | |
wxSVGPathSegCurvetoQuadraticSmoothRel res; | |
return res; | |
} | |
diff -rup wxsvg-1.5.8/src/SVGPolygonElement.cpp wxsvg/src/SVGPolygonElement.cpp | |
--- wxsvg-1.5.8/src/SVGPolygonElement.cpp 2006-01-08 12:44:30.000000000 +0000 | |
+++ wxsvg/src/SVGPolygonElement.cpp 2016-07-28 10:05:28.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: | |
// Author: Alex Thuering | |
// Created: 2005/05/10 | |
-// RCS-ID: $Id: SVGPolygonElement.cpp,v 1.4 2006/01/08 12:44:30 ntalex Exp $ | |
+// RCS-ID: $Id: SVGPolygonElement.cpp,v 1.5 2016/07/28 09:05:28 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -11,62 +11,58 @@ | |
#include "SVGPolygonElement.h" | |
#include "SVGCanvas.h" | |
-wxSVGRect wxSVGPolygonElement::GetBBox(wxSVG_COORDINATES coordinates) | |
-{ | |
- const wxSVGPointList& points = GetPoints(); | |
- if (points.Count() == 0) | |
- return wxSVGRect(); | |
- | |
- wxSVGPoint p0 = points[0]; | |
- wxSVGMatrix matrix; | |
- if (coordinates != wxSVG_COORDINATES_USER) | |
- { | |
- matrix = GetMatrix(coordinates); | |
- p0 = p0.MatrixTransform(matrix); | |
- } | |
- wxSVGRect bbox(p0.GetX(), p0.GetY(), 0, 0); | |
- | |
- wxSVGPoint pi = wxSVGPoint(); | |
- for (int i = 1; i<(int)points.Count(); i++) | |
- { | |
- pi = coordinates == wxSVG_COORDINATES_USER ? | |
- points[i] : points[i].MatrixTransform(matrix); | |
- if (bbox.GetX() > pi.GetX()) | |
- { | |
- bbox.SetWidth(bbox.GetWidth() + bbox.GetX() - pi.GetX()); | |
- bbox.SetX(pi.GetX()); | |
+wxSVGRect wxSVGPolygonElement::GetBBox(wxSVG_COORDINATES coordinates) { | |
+ const wxSVGPointList& points = GetPoints(); | |
+ if (points.Count() == 0) | |
+ return wxSVGRect(); | |
+ | |
+ wxSVGPoint p0 = points[0]; | |
+ wxSVGMatrix matrix; | |
+ if (coordinates != wxSVG_COORDINATES_USER) { | |
+ matrix = GetMatrix(coordinates); | |
+ p0 = p0.MatrixTransform(matrix); | |
} | |
- if (bbox.GetY() > pi.GetY()) | |
- { | |
- bbox.SetHeight(bbox.GetHeight() + bbox.GetY() - pi.GetY()); | |
- bbox.SetY(pi.GetY()); | |
+ wxSVGRect bbox(p0.GetX(), p0.GetY(), 0, 0); | |
+ | |
+ wxSVGPoint pi = wxSVGPoint(); | |
+ for (int i = 1; i < (int) points.Count(); i++) { | |
+ pi = coordinates == wxSVG_COORDINATES_USER ? points[i] : points[i].MatrixTransform(matrix); | |
+ if (bbox.GetX() > pi.GetX()) { | |
+ bbox.SetWidth(bbox.GetWidth() + bbox.GetX() - pi.GetX()); | |
+ bbox.SetX(pi.GetX()); | |
+ } | |
+ if (bbox.GetY() > pi.GetY()) { | |
+ bbox.SetHeight(bbox.GetHeight() + bbox.GetY() - pi.GetY()); | |
+ bbox.SetY(pi.GetY()); | |
+ } | |
+ | |
+ if (bbox.GetX() + bbox.GetWidth() < pi.GetX()) | |
+ bbox.SetWidth(pi.GetX() - bbox.GetX()); | |
+ if (bbox.GetY() + bbox.GetHeight() < pi.GetY()) | |
+ bbox.SetHeight(pi.GetY() - bbox.GetY()); | |
} | |
- | |
- if (bbox.GetX() + bbox.GetWidth() < pi.GetX()) | |
- bbox.SetWidth(pi.GetX() - bbox.GetX()); | |
- if (bbox.GetY() + bbox.GetHeight() < pi.GetY()) | |
- bbox.SetHeight(pi.GetY() - bbox.GetY()); | |
- } | |
- | |
- return bbox; | |
+ | |
+ return bbox; | |
} | |
-wxSVGRect wxSVGPolygonElement::GetResultBBox(wxSVG_COORDINATES coordinates) | |
-{ | |
- wxCSSStyleDeclaration style = GetResultStyle(*this); | |
- if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
- return GetBBox(coordinates); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect bbox = coordinates == wxSVG_COORDINATES_USER ? | |
- m_canvasItem->GetResultBBox(style) : | |
- m_canvasItem->GetResultBBox(style, GetMatrix(coordinates)); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return bbox; | |
+wxSVGRect wxSVGPolygonElement::GetResultBBox(wxSVG_COORDINATES coordinates) { | |
+ wxCSSStyleDeclaration style = GetResultStyle(*this); | |
+ if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
+ return GetBBox(coordinates); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ wxSVGRect bbox; | |
+ if (coordinates == wxSVG_COORDINATES_USER) { | |
+ bbox = m_canvasItem->GetResultBBox(style); | |
+ } else { | |
+ wxSVGMatrix m = GetMatrix(coordinates); | |
+ bbox = m_canvasItem->GetResultBBox(style, &m); | |
+ } | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return bbox; | |
} | |
-void wxSVGPolygonElement::SetCanvasItem(wxSVGCanvasItem* canvasItem) | |
-{ | |
- if (m_canvasItem) | |
- delete m_canvasItem; | |
- m_canvasItem = canvasItem; | |
+void wxSVGPolygonElement::SetCanvasItem(wxSVGCanvasItem* canvasItem) { | |
+ if (m_canvasItem) | |
+ delete m_canvasItem; | |
+ m_canvasItem = canvasItem; | |
} | |
diff -rup wxsvg-1.5.8/src/SVGPolylineElement.cpp wxsvg/src/SVGPolylineElement.cpp | |
--- wxsvg-1.5.8/src/SVGPolylineElement.cpp 2006-01-08 12:44:30.000000000 +0000 | |
+++ wxsvg/src/SVGPolylineElement.cpp 2016-07-28 10:05:28.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: | |
// Author: Alex Thuering | |
// Created: 2005/05/10 | |
-// RCS-ID: $Id: SVGPolylineElement.cpp,v 1.4 2006/01/08 12:44:30 ntalex Exp $ | |
+// RCS-ID: $Id: SVGPolylineElement.cpp,v 1.5 2016/07/28 09:05:28 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -11,62 +11,58 @@ | |
#include "SVGPolylineElement.h" | |
#include "SVGCanvas.h" | |
-wxSVGRect wxSVGPolylineElement::GetBBox(wxSVG_COORDINATES coordinates) | |
-{ | |
- const wxSVGPointList& points = GetPoints(); | |
- if (points.Count() == 0) | |
- return wxSVGRect(); | |
- | |
- wxSVGPoint p0 = points[0]; | |
- wxSVGMatrix matrix; | |
- if (coordinates != wxSVG_COORDINATES_USER) | |
- { | |
- matrix = GetMatrix(coordinates); | |
- p0 = p0.MatrixTransform(matrix); | |
- } | |
- wxSVGRect bbox(p0.GetX(), p0.GetY(), 0, 0); | |
- | |
- wxSVGPoint pi; | |
- for (int i = 1; i<(int)points.Count(); i++) | |
- { | |
- pi = coordinates == wxSVG_COORDINATES_USER ? | |
- points[i] : points[i].MatrixTransform(matrix); | |
- if (bbox.GetX() > pi.GetX()) | |
- { | |
- bbox.SetWidth(bbox.GetWidth() + bbox.GetX() - pi.GetX()); | |
- bbox.SetX(pi.GetX()); | |
+wxSVGRect wxSVGPolylineElement::GetBBox(wxSVG_COORDINATES coordinates) { | |
+ const wxSVGPointList& points = GetPoints(); | |
+ if (points.Count() == 0) | |
+ return wxSVGRect(); | |
+ | |
+ wxSVGPoint p0 = points[0]; | |
+ wxSVGMatrix matrix; | |
+ if (coordinates != wxSVG_COORDINATES_USER) { | |
+ matrix = GetMatrix(coordinates); | |
+ p0 = p0.MatrixTransform(matrix); | |
} | |
- if (bbox.GetY() > pi.GetY()) | |
- { | |
- bbox.SetHeight(bbox.GetHeight() + bbox.GetY() - pi.GetY()); | |
- bbox.SetY(pi.GetY()); | |
+ wxSVGRect bbox(p0.GetX(), p0.GetY(), 0, 0); | |
+ | |
+ wxSVGPoint pi; | |
+ for (int i = 1; i < (int) points.Count(); i++) { | |
+ pi = coordinates == wxSVG_COORDINATES_USER ? points[i] : points[i].MatrixTransform(matrix); | |
+ if (bbox.GetX() > pi.GetX()) { | |
+ bbox.SetWidth(bbox.GetWidth() + bbox.GetX() - pi.GetX()); | |
+ bbox.SetX(pi.GetX()); | |
+ } | |
+ if (bbox.GetY() > pi.GetY()) { | |
+ bbox.SetHeight(bbox.GetHeight() + bbox.GetY() - pi.GetY()); | |
+ bbox.SetY(pi.GetY()); | |
+ } | |
+ | |
+ if (bbox.GetX() + bbox.GetWidth() < pi.GetX()) | |
+ bbox.SetWidth(pi.GetX() - bbox.GetX()); | |
+ if (bbox.GetY() + bbox.GetHeight() < pi.GetY()) | |
+ bbox.SetHeight(pi.GetY() - bbox.GetY()); | |
} | |
- | |
- if (bbox.GetX() + bbox.GetWidth() < pi.GetX()) | |
- bbox.SetWidth(pi.GetX() - bbox.GetX()); | |
- if (bbox.GetY() + bbox.GetHeight() < pi.GetY()) | |
- bbox.SetHeight(pi.GetY() - bbox.GetY()); | |
- } | |
- | |
- return bbox; | |
+ | |
+ return bbox; | |
} | |
-wxSVGRect wxSVGPolylineElement::GetResultBBox(wxSVG_COORDINATES coordinates) | |
-{ | |
- wxCSSStyleDeclaration style = GetResultStyle(*this); | |
- if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
- return GetBBox(coordinates); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect bbox = coordinates == wxSVG_COORDINATES_USER ? | |
- m_canvasItem->GetResultBBox(style) : | |
- m_canvasItem->GetResultBBox(style, GetMatrix(coordinates)); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return bbox; | |
+wxSVGRect wxSVGPolylineElement::GetResultBBox(wxSVG_COORDINATES coordinates) { | |
+ wxCSSStyleDeclaration style = GetResultStyle(*this); | |
+ if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
+ return GetBBox(coordinates); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ wxSVGRect bbox; | |
+ if (coordinates == wxSVG_COORDINATES_USER) { | |
+ bbox = m_canvasItem->GetResultBBox(style); | |
+ } else { | |
+ wxSVGMatrix m = GetMatrix(coordinates); | |
+ bbox = m_canvasItem->GetResultBBox(style, &m); | |
+ } | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return bbox; | |
} | |
-void wxSVGPolylineElement::SetCanvasItem(wxSVGCanvasItem* canvasItem) | |
-{ | |
- if (m_canvasItem) | |
- delete m_canvasItem; | |
- m_canvasItem = canvasItem; | |
+void wxSVGPolylineElement::SetCanvasItem(wxSVGCanvasItem* canvasItem) { | |
+ if (m_canvasItem) | |
+ delete m_canvasItem; | |
+ m_canvasItem = canvasItem; | |
} | |
diff -rup wxsvg-1.5.8/src/SVGRectElement.cpp wxsvg/src/SVGRectElement.cpp | |
--- wxsvg-1.5.8/src/SVGRectElement.cpp 2014-03-24 21:16:35.000000000 +0000 | |
+++ wxsvg/src/SVGRectElement.cpp 2016-07-28 10:05:28.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: Implementation of wxSVGRectElement | |
// Author: Alex Thuering | |
// Created: 2005/05/10 | |
-// RCS-ID: $Id: SVGRectElement.cpp,v 1.6 2014/03/24 21:16:35 ntalex Exp $ | |
+// RCS-ID: $Id: SVGRectElement.cpp,v 1.7 2016/07/28 09:05:28 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -18,8 +18,13 @@ const double pi = 3.1415926; | |
wxSVGRect wxSVGRectElement::GetBBox(wxSVG_COORDINATES coordinates) { | |
WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect bbox = coordinates == wxSVG_COORDINATES_USER ? m_canvasItem->GetBBox() : | |
- m_canvasItem->GetBBox(GetMatrix(coordinates)); | |
+ wxSVGRect bbox; | |
+ if (coordinates == wxSVG_COORDINATES_USER) { | |
+ bbox = m_canvasItem->GetBBox(); | |
+ } else { | |
+ wxSVGMatrix m = GetMatrix(coordinates); | |
+ bbox = m_canvasItem->GetBBox(&m); | |
+ } | |
WX_SVG_CLEAR_M_CANVAS_ITEM | |
return bbox; | |
} | |
@@ -29,8 +34,13 @@ wxSVGRect wxSVGRectElement::GetResultBBo | |
if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
return GetBBox(coordinates); | |
WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect bbox = coordinates == wxSVG_COORDINATES_USER ? m_canvasItem->GetResultBBox(style) : | |
- m_canvasItem->GetResultBBox(style, GetMatrix(coordinates)); | |
+ wxSVGRect bbox; | |
+ if (coordinates == wxSVG_COORDINATES_USER) { | |
+ bbox = m_canvasItem->GetResultBBox(style); | |
+ } else { | |
+ wxSVGMatrix m = GetMatrix(coordinates); | |
+ bbox = m_canvasItem->GetResultBBox(style, &m); | |
+ } | |
WX_SVG_CLEAR_M_CANVAS_ITEM | |
return bbox; | |
} | |
diff -rup wxsvg-1.5.8/src/SVGTextElement.cpp wxsvg/src/SVGTextElement.cpp | |
--- wxsvg-1.5.8/src/SVGTextElement.cpp 2008-04-14 16:44:55.000000000 +0100 | |
+++ wxsvg/src/SVGTextElement.cpp 2016-07-28 10:05:28.000000000 +0100 | |
@@ -3,7 +3,7 @@ | |
// Purpose: svg text element | |
// Author: Alex Thuering | |
// Created: 2005/05/10 | |
-// RCS-ID: $Id: SVGTextElement.cpp,v 1.5 2008/04/14 15:44:55 etisserant Exp $ | |
+// RCS-ID: $Id: SVGTextElement.cpp,v 1.6 2016/07/28 09:05:28 ntalex Exp $ | |
// Copyright: (c) 2005 Alex Thuering | |
// Licence: wxWindows licence | |
////////////////////////////////////////////////////////////////////////////// | |
@@ -12,108 +12,106 @@ | |
#include "SVGCanvas.h" | |
#include <math.h> | |
-wxSVGRect wxSVGTextElement::GetBBox(wxSVG_COORDINATES coordinates) | |
-{ | |
- wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect bbox = coordinates == wxSVG_COORDINATES_USER ? | |
- m_canvasItem->GetBBox() : m_canvasItem->GetBBox(GetMatrix(coordinates)); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return bbox.MatrixTransform(matrix); | |
- //return bbox; | |
-} | |
- | |
-wxSVGRect wxSVGTextElement::GetResultBBox(wxSVG_COORDINATES coordinates) | |
-{ | |
- wxCSSStyleDeclaration style = GetResultStyle(*this); | |
- if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
- return GetBBox(coordinates); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect bbox = coordinates == wxSVG_COORDINATES_USER ? | |
- m_canvasItem->GetResultBBox(style) : | |
- m_canvasItem->GetResultBBox(style, GetMatrix(coordinates)); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return bbox; | |
-} | |
- | |
-void wxSVGTextElement::SetCanvasItem(wxSVGCanvasItem* canvasItem) | |
-{ | |
- if (m_canvasItem) | |
- delete m_canvasItem; | |
- m_canvasItem = canvasItem; | |
-} | |
- | |
-long wxSVGTextElement::GetNumberOfChars() | |
-{ | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- long number = ((wxSVGCanvasText*)m_canvasItem)->GetNumberOfChars(); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return number; | |
-} | |
- | |
-double wxSVGTextElement::GetComputedTextLength() | |
-{ | |
- wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- double length = ((wxSVGCanvasText*)m_canvasItem)->GetComputedTextLength(); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return length * sqrt(matrix.GetA() * matrix.GetA() + matrix.GetB() * matrix.GetB()); | |
-} | |
- | |
-double wxSVGTextElement::GetSubStringLength(unsigned long charnum, unsigned long nchars) | |
-{ | |
- wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- double length = ((wxSVGCanvasText*)m_canvasItem)->GetSubStringLength(charnum, nchars); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return length * sqrt(matrix.GetA() * matrix.GetA() + matrix.GetB() * matrix.GetB()); | |
-} | |
- | |
-wxSVGPoint wxSVGTextElement::GetStartPositionOfChar(unsigned long charnum) | |
-{ | |
- wxSVGPoint real_position; | |
- wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGPoint position = ((wxSVGCanvasText*)m_canvasItem)->GetStartPositionOfChar(charnum); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- real_position.SetX(matrix.GetA() * position.GetX() + matrix.GetB() * position.GetY() + matrix.GetE()); | |
- real_position.SetY(matrix.GetB() * position.GetX() + matrix.GetD() * position.GetY() + matrix.GetF()); | |
- return real_position; | |
-} | |
- | |
-wxSVGPoint wxSVGTextElement::GetEndPositionOfChar(unsigned long charnum) | |
-{ | |
- wxSVGPoint real_position; | |
- wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGPoint position = ((wxSVGCanvasText*)m_canvasItem)->GetEndPositionOfChar(charnum); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- real_position.SetX(matrix.GetA() * position.GetX() + matrix.GetB() * position.GetY() + matrix.GetE()); | |
- real_position.SetY(matrix.GetB() * position.GetX() + matrix.GetD() * position.GetY() + matrix.GetF()); | |
- return real_position; | |
-} | |
- | |
-wxSVGRect wxSVGTextElement::GetExtentOfChar(unsigned long charnum) | |
-{ | |
- wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- wxSVGRect extent = ((wxSVGCanvasText*)m_canvasItem)->GetExtentOfChar(charnum); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return extent.MatrixTransform(matrix); | |
-} | |
- | |
-double wxSVGTextElement::GetRotationOfChar(unsigned long charnum) | |
-{ | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- double rotation = ((wxSVGCanvasText*)m_canvasItem)->GetRotationOfChar(charnum); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return rotation; | |
-} | |
- | |
-long wxSVGTextElement::GetCharNumAtPosition(const wxSVGPoint& point) | |
-{ | |
- WX_SVG_CREATE_M_CANVAS_ITEM | |
- long charnum = ((wxSVGCanvasText*)m_canvasItem)->GetCharNumAtPosition(point); | |
- WX_SVG_CLEAR_M_CANVAS_ITEM | |
- return charnum; | |
+wxSVGRect wxSVGTextElement::GetBBox(wxSVG_COORDINATES coordinates) { | |
+ wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ wxSVGRect bbox; | |
+ if (coordinates == wxSVG_COORDINATES_USER) { | |
+ bbox = m_canvasItem->GetBBox(); | |
+ } else { | |
+ wxSVGMatrix m = GetMatrix(coordinates); | |
+ bbox = m_canvasItem->GetBBox(&m); | |
+ } | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return bbox.MatrixTransform(matrix); | |
+ //return bbox; | |
+} | |
+ | |
+wxSVGRect wxSVGTextElement::GetResultBBox(wxSVG_COORDINATES coordinates) { | |
+ wxCSSStyleDeclaration style = GetResultStyle(*this); | |
+ if (style.GetStroke().GetPaintType() == wxSVG_PAINTTYPE_NONE) | |
+ return GetBBox(coordinates); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ wxSVGRect bbox; | |
+ if (coordinates == wxSVG_COORDINATES_USER) { | |
+ bbox = m_canvasItem->GetResultBBox(style); | |
+ } else { | |
+ wxSVGMatrix m = GetMatrix(coordinates); | |
+ bbox = m_canvasItem->GetResultBBox(style, &m); | |
+ } | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return bbox; | |
+} | |
+ | |
+void wxSVGTextElement::SetCanvasItem(wxSVGCanvasItem* canvasItem) { | |
+ if (m_canvasItem) | |
+ delete m_canvasItem; | |
+ m_canvasItem = canvasItem; | |
+} | |
+ | |
+long wxSVGTextElement::GetNumberOfChars() { | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ long number = ((wxSVGCanvasText*) m_canvasItem)->GetNumberOfChars(); | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return number; | |
+} | |
+ | |
+double wxSVGTextElement::GetComputedTextLength() { | |
+ wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ double length = ((wxSVGCanvasText*) m_canvasItem)->GetComputedTextLength(); | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return length * sqrt(matrix.GetA() * matrix.GetA() + matrix.GetB() * matrix.GetB()); | |
+} | |
+ | |
+double wxSVGTextElement::GetSubStringLength(unsigned long charnum, unsigned long nchars) { | |
+ wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ double length = ((wxSVGCanvasText*) m_canvasItem)->GetSubStringLength(charnum, nchars); | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return length * sqrt(matrix.GetA() * matrix.GetA() + matrix.GetB() * matrix.GetB()); | |
+} | |
+ | |
+wxSVGPoint wxSVGTextElement::GetStartPositionOfChar(unsigned long charnum) { | |
+ wxSVGPoint real_position; | |
+ wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ wxSVGPoint position = ((wxSVGCanvasText*) m_canvasItem)->GetStartPositionOfChar(charnum); | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ real_position.SetX(matrix.GetA() * position.GetX() + matrix.GetB() * position.GetY() + matrix.GetE()); | |
+ real_position.SetY(matrix.GetB() * position.GetX() + matrix.GetD() * position.GetY() + matrix.GetF()); | |
+ return real_position; | |
+} | |
+ | |
+wxSVGPoint wxSVGTextElement::GetEndPositionOfChar(unsigned long charnum) { | |
+ wxSVGPoint real_position; | |
+ wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ wxSVGPoint position = ((wxSVGCanvasText*) m_canvasItem)->GetEndPositionOfChar(charnum); | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ real_position.SetX(matrix.GetA() * position.GetX() + matrix.GetB() * position.GetY() + matrix.GetE()); | |
+ real_position.SetY(matrix.GetB() * position.GetX() + matrix.GetD() * position.GetY() + matrix.GetF()); | |
+ return real_position; | |
+} | |
+ | |
+wxSVGRect wxSVGTextElement::GetExtentOfChar(unsigned long charnum) { | |
+ wxSVGMatrix matrix = wxSVGLocatable::GetCTM(this); | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ wxSVGRect extent = ((wxSVGCanvasText*) m_canvasItem)->GetExtentOfChar(charnum); | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return extent.MatrixTransform(matrix); | |
+} | |
+ | |
+double wxSVGTextElement::GetRotationOfChar(unsigned long charnum) { | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ double rotation = ((wxSVGCanvasText*) m_canvasItem)->GetRotationOfChar(charnum); | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return rotation; | |
+} | |
+ | |
+long wxSVGTextElement::GetCharNumAtPosition(const wxSVGPoint& point) { | |
+ WX_SVG_CREATE_M_CANVAS_ITEM | |
+ long charnum = ((wxSVGCanvasText*) m_canvasItem)->GetCharNumAtPosition(point); | |
+ WX_SVG_CLEAR_M_CANVAS_ITEM | |
+ return charnum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment