Difference between revisions of "ImprovingPythonEffectsAPI"

From Inkscape Wiki
Jump to navigation Jump to search
Line 5: Line 5:
 
I've dubbed my bag of scripts "PySVaG" because it rhymes with "spice bag" and I like to think of this stuff as "eye spice" (instead of "eye candy").  My motivations in creating scripts to generate SVG was to allow me to plot complex geometrically defined patterns in a precise way.  When I searched over the internet for code that could do this, I didn't find what I needed.  Math plotting libraries like GNUplot were not what I was looking for. I learned about ActionScript for Flash, but I didn't want to get locked into a proprietary standard. I also learned a bit about Javascript and the use of it to modify the DOM in SVG, but I wasn't liking JavaScript for generating SVG.   
 
I've dubbed my bag of scripts "PySVaG" because it rhymes with "spice bag" and I like to think of this stuff as "eye spice" (instead of "eye candy").  My motivations in creating scripts to generate SVG was to allow me to plot complex geometrically defined patterns in a precise way.  When I searched over the internet for code that could do this, I didn't find what I needed.  Math plotting libraries like GNUplot were not what I was looking for. I learned about ActionScript for Flash, but I didn't want to get locked into a proprietary standard. I also learned a bit about Javascript and the use of it to modify the DOM in SVG, but I wasn't liking JavaScript for generating SVG.   
  
I first of all wanted a simpler way of creating elements so I didn't have to write a setAttribute line for every attribute as in JavaScript; instead I wanted to be able to call a construtor in order to add elements (allowing for default values of attributes, style libraries, etc.), using the simplicity and power of Object-Oriented Programming in Python to abstract SVG images in a clearer way.  One of the first things I accomplished was to make the DOM tree easily accessible though the use of Amara.  This made all attributes represented as a dictionary (which I later found out overlaped the work done in the extension tutorial) and the elements of the tree were easily traversed using built-in array index overloading (term ??).   
+
I first of all wanted a simpler way of creating elements so I didn't have to write a setAttribute line for every attribute as in JavaScript; instead I wanted to be able to call a construtor/method in order to add elements (allowing for default values of attributes, style libraries, etc.), using the simplicity and power of Object-Oriented Programming in Python to abstract SVG images in a clearer way.  One of the first things I accomplished was to make the DOM tree easily accessible though the use of Amara.  This made all attributes represented as a dictionary (which I later found out overlaped the work done in the extension tutorial) and the elements of the tree were easily traversed using built-in array index overloading (term ??).   
  
 
Though these scripts can not run in server-side web browsing like JavaScript can, they were not designed to do so; instead they were designed to be a library of functions that generate complex SVG shapes.  Some of these scripts may draw thousands of lines, and so it would be inefficient to generate the image every time it is viewed on a web page.  Instead the script runs once and outputs an .svg file.       
 
Though these scripts can not run in server-side web browsing like JavaScript can, they were not designed to do so; instead they were designed to be a library of functions that generate complex SVG shapes.  Some of these scripts may draw thousands of lines, and so it would be inefficient to generate the image every time it is viewed on a web page.  Instead the script runs once and outputs an .svg file.       
Line 46: Line 46:
 
** generation of phi spiral and phi spiral lattice (think dreamcatcher pattern) *#* (but I can't figure out hot to get my  spiral curves smoother :( )
 
** generation of phi spiral and phi spiral lattice (think dreamcatcher pattern) *#* (but I can't figure out hot to get my  spiral curves smoother :( )
 
** zig zag and loop-de-loop line generation *#*
 
** zig zag and loop-de-loop line generation *#*
 +
 +
I realize that my proposal needs a sample API to really demonstrate my intentions, so I'll be working on assembling this in the lead-up to the application opening.
  
 
I have added some screen shots of the [http://www.flickr.com/photos/wikinator/sets/72057594111379807/  SVG IMAGENERATION] on my new Flickr account.
 
I have added some screen shots of the [http://www.flickr.com/photos/wikinator/sets/72057594111379807/  SVG IMAGENERATION] on my new Flickr account.
 +
 +
==Selling Self==
 +
 +
I believe I'm an excellent candidate for this position because I:
 +
* use Inkscape regularly
 +
* advocate for Free Software (this year I started organizing a Free Culture Group at Carleton University)
 +
* have a bunch of code already written which could be applied to the project
 +
* will pour a lot of my energies into this project during the summer
 +
* will continue to improve Inkscape beyond the term of my work
  
 
==Afterwords==
 
==Afterwords==
 
+
I am not familiar with the development scene at Inkscape, and thus would like to communicate with those who are.  I think it would help me to refine my proposal into something that fits better with the current development of the project.  Because I intent to participate in the development of Inkscape one way or another, I would greatly appreciate your assistance with my proposal.   
Because I have consistently applied myself to developing SVG generation scripts over the last year, I believe that I have a lot to offer to the project.  However, I am not familiar with the development scene at Inkscape, and thus would like to communicate with those who are.  I think it would help me to refine my proposal into something that fits better with the current development of the project.  Because doing Summer of Code with Inkscape would be my absolute dream job (considering that I've been pursuing this stuff as a hobby for a year now), I would greatly appreciate your assistance.   
 
  
 
Thanks,
 
Thanks,
  
[mailto:touchmewithsynchronicpulses@gmail.com Justin Barca]
+
Justin Barca
 +
touchmewithsynchronicpulses)(gmail.com

Revision as of 10:26, 23 April 2006

Introduction

I applied last year for the Summer of Code and was really excited about the prospects of working on Inkscape because it was a program that I had just begun to use regularly. Although at the time I was using it mostly as a viewer, I was quite interested in vector graphics and particularly SVG for the sake of its open standards and ease of manipulation. Last summer I began working on a series of scripts to generate SVG images. During this time I chose to apply for one of Inkscape's suggested projects becasue I figured I would be more likely to get the position this way, but I put little effort into my proposal, doing little more than cutting and pasting the suggestion into my application. I have decided this year that instead of choosing one of the projects that Inkscape suggests, I will create my own proposal related to the work I have been doing with stand-along Python scripts to generate SVG. I will explain what I've done and how I think it can be integrated into the python extensions in Inkscape.

I've dubbed my bag of scripts "PySVaG" because it rhymes with "spice bag" and I like to think of this stuff as "eye spice" (instead of "eye candy"). My motivations in creating scripts to generate SVG was to allow me to plot complex geometrically defined patterns in a precise way. When I searched over the internet for code that could do this, I didn't find what I needed. Math plotting libraries like GNUplot were not what I was looking for. I learned about ActionScript for Flash, but I didn't want to get locked into a proprietary standard. I also learned a bit about Javascript and the use of it to modify the DOM in SVG, but I wasn't liking JavaScript for generating SVG.

I first of all wanted a simpler way of creating elements so I didn't have to write a setAttribute line for every attribute as in JavaScript; instead I wanted to be able to call a construtor/method in order to add elements (allowing for default values of attributes, style libraries, etc.), using the simplicity and power of Object-Oriented Programming in Python to abstract SVG images in a clearer way. One of the first things I accomplished was to make the DOM tree easily accessible though the use of Amara. This made all attributes represented as a dictionary (which I later found out overlaped the work done in the extension tutorial) and the elements of the tree were easily traversed using built-in array index overloading (term ??).

Though these scripts can not run in server-side web browsing like JavaScript can, they were not designed to do so; instead they were designed to be a library of functions that generate complex SVG shapes. Some of these scripts may draw thousands of lines, and so it would be inefficient to generate the image every time it is viewed on a web page. Instead the script runs once and outputs an .svg file.

I looked for a simple 2D geometry library in python but found nothing which suited the task, so I created one for the purpose of representing points as objects that could be manipulated by different algorithms and formulas.

Over the last year my imagination has discovered a richness of geometric/design problems to solve. In my proposal, I have listed a number of features/algorithms that I have already implemented in my stand-alone SVG applications. I have marked these with a "*#*".

Proposal

My goals in working on the python extensions would be to improve the Python plugin API

  • Mathematical libraries for plotting points
  • Cartesian and Polar points with conversion to and from each other. Operations such as addition, subtraction, dot product, scalar multiplication *#*
  • Midpoint of two points *#*
  • Point at a fraction of a distance from point A to point B *#*
  • pointsBetween - given A and B, returns n equidistant points along the line *#*
  • extendBend - given two points A and B, a distance and an angle, returns a point C which results from extending distance out from AB and then bending BC about B by the given angle *#*
  • reflection - given a line AB and point C, returns the reflection of C in AB *#*
  • higher level of abstraction in accessing the document
  • develop a rich set of functions for manipulating paths
    • abstractions for each path command and random access to the list of commands (so you can look backward and see what point the inspected command is starting from) *#*
    • path distance calculation *#*
    • convert a quadradic bezier into a cubic bezier *#* figured out this one purely by experimentation
    • each Command object (i.e. one of class CubicBezierCommand) stores control points and nodes as Point objects *#*
    • return an array of references to all Points in the path (which could then be operated on by some function or other operation) *#*
    • create a closed symetrical path out of an open path that is one side of the shape by appending it's mirror (along the start-end line) to itself
    • develop new ways of constructing and representing bezier curves relative to their start and end points i.e. where the control points are represented as a vector relative to the base line of the curve *#*
    • functions to return points a certain distance along a path, or a certain percentage of the distance of the path
    • functions to do complex path slicing/merging where the number of commands is increasing or decreasing
    • obtain a point a certain distance along a path
    • complex path intersections
  • add a number of "autoShapes" extensions that would generate different shapes given particular parameters from a GUI
    • circle unit subdivision algorithm *#*
    • Cartesian and Poler graph with unit subdivision
    • Ruler dashes with unit subdivision
    • "star polygon" creation along with creation of a dictionary of all "proper" poygon stars (see this page on [ http://mathworld.wolfram.com/StarPolygon.html Stars Polygons ] ) *#*
    • hexagon grid *#*
    • flower-like radial shapes *#* some, but there's many possibilities
    • series of circles forming a Cartoid *#*
    • generation of phi spiral and phi spiral lattice (think dreamcatcher pattern) *#* (but I can't figure out hot to get my spiral curves smoother :( )
    • zig zag and loop-de-loop line generation *#*

I realize that my proposal needs a sample API to really demonstrate my intentions, so I'll be working on assembling this in the lead-up to the application opening.

I have added some screen shots of the SVG IMAGENERATION on my new Flickr account.

Selling Self

I believe I'm an excellent candidate for this position because I:

  • use Inkscape regularly
  • advocate for Free Software (this year I started organizing a Free Culture Group at Carleton University)
  • have a bunch of code already written which could be applied to the project
  • will pour a lot of my energies into this project during the summer
  • will continue to improve Inkscape beyond the term of my work

Afterwords

I am not familiar with the development scene at Inkscape, and thus would like to communicate with those who are. I think it would help me to refine my proposal into something that fits better with the current development of the project. Because I intent to participate in the development of Inkscape one way or another, I would greatly appreciate your assistance with my proposal.

Thanks,

Justin Barca touchmewithsynchronicpulses)(gmail.com