Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Chandhu

macrumors newbie
Original poster
Feb 26, 2008
4
0
Hi,

I am very new to Mac and Cocoa. I want to draw and import SVG objects in my Cocoa (using Objective C) windows application. Can anyone help me how to do this ? (I am using XCode 2.5 in my Tiger and XCode 3 in Leopard. I want to draw and import SVG objects in a Canvas using Objective C). How this is possible ???? Please help me...

Thanks in advance........
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Cocoa has no built in support for SVG so you are going to have to do quite a lot of work to make this happen. The way I see it you have two options:

1) Use WebKit to render the SVG an use JavaScript/DOM to manipulate the SVG within the document

2) Use libsvg to render the svg
 

Chandhu

macrumors newbie
Original poster
Feb 26, 2008
4
0
How to use librsvg in Cocoa Application

HI,

Thanks for the reply.
How can i use librsvg in my Cocoa Application ????
Since i am very new to Cocoa, could you please help me with a detailed solution for this? I need to draw the SVG objects in the existing canvas (NSView) in my Cocoa windows application using Objective C ????

Thanks in advance.....:)
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
How can i use librsvg in my Cocoa Application ????
Since i am very new to Cocoa, could you please help me with a detailed solution for this?

Basically this is not a beginners topic or even close, so the answer is no, I'm not going to write your code for you. I suggest you start doing a lot of research into into using standard Unix libraries in Cocoa as well as spending a lot of time reading the libsvg documentation: you will have to do work to get the output of this to render into an NSView: it's not like it's going to provide an NSImage.

If I were you I'd be using WebKit...
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
You can embed a webview into an NSView. Theres a bunch of sample code if you installed the Xcode tools at: /Developer/Examples/WebKit

You can link a webview to your Cocoa app using JavaScript very easily to provide command/control of the SVG in the webkit view as well.

I'd also recommend WebKit since it is already built out, already has high performance and support for manipulating SVG.

Don't think of WebKit as a web browser aka Safari. WebKit is the rendering and network engine that Safari is built on top of.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.