Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / extension / internal / javafx-out.cpp
index 417755e1973f19354dcae0a2367486cfa64ef04f..7098027c7847dd4dfc3316c1cff9b1ba0b50902d 100644 (file)
@@ -9,6 +9,7 @@
  *   Silveira Neto <silveiraneto@gmail.com>
  *   Jim Clarke <Jim.Clarke@sun.com>
  *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2008,2009 Authors
  *
@@ -141,7 +142,7 @@ static JavaFXOutput::String rgba(guint32 rgba)
     unsigned int a = SP_RGBA32_A_U(rgba);
     char buf[80];
     snprintf(buf, 79, "Color.rgb(0x%02x, 0x%02x, 0x%02x, %s)",
-                           r, g, b, DSTR((double)a/256.0));
+                           r, g, b, DSTR((double)a/255.0));
     JavaFXOutput::String s = buf;
     return s;
 }
@@ -386,7 +387,7 @@ bool JavaFXOutput::doStyle(SPStyle *style)
     /**
      * Fill
      */
-    SPIPaint fill = style->fill;
+    SPIPaint const &fill = style->fill;
     if (fill.isColor())
         {
         // see color.h for how to parse SPColor
@@ -423,7 +424,7 @@ bool JavaFXOutput::doStyle(SPStyle *style)
      */
     if (style->stroke_opacity.value > 0)
         {
-        SPIPaint stroke = style->stroke;
+        SPIPaint const &stroke = style->stroke;
         out("            stroke: %s\n",
             rgba(stroke.value.color, SP_SCALE24_TO_FLOAT(style->stroke_opacity.value)).c_str());
         double strokewidth = style->stroke_width.value;
@@ -493,7 +494,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id)
 
     // convert the path to only lineto's and cubic curveto's:
     Geom::Scale yflip(1.0, -1.0);
-    Geom::Matrix tf = sp_item_i2d_affine(item) * yflip;
+    Geom::Matrix tf = item->i2d_affine() * yflip;
     Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf );
 
     //Count the NR_CURVETOs/LINETOs (including closing line segment)
@@ -635,7 +636,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id)
 
     // convert the path to only lineto's and cubic curveto's:
     Geom::Scale yflip(1.0, -1.0);
-    Geom::Matrix tf = sp_item_i2d_affine(item) * yflip;
+    Geom::Matrix tf = item->i2d_affine() * yflip;
     Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf );
 
     //Count the NR_CURVETOs/LINETOs (including closing line segment)
@@ -707,7 +708,7 @@ bool JavaFXOutput::doTreeRecursive(SPDocument *doc, SPObject *obj)
      * Check the type of node and process
      */
     String id;
-    if (!obj->id)
+    if (!obj->getId())
         {
         char buf[16];
         sprintf(buf, "id%d", idindex++);
@@ -715,7 +716,7 @@ bool JavaFXOutput::doTreeRecursive(SPDocument *doc, SPObject *obj)
         }
     else
         {
-        id = obj->id;
+            id = obj->getId();
         }
     if (SP_IS_ITEM(obj))
         {
@@ -773,7 +774,7 @@ bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj)
      * Check the type of node and process
      */
     String id;
-    if (!obj->id)
+    if (!obj->getId())
         {
         char buf[16];
         sprintf(buf, "id%d", idindex++);
@@ -781,7 +782,7 @@ bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj)
         }
     else
         {
-        id = obj->id;
+            id = obj->getId();
         }
 
     if (SP_IS_ITEM(obj)) {
@@ -791,7 +792,8 @@ bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj)
             SPShape *shape = SP_SHAPE(item);
             SPCurve *curve = shape->curve;
             if (!curve->is_empty()) {
-                out("               %s(),\n", id.c_str());
+                String jfxid = sanatize(id);
+                out("               %s(),\n", jfxid.c_str());
             }
         }
     }
@@ -992,4 +994,4 @@ JavaFXOutput::init()
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :