Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
nsSVGTransform Class Reference
Inheritance diagram for nsSVGTransform:
Inheritance graph
[legend]
Collaboration diagram for nsSVGTransform:
Collaboration graph
[legend]

List of all members.

Public Types

enum  modificationType { mod_other = 0, mod_context, mod_die }

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIDOMSVGTRANSFORM
NS_IMETHOD 
SetValueString (const nsAString &aValue)
NS_IMETHOD GetValueString (nsAString &aValue)
NS_IMETHOD WillModifySVGObservable (nsISVGValue *observable, modificationType aModType)
NS_IMETHOD DidModifySVGObservable (nsISVGValue *observable, modificationType aModType)
void setMatrix (in nsIDOMSVGMatrix matrix)
void setTranslate (in float tx, in float ty)
void setScale (in float sx, in float sy)
void setRotate (in float angle, in float cx, in float cy)
void setSkewX (in float angle)
void setSkewY (in float angle)
NS_IMETHOD AddObserver (nsISVGValueObserver *observer)
NS_IMETHOD RemoveObserver (nsISVGValueObserver *observer)
NS_IMETHOD BeginBatchUpdate ()
NS_IMETHOD EndBatchUpdate ()
typedef NS_STDCALL_FUNCPROTO (nsresult, SVGObserverNotifyFunction, nsISVGValueObserver, DidModifySVGObservable,(nsISVGValue *, nsISVGValue::modificationType))

Static Public Member Functions

static nsresult Create (nsIDOMSVGTransform **aResult)

Public Attributes

const unsigned short SVG_TRANSFORM_UNKNOWN = 0
const unsigned short SVG_TRANSFORM_MATRIX = 1
const unsigned short SVG_TRANSFORM_TRANSLATE = 2
const unsigned short SVG_TRANSFORM_SCALE = 3
const unsigned short SVG_TRANSFORM_ROTATE = 4
const unsigned short SVG_TRANSFORM_SKEWX = 5
const unsigned short SVG_TRANSFORM_SKEWY = 6
readonly attribute unsigned short type
readonly attribute nsIDOMSVGMatrix matrix
readonly attribute float angle

Protected Member Functions

 nsSVGTransform ()
 ~nsSVGTransform ()
nsresult Init ()
void WillModify (modificationType aModType=mod_other)
void DidModify (modificationType aModType=mod_other)
void ReleaseObservers ()
void NotifyObservers (SVGObserverNotifyFunction f, modificationType aModType)
PRInt32 GetModifyNestCount ()

Protected Attributes

nsCOMPtr< nsIDOMSVGMatrixmMatrix
float mAngle
float mOriginX
float mOriginY
PRUint16 mType

Friends

class nsSVGValueAutoNotifier

Detailed Description

Definition at line 56 of file nsSVGTransform.cpp.


Member Enumeration Documentation

Enumerator:
mod_other 
mod_context 
mod_die 

Definition at line 68 of file nsISVGValue.h.


Constructor & Destructor Documentation

Definition at line 111 of file nsSVGTransform.cpp.

Here is the caller graph for this function:

Definition at line 119 of file nsSVGTransform.cpp.


Member Function Documentation

NS_IMETHODIMP nsSVGValue::AddObserver ( nsISVGValueObserver observer) [virtual, inherited]

Implements nsISVGValue.

Definition at line 97 of file nsSVGValue.cpp.

{
  nsIWeakReference* wr = NS_GetWeakReference(observer);
  if (!wr) return NS_ERROR_FAILURE;
  mObservers.AppendElement((void*)wr);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsSVGValue::BeginBatchUpdate ( ) [virtual, inherited]

Implements nsISVGValue.

Definition at line 119 of file nsSVGValue.cpp.

{
  WillModify();
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 96 of file nsSVGTransform.cpp.

{
  nsSVGTransform *pl = new nsSVGTransform();
  NS_ENSURE_TRUE(pl, NS_ERROR_OUT_OF_MEMORY);
  NS_ADDREF(pl);
  if (NS_FAILED(pl->Init())) {
    NS_RELEASE(pl);
    *aResult = nsnull;
    return NS_ERROR_FAILURE;
  }
  *aResult = pl;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsSVGValue::DidModify ( modificationType  aModType = mod_other) [protected, inherited]

Definition at line 86 of file nsSVGValue.cpp.

{
  NS_ASSERTION(mModifyNestCount>0, "unbalanced Will/DidModify calls");
  if (--mModifyNestCount == 0) {
    OnDidModify();
    NotifyObservers(&nsISVGValueObserver::DidModifySVGObservable, aModType);
  }
}

Here is the call graph for this function:

Implements nsISVGValueObserver.

Definition at line 247 of file nsSVGTransform.cpp.

{
  DidModify();
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsSVGValue::EndBatchUpdate ( ) [virtual, inherited]

Implements nsISVGValue.

Definition at line 126 of file nsSVGValue.cpp.

{
  DidModify();
  return NS_OK;
}

Here is the call graph for this function:

PRInt32 nsSVGValue::GetModifyNestCount ( ) [inline, protected, inherited]

Definition at line 79 of file nsSVGValue.h.

{ return mModifyNestCount; }
NS_IMETHODIMP nsSVGTransform::GetValueString ( nsAString &  aValue) [virtual]

Implements nsISVGValue.

Definition at line 158 of file nsSVGTransform.cpp.

{
  aValue.Truncate();
  PRUnichar buf[256];
  
  switch (mType) {
    case nsIDOMSVGTransform::SVG_TRANSFORM_TRANSLATE:
      {
        float dx, dy;
        mMatrix->GetE(&dx);
        mMatrix->GetF(&dy);
        if (dy != 0.0f)
          nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), NS_LITERAL_STRING("translate(%g, %g)").get(), dx, dy);
        else
          nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), NS_LITERAL_STRING("translate(%g)").get(), dx);
      }
      break;
    case nsIDOMSVGTransform::SVG_TRANSFORM_ROTATE:
      {
        if (mOriginX != 0.0f || mOriginY != 0.0f)
          nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
                                    NS_LITERAL_STRING("rotate(%g, %g, %g)").get(),
                                    mAngle, mOriginX, mOriginY);
        else
          nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
                                    NS_LITERAL_STRING("rotate(%g)").get(), mAngle);
      }
      break;        
    case nsIDOMSVGTransform::SVG_TRANSFORM_SCALE:
      {
        float sx, sy;
        mMatrix->GetA(&sx);
        mMatrix->GetD(&sy);
        if (sy != 0.0f)
          nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
                                    NS_LITERAL_STRING("scale(%g, %g)").get(), sx, sy);
        else
          nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
                                    NS_LITERAL_STRING("scale(%g)").get(), sx);
      }
      break;
    case nsIDOMSVGTransform::SVG_TRANSFORM_SKEWX:
      {
        nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
                                  NS_LITERAL_STRING("skewX(%g)").get(), mAngle);
      }
      break;
    case nsIDOMSVGTransform::SVG_TRANSFORM_SKEWY:
      {
        nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
                                  NS_LITERAL_STRING("skewY(%g)").get(), mAngle);
      }
      break;
    case nsIDOMSVGTransform::SVG_TRANSFORM_MATRIX:
      {
        float a,b,c,d,e,f;
        mMatrix->GetA(&a);
        mMatrix->GetB(&b);
        mMatrix->GetC(&c);
        mMatrix->GetD(&d);
        mMatrix->GetE(&e);
        mMatrix->GetF(&f);
        nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
                                  NS_LITERAL_STRING("matrix(%g, %g, %g, %g, %g, %g)").get(),
                                  a, b, c, d, e, f);
      }
      break;
    default:
      buf[0] = '\0';
      NS_ERROR("unknown transformation type");
      break;
  }

  aValue.Append(buf);
  
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsSVGTransform::Init ( void  ) [protected]

Definition at line 124 of file nsSVGTransform.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsSVGValue::NotifyObservers ( SVGObserverNotifyFunction  f,
modificationType  aModType 
) [protected, inherited]

Definition at line 66 of file nsSVGValue.cpp.

{
  PRInt32 count = mObservers.Count();
  for (PRInt32 i = 0; i < count; ++i) {
    nsIWeakReference* wr = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
    nsCOMPtr<nsISVGValueObserver> observer = do_QueryReferent(wr);
    if (observer)
       (NS_STATIC_CAST(nsISVGValueObserver*,observer)->*f)(this, aModType);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

typedef nsSVGValue::NS_STDCALL_FUNCPROTO ( nsresult  ,
SVGObserverNotifyFunction  ,
nsISVGValueObserver  ,
DidModifySVGObservable  ,
(nsISVGValue *, nsISVGValue::modificationType  
) [inherited]
void nsSVGValue::ReleaseObservers ( ) [protected, inherited]

Definition at line 53 of file nsSVGValue.cpp.

{
  PRInt32 count = mObservers.Count();
  PRInt32 i;
  for (i = 0; i < count; ++i) {
    nsIWeakReference* wr = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
    NS_RELEASE(wr);
  }
  while (i)
    mObservers.RemoveElementAt(--i);
}

Here is the caller graph for this function:

NS_IMETHODIMP nsSVGValue::RemoveObserver ( nsISVGValueObserver observer) [virtual, inherited]

Implements nsISVGValue.

Definition at line 106 of file nsSVGValue.cpp.

{
  nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(observer);
  if (!wr) return NS_ERROR_FAILURE;
  PRInt32 i = mObservers.IndexOf((void*)wr);
  if (i<0) return NS_ERROR_FAILURE;
  nsIWeakReference* wr2 = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
  NS_RELEASE(wr2);
  mObservers.RemoveElementAt(i);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIDOMSVGTransform::setRotate ( in float  angle,
in float  cx,
in float  cy 
) [inherited]
void nsIDOMSVGTransform::setScale ( in float  sx,
in float  sy 
) [inherited]
void nsIDOMSVGTransform::setSkewX ( in float  angle) [inherited]
void nsIDOMSVGTransform::setSkewY ( in float  angle) [inherited]
void nsIDOMSVGTransform::setTranslate ( in float  tx,
in float  ty 
) [inherited]

Implements nsISVGValue.

Definition at line 151 of file nsSVGTransform.cpp.

{
  NS_NOTYETIMPLEMENTED("nsSVGTransform::SetValueString");
  return NS_ERROR_NOT_IMPLEMENTED;
}
void nsSVGValue::WillModify ( modificationType  aModType = mod_other) [protected, inherited]

Definition at line 79 of file nsSVGValue.cpp.

Here is the call graph for this function:

Implements nsISVGValueObserver.

Definition at line 240 of file nsSVGTransform.cpp.

{
  WillModify();
  return NS_OK;
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class nsSVGValueAutoNotifier [friend, inherited]

Definition at line 59 of file nsSVGValue.h.


Member Data Documentation

readonly attribute float nsIDOMSVGTransform::angle [inherited]

Definition at line 57 of file nsIDOMSVGTransform.idl.

float nsSVGTransform::mAngle [protected]

Definition at line 87 of file nsSVGTransform.cpp.

Definition at line 56 of file nsIDOMSVGTransform.idl.

Definition at line 86 of file nsSVGTransform.cpp.

float nsSVGTransform::mOriginX [protected]

Definition at line 87 of file nsSVGTransform.cpp.

float nsSVGTransform::mOriginY [protected]

Definition at line 87 of file nsSVGTransform.cpp.

Definition at line 88 of file nsSVGTransform.cpp.

const unsigned short nsIDOMSVGTransform::SVG_TRANSFORM_MATRIX = 1 [inherited]

Definition at line 48 of file nsIDOMSVGTransform.idl.

const unsigned short nsIDOMSVGTransform::SVG_TRANSFORM_ROTATE = 4 [inherited]

Definition at line 51 of file nsIDOMSVGTransform.idl.

const unsigned short nsIDOMSVGTransform::SVG_TRANSFORM_SCALE = 3 [inherited]

Definition at line 50 of file nsIDOMSVGTransform.idl.

const unsigned short nsIDOMSVGTransform::SVG_TRANSFORM_SKEWX = 5 [inherited]

Definition at line 52 of file nsIDOMSVGTransform.idl.

const unsigned short nsIDOMSVGTransform::SVG_TRANSFORM_SKEWY = 6 [inherited]

Definition at line 53 of file nsIDOMSVGTransform.idl.

const unsigned short nsIDOMSVGTransform::SVG_TRANSFORM_TRANSLATE = 2 [inherited]

Definition at line 49 of file nsIDOMSVGTransform.idl.

const unsigned short nsIDOMSVGTransform::SVG_TRANSFORM_UNKNOWN = 0 [inherited]

Definition at line 47 of file nsIDOMSVGTransform.idl.

readonly attribute unsigned short nsIDOMSVGTransform::type [inherited]

Definition at line 55 of file nsIDOMSVGTransform.idl.


The documentation for this class was generated from the following file: