void wxSVGCanvas::DrawCanvasText(wxSVGCanvasText& canvasText, wxSVGMatrix& matrix, const wxCSSStyleDeclaration& style, wxSVGSVGElement& svgElem) { for (int i=0; i<(int)canvasText.m_chunks.Count(); i++) { wxSVGCanvasTextChunk& chunk = canvasText.m_chunks[i]; chunk.style.SetFillRule(wxCSS_VALUE_EVENODD); wxSVGMatrix pathMatrix = matrix.Multiply(chunk.matrix); for (unsigned int j=0; j<chunk.chars.Count(); j++) DrawItem(*chunk.chars[j].path, pathMatrix, chunk.style, svgElem); } }
void wxSVGCanvas::GetRadialGradientTransform(wxSVGPoint& focus, wxSVGMatrix& matrix, const wxSVGRadialGradientElement& gradElem, wxSVGCanvasPath& path, bool scale) { double r, cx, cy, fx, fy; r = gradElem.GetR().GetAnimVal(); cx = gradElem.GetCx().GetAnimVal(); cy = gradElem.GetCy().GetAnimVal(); fx = gradElem.GetFx().GetAnimVal(); fy = gradElem.GetFy().GetAnimVal(); if (gradElem.GetGradientUnits().GetAnimVal() == wxSVG_UNIT_TYPE_UNKNOWN || gradElem.GetGradientUnits().GetAnimVal() == wxSVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { wxSVGRect bbox = path.GetBBox(); r = r*sqrt(bbox.GetWidth()*bbox.GetWidth() + bbox.GetHeight()*bbox.GetHeight()); cx = bbox.GetX() + cx*bbox.GetWidth(); cy = bbox.GetY() + cy*bbox.GetHeight(); fx = bbox.GetX() + fx*bbox.GetWidth(); fy = bbox.GetY() + fy*bbox.GetHeight(); } // Compute gradient transformation matrix const wxSVGTransformList& transforms = gradElem.GetGradientTransform().GetAnimVal(); for (int i=0; i<(int)transforms.Count(); i++) matrix = matrix.Multiply(transforms[i].GetMatrix()); // Apply Gradient parameters to transformation matrix = matrix.Translate(cx, cy); //.Scale(r); if (scale) matrix = matrix.Scale(r); // Change Focus reference to gradient reference focus.SetX((fx - cx) / r); focus.SetY((fy - cy) / r); }
void wxSVGTransformable::UpdateMatrix(wxSVGMatrix& matrix) const { const wxSVGTransformList& transforms = GetTransform().GetAnimVal(); for (unsigned int i = 0; i < transforms.Count(); i++) matrix = matrix.Multiply(transforms[i].GetMatrix()); }