[Drawkit] SVG / other file format support
Brad Larson
larson at sonoplot.com
Mon May 12 11:21:21 PDT 2008
After a significant delay, I'm starting to work on porting our drawing
software across to DrawKit. One thing that we will need is native
load/save support for our custom XML file format, and we're looking at
moving to SVG. I am willing to add this functionality to DrawKit, but
I noticed that you have SVG import and export on the roadmap and I
thought I'd get your thoughts first before I started.
How, architecturally, would you like this to be added? Personally, I
would like to see SVG as a native file format for DrawKit, rather than
something you have to do a File | Import and Export for. It is a
highly extensible standard that a lot of people are getting behind
(including Apple with WebKit). Inkscape uses SVG as its native file
format and it seems to keep up well with all of its capabilities. If
you'd prefer to have different file formats be handled via import and
export instead of the standard load / save functions, I could do that,
too.
Right now, all loading from disk is handled with a simple unarchiver
in DKDrawing's drawingWithData: method that takes only an NSData
object. If you were able to pass in the filename or extension, you
might be able to have different parsers for different file extensions
(svg, svgz, dxf, ai, etc.) within this method. The same could be done
in reverse for the writeToFile:atomically: method. This would make
it possible to do different file formats during the load / save
operation. If so, would you want separate helper classes for each
different file type, load / save methods under DKDrawing, or DKDrawing
categories for each file type?
I figure saving would be accomplished by iterating through the
internal store of objects and calling an svgRepresentation method, or
something corresponding to the file format, on them. This might be
where separate categories for the file formats would be useful, so
that the drawing objects could each have their own input / output
methods.
I wanted to check first so that anything I did would not conflict with
anything you had in mind or had already started.
______________________
Brad Larson
SonoPlot, Inc.
3030 Laura Lane, Suite 120
Middleton, WI 53562
More information about the Drawkit
mailing list