[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: backend listeners (was: Requesting an Octave mentor)
From: |
Ben Abbott |
Subject: |
Re: backend listeners (was: Requesting an Octave mentor) |
Date: |
Fri, 14 Aug 2009 19:43:42 -0400 |
On Aug 14, 2009, at 11:11 AM, Jordi Gutiérrez Hermos wrote:
Hopefully Ben and Robert above can help me get started.
- Jordi G. H.
Ok, this will be a bit of a core-dump, but ...
Although I thought it belonged at a lower level, last year, I worked
on an m-file implementation of graphics property listeners. My thought
was that it could be used it as a template in a latter attempt to
implement the functionality in c++.
As my c++ skills are limited to those of a unconvincing mimic, I'm
grateful to you and/or anyone who wants to take this on.
I'm going to trust my memory, which isn't very reliable ... in any
event, here goes.
The listeners I was referring to react to changes in some property and
modify the value of one or more other properties, which generally will
trigger another listener ... and down the rabbit hole we go ;-)
If we ignore changes to the units of the property values, the
listeners which would be most beneficial to the backends (imo) are ...
text.{fontsize, fontname, string, horizontalalignment,
verticalalignment} -> text.{extent}
text.{extent, position} -> axes.{tightinset}
axes.{tightinset, activepositionproperty, position, outerposition} ->
axes.{position, outerposition}
figure.papersize -> figure.papertype
figure.papertype -> figure.papersize
(this list totally ignores 3D effects)
However, I think listeners reacting to changes in units are more
important. Implementing these listeners doesn't require extensive
knowledge to get started, but you'll learn a lot that will be needed
to implement the listeners above.
Listeners reacting the changes in units are ...
text.units -> text.{position, extent}
text.fontunits -> text.fontsize
axes.units -> axes.{position, outerposition, tightinset}
figure.units -> figure.position
figure.paperunits -> figure.{paperposition, papersize}
root.units -> figure.screensize
A single routine can (should?) handles all conversions. The units to
be supported are {inches, centimeters, points, pixels, characters,
normalized, data}. For "characters" the conversion is 5.6x11.2 points/
character.
To relate pixels to physical units, such as points, inches,
centimeters, & characters, the root property screenpixelsperinch may
be used. Note that a change to "screenpixelsperinch" results in a
massive domino effect.
Returning to where I began, the m-files I wrote are attached. I've
included tests which passed, and although they did in January '09,
they are not presently passing. As time permits (and if it would
help), I can try to debug them.
For details on specific properties, please ask. You can also get quite
a bit info by googling "matlab <property-name>".
Ben
update_property.m
Description: Binary data
set_listeners.m
Description: Binary data