Ejemplo n.º 1
0
//virtual
gm::RectD PSVGPolylineElement::GetScreenBBox()
{
	SVGPolylineElement* psvgElement = static_cast<SVGPolylineElement*>(m_pNode);

	/*
	CComQIPtr<ILSVGTransformable> transformable = m_pNode;

	CComPtr<ILSVGMatrix> matrix;
	transformable->getScreenCTM(&matrix);
	*/

	gm::Matrix3d* matrix = GetScreenCTM();
	//matrix = matrix * m_

	LDraw::RectD bbox;
	ASSERT(0);
	//bbox = psvgElement->m_points->m_animated->m_animVal->m_value->CalculateBoundingBox(matrix->m_matrix);

	return bbox;
}
Ejemplo n.º 2
0
wxSVGMatrix wxSVGLocatable::GetScreenCTM(const wxSVGElement* element) {
	if (element == NULL || element->GetType() != wxSVGXML_ELEMENT_NODE)
		return wxSVGMatrix();

	wxSVGMatrix matrix;
	if (element->GetParent())
		matrix = GetScreenCTM((wxSVGElement*) (element->GetParent()));
	else if (element->GetOwnerDocument())
		matrix = ((wxSVGDocument*) element->GetOwnerDocument())->GetScreenCTM();

	if (element->GetDtd() == wxSVG_SVG_ELEMENT) {
		((wxSVGSVGElement*) element)->UpdateMatrix(matrix);
	} else {
		const wxSVGTransformable* transformable =
				wxSVGTransformable::GetSVGTransformable(*element);
		if (transformable)
			transformable->UpdateMatrix(matrix);
	}
	return matrix;
}
/* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */
NS_IMETHODIMP nsSVGGraphicElement::GetTransformToElement(nsIDOMSVGElement *element, nsIDOMSVGMatrix **_retval)
{
  if (!element)
    return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;

  nsresult rv;
  *_retval = nsnull;
  nsCOMPtr<nsIDOMSVGMatrix> ourScreenCTM;
  nsCOMPtr<nsIDOMSVGMatrix> targetScreenCTM;
  nsCOMPtr<nsIDOMSVGMatrix> tmp;
  nsCOMPtr<nsIDOMSVGLocatable> target = do_QueryInterface(element, &rv);
  if (NS_FAILED(rv)) return rv;

  // the easiest way to do this (if likely to increase rounding error):
  rv = GetScreenCTM(getter_AddRefs(ourScreenCTM));
  if (NS_FAILED(rv)) return rv;
  rv = target->GetScreenCTM(getter_AddRefs(targetScreenCTM));
  if (NS_FAILED(rv)) return rv;
  rv = targetScreenCTM->Inverse(getter_AddRefs(tmp));
  if (NS_FAILED(rv)) return rv;
  return tmp->Multiply(ourScreenCTM, _retval);  // addrefs, so we don't
}
Ejemplo n.º 4
0
already_AddRefed<DOMSVGMatrix>
SVGLocatableElement::GetTransformToElement(nsSVGElement& aElement,
                                           ErrorResult& rv)
{
  nsCOMPtr<nsIDOMSVGLocatable> target = do_QueryInterface(&aElement);
  if (!target) {
    rv.Throw(NS_NOINTERFACE);
    return nullptr;
  }

  // the easiest way to do this (if likely to increase rounding error):
  nsCOMPtr<DOMSVGMatrix> ourScreenCTM = GetScreenCTM();
  nsCOMPtr<DOMSVGMatrix> targetScreenCTM;
  target->GetScreenCTM(getter_AddRefs(targetScreenCTM));
  if (!ourScreenCTM || !targetScreenCTM) {
    rv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
    return nullptr;
  }
  nsCOMPtr<DOMSVGMatrix> tmp = targetScreenCTM->Inverse(rv);
  if (rv.Failed()) return nullptr;

  nsCOMPtr<DOMSVGMatrix> mat = tmp->Multiply(*ourScreenCTM).get();
  return mat.forget();
}
Ejemplo n.º 5
0
/* DOMSVGMatrix getScreenCTM (); */
NS_IMETHODIMP
SVGLocatableElement::GetScreenCTM(nsISupports * *aCTM)
{
  *aCTM = GetScreenCTM().get();
  return NS_OK;
}