Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Vector Graphics
Started by kilopop Oct 11 2013 06:24 PM

54 replies to this topic
[TOPIC CONTROLS]
Page 3 of 3 1 2 3
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#51

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

This is a very interesting topic. However even though JSON can be used to export this kind of data, it's not specifically designed for vector graphics, and it feels unnecessary to re-invent the wheel when we have SVG. I understand that JSON was a great "proof-of-concept" stepping stone, but I think the way forward would be to somehow build a SVG parser for Corona.

 

I'm planning to look at this myself. I found the SVG specs here for anyone interested.

http://www.w3.org/TR/SVG/

 

The problem is: Why is there always so much fun stuff to look into, and so little time to do it?  ;)



[TOPIC: post.html]
#52

jeff15

[GLOBAL: userInfoPane.html]
jeff15
  • Contributor

  • 106 posts
  • Corona SDK

@rakoonic, you've done an amazing job in getting this started in a very short amount of time! Much appreciated!

 

@ingemar: It does seem that taking advantage of the svg format would make sense, especially when you get the benefits of gradients, named layers, etc. Here's a small sample from Illustrator that has just two simple shapes, one with a gradient. Each is on a separately named layer ("test1" and "test2":

 

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="792px"
     height="612px" viewBox="0 0 792 612" enable-background="new 0 0 792 612" xml:space="preserve">
<g id="test1">
    <polygon fill="#ED1C24" stroke="#000000" stroke-miterlimit="10" points="220.006,148.871 295.466,148.871 306.509,208.994 
        229.822,229.239 216.938,173.411     "/>
</g>
<g id="test2">
    <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="261.7236" y1="178.3193" x2="360.4971" y2="178.3193">
        <stop  offset="0" style="stop-color:#FFFFFF"/>
        <stop  offset="1" style="stop-color:#000000"/>
    </linearGradient>
    <polygon fill="url(#SVGID_1_)" stroke="#000000" stroke-miterlimit="10" points="283.81,125.558 261.724,183.84 297.307,235.988 
        360.497,192.43 314.485,120.65     "/>
</g>
</svg>


[TOPIC: post.html]
#53

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

Thanks Jeff.

 

I've got the Adobe CS6 collection and was able to open your SVG in Illustrator. A nice and simple start.

I'm planning on putting aside some time this weekend to see what can be done...



[TOPIC: post.html]
#54

rakoonic2

[GLOBAL: userInfoPane.html]
rakoonic2
  • Contributor

  • 503 posts
  • Corona SDK

I found a lua based importer for XML that reads in the SVG files you guys gave me ok (is called simpleXML).

Together with the specs list Ingemar found, I think that it should be doable. As he points out though, the issue is time, not whether it is possible or not :(



[TOPIC: post.html]
#55

mr.zeke.dean

[GLOBAL: userInfoPane.html]
mr.zeke.dean
  • Observer

  • 5 posts
  • Corona SDK

I am curious, how do I convert a normal SVG file (which is XML) to the JSON formats specifically used in both the 'face.json' and 'iceream.json'? The json I convert it too is totally different. Do I need to use the illustrator tool or is there another way?




[topic_controls]
Page 3 of 3 1 2 3
 
[/topic_controls]