summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 16793cf)
raw | patch | inline | side by side (parent: 16793cf)
author | ishmal <ishmal@users.sourceforge.net> | |
Fri, 1 Aug 2008 21:14:15 +0000 (21:14 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Fri, 1 Aug 2008 21:14:15 +0000 (21:14 +0000) |
src/extension/internal/javafx-out.cpp | patch | blob | history | |
src/extension/internal/pov-out.cpp | patch | blob | history |
index 6e7b21b86c1020b85dd820059a157e4407238dd3..c013987612242a91a9b23e453ddc86a3e5800c21 100644 (file)
*/\r
bool JavaFXOutput::doTail(const String &name)\r
{\r
+ int border = 25.0;\r
out(" ] // content\n");\r
+ out(" transform: [ translate(%s, %s), ]\n",\r
+ dstr((-minx) + border).c_str(), dstr((-miny) + border).c_str());\r
out(" }; // Group\n");\r
out("// end function %s.composeNode()\n", name.c_str());\r
out("\n\n\n\n");\r
out("Frame {\n");\r
out(" title: \"Test\"\n");\r
- out(" width: 500\n");\r
- out(" height: 500\n");\r
+ out(" width: %s\n", dstr(maxx-minx + border * 2.0).c_str());\r
+ out(" height: %s\n", dstr(maxy-miny + border * 2.0).c_str());\r
out(" onClose: function()\n");\r
out(" {\n");\r
out(" return System.exit( 0 );\n");\r
out(" }\n");\r
out(" visible: true\n");\r
out(" content: Canvas {\n");\r
- out(" content: tux{}\n");\r
+ out(" content: %s{}\n", name.c_str());\r
out(" }\n");\r
out("}\n");\r
out("/*###################################################################\n");\r
using Geom::X;\r
using Geom::Y;\r
\r
- Geom::Matrix tf = sp_item_i2d_affine(item);\r
-\r
//### Get the Shape\r
if (!SP_IS_SHAPE(item))//Bulia's suggestion. Allow all shapes\r
return true;\r
* Stroke\r
*/\r
/**\r
- * TODO: stroke code here\r
+ *NOTE: Things in style we can use:\r
+ * SPIPaint stroke;\r
+ * SPILength stroke_width;\r
+ * SPIEnum stroke_linecap;\r
+ * SPIEnum stroke_linejoin;\r
+ * SPIFloat stroke_miterlimit;\r
+ * NRVpathDash stroke_dash;\r
+ * unsigned stroke_dasharray_set : 1;\r
+ * unsigned stroke_dasharray_inherit : 1;\r
+ * unsigned stroke_dashoffset_set : 1;\r
+ * SPIScale24 stroke_opacity;\r
*/\r
+ if (style->stroke_opacity.value > 0)\r
+ {\r
+ gint alpha = 0xffffffff;\r
+ guint32 rgba = style->stroke.value.color.toRGBA32(alpha);\r
+ unsigned int r = SP_RGBA32_R_U(rgba);\r
+ unsigned int g = SP_RGBA32_G_U(rgba);\r
+ unsigned int b = SP_RGBA32_B_U(rgba);\r
+ unsigned int a = SP_RGBA32_A_U(rgba);\r
+ out(" stroke: rgba(0x%02x, 0x%02x, 0x%02x, 0x%02x)\n",\r
+ r, g, b, a);\r
+ double strokewidth = style->stroke_width.value;\r
+ out(" strokeWidth: %s\n", dstr(strokewidth).c_str());\r
+ }\r
}\r
\r
\r
// convert the path to only lineto's and cubic curveto's:\r
+ Geom::Scale yflip(1.0, -1.0);\r
+ Geom::Matrix tf = sp_item_i2d_affine(item) * yflip;\r
Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf );\r
\r
//Count the NR_CURVETOs/LINETOs (including closing line segment)\r
\r
nrSegments += segmentCount;\r
\r
+ Geom::Rect cminmax( pathv.front().initialPoint(), pathv.front().initialPoint() ); \r
+\r
/**\r
* For all Subpaths in the <path>\r
*/ \r
for (Geom::PathVector::const_iterator pit = pathv.begin(); pit != pathv.end(); ++pit)\r
{\r
- Geom::Point p = pit->front().initialPoint() * tf;\r
+ Geom::Point p = pit->front().initialPoint();\r
+ cminmax.expandTo(p);\r
out(" MoveTo {\n");\r
out(" x: %s\n", dstr(p[X]).c_str());\r
out(" y: %s\n", dstr(p[Y]).c_str());\r
dynamic_cast<Geom::HLineSegment const *>(&*cit) ||\r
dynamic_cast<Geom::VLineSegment const *>(&*cit) )\r
{\r
- Geom::Point p = cit->initialPoint() * tf;\r
+ Geom::Point p = cit->finalPoint();\r
out(" LineTo {\n");\r
out(" x: %s\n", dstr(p[X]).c_str());\r
out(" y: %s\n", dstr(p[Y]).c_str());\r
else if(Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const*>(&*cit))\r
{\r
std::vector<Geom::Point> points = cubic->points();\r
- Geom::Point p0 = points[1] * tf;\r
- Geom::Point p1 = points[2] * tf;\r
- Geom::Point p2 = points[3] * tf;\r
+ Geom::Point p1 = points[1];\r
+ Geom::Point p2 = points[2];\r
+ Geom::Point p3 = points[3];\r
out(" CurveTo {\n");\r
- out(" x1: %s\n", dstr(p0[X]).c_str());\r
- out(" y1: %s\n", dstr(p0[Y]).c_str());\r
- out(" x2: %s\n", dstr(p1[X]).c_str());\r
- out(" y2: %s\n", dstr(p1[Y]).c_str());\r
- out(" x3: %s\n", dstr(p2[X]).c_str());\r
- out(" y3: %s\n", dstr(p2[Y]).c_str());\r
+ out(" x1: %s\n", dstr(p1[X]).c_str());\r
+ out(" y1: %s\n", dstr(p1[Y]).c_str());\r
+ out(" x2: %s\n", dstr(p2[X]).c_str());\r
+ out(" y2: %s\n", dstr(p2[Y]).c_str());\r
+ out(" x3: %s\n", dstr(p3[X]).c_str());\r
+ out(" y3: %s\n", dstr(p3[Y]).c_str());\r
out(" absolute: true\n");\r
out(" },\n");\r
nrNodes++;\r
g_error ("logical error, because pathv_to_linear_and_cubic_beziers was used");\r
}\r
segmentNr++;\r
+ cminmax.expandTo(cit->finalPoint());\r
}\r
if (pit->closed())\r
{\r
out(" ### end path %s\n", id.c_str());\r
out(" ###################################################*/\n\n\n\n");\r
\r
+ double cminx = cminmax.min()[X];\r
+ double cmaxx = cminmax.max()[X];\r
+ double cminy = cminmax.min()[Y];\r
+ double cmaxy = cminmax.max()[Y];\r
+\r
+ if (cminx < minx)\r
+ minx = cminx;\r
+ if (cmaxx > maxx)\r
+ maxx = cmaxx;\r
+ if (cminy < miny)\r
+ miny = cminy;\r
+ if (cmaxy > maxy)\r
+ maxy = cmaxy;\r
+\r
return true;\r
}\r
\r
index a46b55d42705cf1de20d9e800596bf80037bf6fd..bb12e0564cb6641ad21506cc0a2bec60181185d2 100644 (file)
using Geom::X;
using Geom::Y;
- Geom::Matrix tf = sp_item_i2d_affine(item);
-
//### Get the Shape
if (!SP_IS_SHAPE(item))//Bulia's suggestion. Allow all shapes
return true;
povShapes.push_back(shapeInfo); //passed all tests. save the info
// convert the path to only lineto's and cubic curveto's:
+ Geom::Matrix tf = sp_item_i2d_affine(item);
Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf );
//Count the NR_CURVETOs/LINETOs (including closing line segment)