July 8th, 2007 @ 22:50

We are now reaching the half of this Summer of Code, and it is about time to review what has been done so far.

What’s ready?

  • A fragment program editor for the GNOME desktop, gShaderEdit, using Python, PyGTK, Glade, PyOpenGL and wrapping the OpenGL ARB_fragment_program stuff with Python’s ctypes. It also somehow supports ARB_vextex_program, but I still haven’t found a good test vertex program *cough*. It works pretty well except on my laptop (powered by an Intel 900GMA graphic chip) where the preview area is all black while Compiz is running (but it is fine under Metacity & al)
  • A generic fragment program parser for Compiz, enabling plugin developers to load fragment programs from files into the Compiz Fragment Interface. Using it is just as easy as copying parser.c and parser.h to the target plugin source directory, including parser.h and using buildFragmentProgram (build a fragment from a string) or loadFragmentProgram (load a fragment from a file) function (given that you are using the great Universal Makefile from Dennis “onestone”).
  • A colorfilter plugin for Compiz, which can load a list of filters and apply them cumulatively to either the window or the whole screen (well, not the screen, but every window on the screen, so that when the screen is filtered, specific windows can still be unfiltered). A neat key binding (Super+S by default) can be triggered to “switch” filters : the user can view the effect of each filter of the list one by one, and then comes back to the default “cumulative” mode where each filter is applied one by one. Window decorations can also be filtered (but it’s not the default, since some filters may not support alpha correctly, or since it could be disturbing for the user whose favorite borders would have been changed into an ugly colored thing).
  • The GUI of a Filters Manager software, which enables users to select filters and create their filters list. A preview of the “active” (widget-wise) filter and of the effect of the current list of filters is also displayed. This application also enables users to create his own color filters : the user just has to select a source hue and a replacement hue on two visual colored rings, inputs a name in a text box and hit the “Save” button. Isn’t that damn easy? A third tab (the application is ordered in three tabs, the filters one, the generator one and this last one) enables the user to configure the plugin settings and bindings directly. The first code release should occur within a few days.

What’s next?

  • A functional Filters Manager
  • Corrective filters for most well-known impairments, or more generic filters to improve overall accessibility for low visionned users
  • Testing filters that reproduce the effect of most well-known impairments, and enable software/websites designers to choose colors smartly

What might be next?

  • Working gShaderEdit preview while Compiz is running on Intel chips
  • Likewise, working Filters Manager preview while Compiz is running on Intel chips

Filters Manager progress

  • GUI – done
  • Filters management – done
  • Filters preview – todo
  • Filter generation – todo
  • Settings and bindings edition – done

Screenshots

gShaderEdit
gShaderEdit Preview (Normal)gShaderEdit Preview (Applied)

Compiz Color filter plugin

  • Negative filter :
    Filters demo - negative
  • Negative Green filter :
    Filters demo - negative green
  • Contrast filter :
    Filters demo - contrast
  • Contrast + Negative filters :
    Filters demo - contrast + negative
  • Contrast + Negative + Negative green filters :
    Filters demo - cumulative

Filters Manager

  • Filters Management page :
    Filter Manager - Filters Management page
  • Filter Generator page :
    Filter Manager - Filter Generator page
  • Settings page :
    Filter Manager - Settings page

Testing

Fetching and trying gShaderEdit is pretty easy :
$ git clone git://anongit.opencompositing.org/users/guillaume/soc/gshaderedit
$ cd gshaderedit
$ python gshaderedit.py

Fetching and trying the colorfilter plugin isn’t much more difficult :
$ git clone git://anongit.opencompositing.org/users/guillaume/soc/colorfilter
$ cd colorfilter
$ make
$ make install

Then, just fire ccsm (your favorite settings manager), enable the Color filter plugin in the Accessibility group. Move to the plugin options and add a few filters to the Filters list option ; three are provided alongside the plugin : negative, negative-green and contrast, located in the filters/ directory of the colorfilter repo.
Once this is done, just ensure Compiz is running (*cough*) and hit Super + F to filter the currently focused window or Super + D to filter the whole screen. Super +S will let you switch filters one by one (and then come back to the Cumulative Filters mode). (Super key is the so-called Windows key, you know, this key which label often pictures the logo of a little-known Operating Software)

If you want to read the source online or check changelogs, just use gitweb :

Side work and notes

I have also written some patches to libcompizconfig and compizconfig-bindings so that it is now possible to load just one or a few plugins – well, it will, since the patches are currently waiting for review – and thus reduce startup time of applications who just need to act with the settings of a few plugins, such as my Filters Manager or a plugin reloading tool. I also fixed a few bugs in compizconfig gconf backend.

Furthermore I have also written (yeah, again) a simple Hue Picker using PyGTK and PyCairo as a gtk Widget for the Filters Manager. Simple, but pretty.
Hue Picker Preview

I have also given a special attention to code comments, each function in the fragment program parser and in the colorfilter plugin is nicely documented, explaining what it does and how it does it. I hope Kristian (a co-Summer Coder and Compiz Fusion developer) will be happy when reviewing my code if he finds some time to do so. I have to say that the awful lack of documentation of Compiz internals (specifically the Fragment Interface in this case) wouldn’t have made me change my mind about the usefulness of comments.

Credits

Huge thanks to Patrick Niklaus and Andrew Wedderburn for the beautiful colorfilter icon!
Colorfilter plugin icon
(and its mini 16×16 version : Colorfilter plugin icon (16×16), both are licensed under GPLv2)
And thanks to Patrick for the “contrast” filter :)