javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGPath.java
changeset 87 1627c337e51e
parent 56 abc41079b313
equal deleted inserted replaced
80:d6dafc5d983f 87:1627c337e51e
     1 /*
     1 /*
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    29 public class M2GSVGPath extends M2GObject implements SVGPath
    29 public class M2GSVGPath extends M2GObject implements SVGPath
    30 {
    30 {
    31     //--------------------------------------------------
    31     //--------------------------------------------------
    32     // STATIC CONTANTS
    32     // STATIC CONTANTS
    33     //--------------------------------------------------
    33     //--------------------------------------------------
    34     /* Optimization: static finals changed to local variables
    34 
    35     private static final String SEGMENT_INDEX_SIZE_ESTR =
       
    36     "The segment index is out of bounds.";
       
    37     private static final String PARAMETER_INDEX_SIZE_ESTR =
       
    38     "The parameter index is out of bounds for this segment's type.";
       
    39     */
       
    40     private static final int CLOSE_PARAMETER_COUNT = 0;
    35     private static final int CLOSE_PARAMETER_COUNT = 0;
    41     private static final int MOVE_TO_PARAMETER_COUNT = 2;
    36     private static final int MOVE_TO_PARAMETER_COUNT = 2;
    42     private static final int LINE_TO_PARAMETER_COUNT = 2;
    37     private static final int LINE_TO_PARAMETER_COUNT = 2;
    43     private static final int CURVE_TO_PARAMETER_COUNT = 6;
    38     private static final int CURVE_TO_PARAMETER_COUNT = 6;
    44     private static final int QUAD_TO_PARAMETER_COUNT = 4;
    39     private static final int QUAD_TO_PARAMETER_COUNT = 4;
    89      * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
    84      * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
    90      */
    85      */
    91     protected void doCleanup()
    86     protected void doCleanup()
    92     {
    87     {
    93         _destroyPath(getNativeSVGProxyHandle(),
    88         _destroyPath(getNativeSVGProxyHandle(),
    94             getHandle());
    89                      getHandle());
    95         resetHandles();
    90         resetHandles();
    96     }
    91     }
    97 
    92 
    98     /**
    93     /**
    99      * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
    94      * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
   109      * @see org.w3c.dom.svg.SVGPath#getNumberOfSegments()
   104      * @see org.w3c.dom.svg.SVGPath#getNumberOfSegments()
   110      */
   105      */
   111     public int getNumberOfSegments()
   106     public int getNumberOfSegments()
   112     {
   107     {
   113         return _getNumberOfSegments(getNativeSVGProxyHandle(),
   108         return _getNumberOfSegments(getNativeSVGProxyHandle(),
   114                                     getHandle() );
   109                                     getHandle());
   115     }
   110     }
   116 
   111 
   117     /**
   112     /**
   118      * @see org.w3c.dom.svg.SVGPath#getSegment()
   113      * @see org.w3c.dom.svg.SVGPath#getSegment()
   119      */
   114      */
   166      * @see org.w3c.dom.svg.SVGPath#curveTo()
   161      * @see org.w3c.dom.svg.SVGPath#curveTo()
   167      */
   162      */
   168     public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
   163     public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
   169     {
   164     {
   170         _addCurveTo(getNativeSVGProxyHandle(),
   165         _addCurveTo(getNativeSVGProxyHandle(),
   171             getHandle(), x1, y1, x2, y2, x3, y3);
   166                     getHandle(), x1, y1, x2, y2, x3, y3);
   172     }
   167     }
   173 
   168 
   174     /**
   169     /**
   175      * @see org.w3c.dom.svg.SVGPath#getSegmentParam()
   170      * @see org.w3c.dom.svg.SVGPath#getSegmentParam()
   176      */
   171      */
   207     /**
   202     /**
   208      * @see org.w3c.dom.svg.SVGPath#moveTo()
   203      * @see org.w3c.dom.svg.SVGPath#moveTo()
   209      */
   204      */
   210     public void moveTo(float x, float y)
   205     public void moveTo(float x, float y)
   211     {
   206     {
   212         _addMoveTo(getNativeSVGProxyHandle(), getHandle(), x, y );
   207         _addMoveTo(getNativeSVGProxyHandle(), getHandle(), x, y);
   213     }
   208     }
   214 
   209 
   215     /**
   210     /**
   216      * @see org.w3c.dom.svg.SVGPath#quadTo()
   211      * @see org.w3c.dom.svg.SVGPath#quadTo()
   217      */
   212      */
   220         _addQuadTo(getNativeSVGProxyHandle(),
   215         _addQuadTo(getNativeSVGProxyHandle(),
   221                    getHandle(),
   216                    getHandle(),
   222                    x1,
   217                    x1,
   223                    y1,
   218                    y1,
   224                    x2,
   219                    x2,
   225                    y2 );
   220                    y2);
   226     }
   221     }
   227 
   222 
   228     //--------------------------------------------------
   223     //--------------------------------------------------
   229     // NATIVE METHODS
   224     // NATIVE METHODS
   230     //--------------------------------------------------
   225     //--------------------------------------------------