Added the new classes to work with, that also have the method stubs inside.

This commit is contained in:
Jt Whissel 2012-09-13 20:45:27 -04:00
parent 7247c1a5a2
commit 1ccd5199b5
3 changed files with 148 additions and 0 deletions

View file

@ -93,6 +93,9 @@ var paper = new function() {
/*#*/ include('text/TextItem.js');
/*#*/ include('text/PointText.js');
/*#*/ include('svg/ExportSVG.js');
/*#*/ include('svg/ImportSVG.js');
/*#*/ include('style/Style.js');
/*#*/ include('style/PathStyle.js');
/*#*/ include('style/ParagraphStyle.js');

90
src/svg/ExportSVG.js Normal file
View file

@ -0,0 +1,90 @@
/**
* Exports items, layers or whole projects as a svg
* Stetson Alpha - Paper.js
*
* var NS="http://www.w3.org/2000/svg";
* var svg=document.createElementNS(NS,"svg");
*/
var ExportSVG = function()
{
var svgObj = null; // xml dom object (svg typed)
//initialize the svgObj and what ever else.
function initialize()
{
};
/**
*
* Takes the whole project and parses
* all the layers to be put into svg groups and
* groups into svg groups making all the projects
* items into one svg.
*
* takes in a Paper.js Project
* returns svg object (xml dom)
*/
this.exportProject = function(project)
{
return svgObj;
};
/**
*
* Takes the layer and then parses all groups
* and items into one svg
*
* takes in a Paper.js Layer
* returns svg object (xml dom)
*/
this.exportLayer = function(layer)
{
return svgObj;
};
/**
*
* Takes the group and puts it's items
* in a svg file.
*
* takes in a Paper.js Group
* returns svg object (xml dom)
*/
this.exportGroup = function(group)
{
return svgObj;
};
/**
*
* Takes the item and puts it in
* a svg file.
*
* takes in a Paper.js Item
* returns svg object (xml dom)
*/
this.exportItem = function(item)
{
return svgObj;
};
/**
*
* Takes the path and puts it in
* a svg file.
*
* takes in a Paper.js Path
* returns svg object (xml dom)
*/
this.exportPath = function(path)
{
return svgObj;
};
initialize(); // calls the init function after class is loaded
};

55
src/svg/ImportSVG.js Normal file
View file

@ -0,0 +1,55 @@
/**
* Imports svg into items with groups
* Stetson Alpha - Paper.js
*
*/
var ImportSVG = function()
{
//initialize
function initialize()
{
};
/**
*
* Takes the svg dom obj and parses the data
* to create a layer with groups (if needed) with
* items inside. Should support nested groups.
*
* takes in a svg object (xml dom)
* returns Paper.js Layer
*/
this.importSVG = function(svg)
{
return layer;
};
/**
* Creates a Paper.js Group by parsing
* a specific svg g node
*
* takes in a svg object (xml dom)
* returns Paper.js Group
*/
function importGroup(svg)
{
return group;
};
/**
* Creates a Paper.js Path by parsing
* a specific svg node (rect, path, circle, polygon, etc)
* and creating the right path object based on the svg type.
*
* takes in a svg object (xml dom)
* returns Paper.js Group
*/
function importPath(svg)
{
return path;
};
initialize(); // calls the init function after class is loaded
};