Glimmer: Python extension for Mediascript

From CSWiki

Jump to: navigation, search

Contents

Pick a Pythonesque representation for colors

  • You could use integers, like we do in MediaScheme
  • You could use objects, like they may do in PyGimp
  • You could use something else

Figure out a nice way to translate colors between GIMP and Python

  • Jordan knows a bit about GIMP color representations
  • libs/mediascript/mesc-rgb.c presents our simple RGB representation
  • gimp_rgb_to_rgb in libs/mpltg/mpltg.c provides an example
    • why is there a python representation for a RGB color too? (/Glimmer/DrFu/share/mediascript/python/mgimp.py)
    • This stuff was written by Sam recently and it seems that it does a lot of the implementation

Get some simple GIMP callbacks working

By callbacks, I mean procedures that you call in Python that affect the GIMP.

Some suggestions

  • image_set_pixel(image,x,y,color)
  • image_get_pixel(image,x,y)
  • context_get_fgcolor()

Write the generic "call PDB procedure" function

  • Start with a simple procedure that, given the name of a PDB procedure, extracts and prints out information about the procedure
  • Write a procedure that, given a PDB type and C value, returns the corresponding Python value (corresponding to pdb_to_scheme_val in mpltg.c)
    • You may want to start with only one or two types of values, such as integers or colors
  • Write a procedure that, given a PDB type and Python value, returns the corresponding C/GIMP value (corresponding to scheme_to_pdb_val in mpltg.c)
    • Again, you may want to start with only one or two types of values, such as integers or colors
  • See how PyGimp does PDB calls
  • See how MediaScript does PDB calls (mpltg_cfun_gimp_pdb_call in mpltg.c)
  • Write something similar for your Python

Write code that registers each PDB procedure as a call to your generic "call PDB procedure" function

  • PyGimp and MediaScript should present appropriate examples

Work on equivalents to some of the MediaScheme-specific higher order procedures

  • image_compute is a nice one to start with
  • image_transform is another nice one

User Interface Stuff

I expect these kinds of things will go better with me here, but you may want to explore any or all of these if you get fed up with the other stuff.

  • Color coding of output/error/results
  • Click on an error and go to the appropriate place in the definitions pane
  • Automatic indenting in definitions pane
  • Syntax highlighting
Personal tools