Monday, February 28, 2011

wumpus-drawing

Copperbox revision 2172.

Updated Wumpus-Drawing to work with the unit changes in Wumpus-Core and Basic. Many functions needed their class constraint extending with a PtSize constraint.

Sunday, February 27, 2011

wumpus-basic

Copperbox revision 2171.

Updates to work with the PrimPath changes to Wumpus-Core. It looks like the unit scaling problem reported in the last message has gone due to those changes.

wumpus-core

Copperbox revision 2170.

I've changed the internal representation of primitive Paths so they store transformation information in a CTM like Text and Ellipse.

Work on unit changing has uncovered a very strange translation bug that I haven't been able to get to the bottom of - Paths are being displaced by far more than the unit change, Text and Ellipses are okay. As I can't work out out what's going on, the best thing to do is to unify the representation of primitives, hoping that either the bug will disappear as a consequence, or it becomes easier to identify.

Saturday, February 26, 2011

wumpus-rhythm

Copperbox revision 2169.

I've re-worked the graphic primitives to use measurements (parameters) in AfmUnits directly rather than scale them (which makes everything monadic). Scaling should be achievable with the new unit conversion support in Wumpus-Basic.

Friday, February 25, 2011

wumpus-basic

Copperbox revision 2168.

I've added support to convert the units for various drawing objects Image, PosImage, TraceDrawing etc.

The code is unfortunately more contrived than I had expected. Changing units in Wumpus-Core is just a functorial traversal, but this isn't the case in Wumpus-Basic. Also in Wumpus-Basic, the many of the objects are type synonyms with kind (* -> * -> *) so there is no opportunity to encapsulate conversion in a type class. Instead I've had to code the type specific cases with unique functions that look the same if you squint.

Wumpus-Rhythm has a compelling use for unit conversion, so it will be a test-case to gauge whether the new code is satisfactory if not pretty.

Wednesday, February 23, 2011

wumpus-core

Copperbox revision 2061.

Minor tweaks to the Affine Trans classes. I actually spent the day trying to change them wholesale to remove the DUnit "hack", however I couldn't come up with a formulation as Functors that worked well for Wumpus-Basic.

wumpus

Copperbox revision 2166.

I've updated Wumpus-Basic and Wumpus-Drawing to work with the latest PtSize and units changes to Wumpus-Core.

Tuesday, February 22, 2011

wumpus-core

Copperbox revision 2165.

I've added the DUnit type relation back to the RotateAbout affine transformation class. It was cumbersome to label points-of-rotation with their types, and having the point-of-rot share the unit as the thing it rotates also seems more intuitive.

zwav

Copperbox revision 2164.

New experiment using buffered output via an IOUArray rather than a ByteString, the stream type is a plain recursive, head-stream stream with no stream fusion.

The speed improvements seem compelling - a simple sine wave interpreted with GHCi takes approx 2-3 seconds to generate a second of output. Compiled with -O2, a 9 second sine wave is generated in a couple of seconds. Output is 44100 Hz, 16 bit, 1 channel WAV file and my processor is a 1.5GHz Pentium. This is certainly good enough for my uses.

Monday, February 21, 2011

wumpus-basic

Copperbox revision 2163.

I've updated Wumpus-Basic to work with the unit changes to Wumpus-Core.

Sunday, February 20, 2011

wumpus-core

Copperbox revision 2162.

I've updated the demos to work with the unit changes. The change to the RotateAbout class adds a type annotation burden to the call site for the rotateAbout function. This is not very convenient, so I may change this class back to its old definition.

wumpus-core

Copperbox revision 2161.

I've changed the Affine Trans classes to no longer use the DUnit type constraint. At the moment I'm not sure if this is good or bad - its good to fix the CTM so scalings are by a fixed scaling factor represented as Doubles. This is the correct thing to do, the previous formation where the scaling factor was the same unit as the coordinates was wrong for other units than PS points. However as units now seem to be playing less part in the types I'm concerned that Wumpus-Basic might have difficult enforcing units. The current version of the Affine Trans classes might not be the last one...

wumpus-core

Copperbox revision 2160.

I've specialized the AffineTrafo data type to unit Double. Changing the affine transformation classes is till outstnading - this is a more pervasive change.

wumpus-core

Copperbox revision 2159.

I've specialized the PrimCTM data type to Double rather than it being parametric on unit. All the transformation objects (PrimCTM, the AffineTrafo instructions for Picture, the Matrix3'3 CTM and the Affine classes) should actually be specialized to Double for the scaling factor rather than take the unit size of a Picture. This is flaw with Wumpus that I've only just spotted as I'm only now adding proper support for alternative units; with only one real unit (Double - PostScript point) it didn't crop up as an issue.

wumpus-core

Copperbox revision 2158.

I've changed the internals of the PostScript and SVG rendering so that Picture is always rendered with unit as Double. To get a Picture Double from a polymorphic Picture u there is an explicit unit changing step.

Saturday, February 19, 2011

wumpus-core

Copperbox revision 2157.

I've renamed the module Core.PtSize to Core.Units and added the Centimeter and Pica types from Wumpus-Basic.

Sorting out the SVG unit problem is going to be a fair amount of work. The problem is that matrices transmitted to the generated code are scaled according to the unit in use, but this turns the identity matrix for Pica (scaling by 12) from [1,0,0,0,0,1] to [12,0,0,0,0,12]. This scales everything in SVG (or PostScript if I'd been using more extensive examples) but as coordinates are already transformed from Picas into PostScript points in the output, they don't want another scaling.

I think I'll have to fix the unit type of the CTM to be Matrix3'3 Double rather than be parametric on unit like Point, Vector, Path and the other "drawable" graphic types. As this is a big change I've added the Pica and Centimeter units from Wumpus-Basic so I can more readily test it.

wumpus

Copperbox revision 2156.

Updates to Wumpus-Basic to work with the unit changes in Wumpus-Core and minor updates to Wumpus-Core. The SVG bug that suggested Wumpus-Core's unit handling was inadequate is still present unfortunately...

wumpus-core

Copperbox revision 2155.

I've rationalized the unit types and type classes in Wumpus-Core to improve the support for alternative units e.g. centimeter or pica. Wumpus-Core had a couple of problems with alternative units that the old way wasn't picking up and lead to scaling errors in the PostScript and SVG. The new classes and types should make such errors easier to pick up, though I've to test it with Wumpus-Basic and Wumpus-Drawing before I'll know if it is working properly.

Friday, February 18, 2011

wumpus-rhythm

Copperbox revision 2154.

I've picked up work on Wumpus-Rhythm again. A lot of code is due to change as I'm going to drop support for MIDI output, at the moment this code is likely broken. This will mean I don't need the "tagless" definitions which add quite a bit of complexity. The actual graphic code is being re-worked too, as Wumpus-Basic and Wumpus-Drawing are now a bit more sophisticated.

Thursday, February 17, 2011

wumpus-drawing

Copperbox revision 2153.

I've added a single character PosImage type in the new module PosChar. Drawing single characters with either RotText or DotText has too much overhead to think about, and I'm picking up work again on Wumpus-Rhythm which needs single chars for note heads.

wumpus-drawing

Copperbox revision 2152.

Grid drawing is now working again.

wumpus-drawing

Copperbox revision 2151.

I've simplified RotText somewhat. As the implementation is of multi-line text is a bit simpler there is less need for a special single line version, so I've removed it.

Also I've updated the demos - the FontPic demo won't compile as it needs chainStepsV to work differently. This suggests I haven't got the new chains quite right.

wumpus-drawing

Copperbox revision 2150.

I've changed DocText and RotText to work with the new implementation of Chains.

Note, RotText now has some opportunities for simplifying the API. They will be looked at next - because the changes just to get RotText working again were quite involved, I didn't want to tackle too much in this revision.

Wednesday, February 16, 2011

wumpus-drawing

Copperbox revision 2149.

I've re-worked Chains so the types are simpler and they aren't prone to "none productive" chains.None productive chains were chains that didn't generate any points but now Chains have an iterative formulation so they always produce as many points as needed.

Quite a bit of code may be broken, though I have updated Grids - currently they have a problem that the exterior lines can be drawn twice.

Tuesday, February 15, 2011

wumpus

Copperbox revision 2148.

I've updated Wumpus-Block and Wumpus-Tree to work with the changes to Wumpus-Basic. I've also got the ClipPic example in Wumpus-Drawing to work again.

wumpus-drawing

Copperbox revision 2147.

I've updated Wumpus-Drawing to work with the DrawingContext changes to Wumpus-Basic. The ClipPic example is not currently working due to the recent clipping changes in Wumpus-Core.

wumpus-basic

Copperbox revision 2146.

More work improving the DrawingContext modules. I've removed all the mono-space metrics code from QueryDC, any code that needs metrics calculations can use proper font metrics instead.

wumpus-basic

Copperbox revision 2145.

More work improving the DrawingContext code. The UpdateDC module is now more-or-less satisfactory, however the QueryDC module needs significant work. Probably a lot of code should be removed from QueryDC, especially the mono-space metrics code, but I'll have to survey Wumpus-Drawing to see how widely it is used.

Monday, February 14, 2011

wumpus-drawing

Copperbox revision 2144.

I've updated the library code to match the changes to DrawingContext in Wumpus-Basic. The demos still need updating.

wumpus-basic

Copperbox revision 2143.

A substantial round of renaming for the DrawingContext and and its update functions. Some parts (e.g. dash patterns) still need working out, so the naming scheme unfortunately isn't systematic at the moment.

wumpus-core

Copperbox revision 2142.

I've added a clip-path example and updated the Guide and some Haddock documentation.

wumpus-core

Copperbox revision 2141.

I've moved the Clip constructor from the Picture type into the Primitive type. This should make it quite a bit more useful - for instance it should allow Wumpus-Drawing to make fancy background fills for Shapes.

wumpus-core

Copperbox revision 2140.

I've changed the type of the line_width StrokeAttr to be Ptsize (Pt) rather than Double. As the Wumpus-Basic is now more conscious of units it seems fitting to make Wumpus-Core more definitive about the units it uses.

Sunday, February 13, 2011

wumpus

Copperbox revision 2139.

Updates to Wumpus-Block and Wumpus-Tree to work with the latest Basic and Drawing changes.

wumpus-drawing

Copperbox revision 2138.

I've reworked the DocText type so it supports fill combinators. Filling pads the right or left of a combinator with space if its length is shorter than the fill - I've only done right fill so far as it is easier.

Also I've added font size changing although this needs careful use as the line height do not adjust dynamically - Line height is judged by the height of the current font when drawing starts, not on the largest height of all subsequent text.

wumpus-drawing

Copperbox revision 2137.

Initial work on "pretty print" combinators for numbers in DocText. Evenly spaced digits are important for any kind of tabular drawing, though it looks like numbers in the Core 14 fonts are all evenly spaced anyway.

[Wumpus can only handle the Core 14 fonts at the moment and it will be some time before its font loading capabilities are extended].

wumpus-drawing

Copperbox revision 2136.

I've changed RotTextLR to use the new CF3 type - previously it had a floating Radian argument for the inclination.

wumpus-basic

Copperbox revision 2135.

I've added an arity three context function CF3. Also I've made some name changes - chain1 becomes branch1 and sdecorate becomes annotate.

Saturday, February 12, 2011

wumpus

Copperbox revision 2134.

I've updated the demos in Wumpus-Drawing to match the font loader changes in Wumpus-Basic.

wumpus-basic

Copperbox revision 2133.

I've revised the font metrics and font loader modules, improving the naming. Also I've added the font loading error log to the DrawingContext, this should give more flexibility for displaying loading errors.

Friday, February 11, 2011

wumpus-drawing

Copperbox revision 2132.

I've sorted out drawing arrow tips in the correct place for the loop path. Here is the final automata drawing:

wumpus-drawing

Copperbox revision 2131.

I've added Pica and Centimeter unit types. Other unit types been "missing" for a long time, so its time they were added. Unfortunately in practice units will be somewhat limited as a drawing can only have one unit type - it can't draw shapes in centimeters and labels in points.

wumpus-drawing

Copperbox revision 2130.

I've updated the demos to work with the name changes to the Text modules.

wumpus-drawing

Copperbox revision 2129.

I've renamed the Text modules and their respective types - LRText becomes RotTextLR, CatText becomes DotTextLR.

Also I've made a loop path for automata diagrams. Currently it doesn't work with arrowheads as it has special behaviour for its start and end points - it might not really be a "connector" as the drawn positions of the start and end are synthesized from the center and a point on the circle's edge:

Thursday, February 10, 2011

wumpus-drawing

Copperbox revision 2128.

Various minor changes. Re-named the ConnectorPath type to PathCF. Added spacing around LRText - note LRText itself will be renamed soon.

wumpus-drawing

Copperbox revision 2127.

Work on a new scheme for labels avoiding the problematic Label type class. The new scheme seems good for the automata example:


wumpus

Copperbox revision 2126.

I've moved the new "library" functions from the Automata example into the Wumpus-Basic libraries where they best match. I've also added double stroking for shapes - however whilst the implementation is simple it is now very good (it causes problems for anchors) and I will have to re-do it at some point.

Wednesday, February 9, 2011

wumpus-drawing

Copperbox revision 2125.

Work on an automata example.

I'm currently somewhat stuck with the code I started yesterday for labels - my feeling is that only LocImages / LocGraphics will actually be able to use labels so I shouldn't need the Label typeclass. However, I haven't committed to this yet, and I've been working on an automata example that uses new placing idioms based on this afternoon's commit:







automata :: DCtxPicture
automata = drawTracing $ do
    q0     <- starti   $ state
    q1     <- relativei  (above_right q0)      $ state
    q2     <- relativei  (below_right q0)      $ state
    q3     <- relativei  (below_right q1)      $ state

    s0     <- query (left_of q0)
   
    drawcr q0 q1 $ straightconn
    drawcr q1 q3 $ straightconn
    drawcr q0 q2 $ straightconn
    drawcr q2 q3 $ straightconn
    drawc  s0 (west q0) $ straightconn

    return ()

There are no absolute positions in any of the code (note - the names starti etc. will likely change).

wumpus-basic

Copperbox revision 2124.

I've removed the PointSupplyM class and MonUnit type family.

MonUnit was a hack to get around some the problem that Monads have kind (* -> *) so didn't appear to work well with the DUnit fmaily from Wumpus-Core. By using fully saturated type instances for the TraceDrawing monads and changing the definition of the TraceM class I think I've removed the need for MonUnit:

type instance DUnit (TraceDrawing u a)    = u
type instance DUnit (TraceDrawingT u m a) = u

class TraceM (m :: * -> *) where
  trace  :: u ~ DUnit (m ()) => HPrim u -> m ()

I've added scaling factors for a "snapping grid" to the DrawingContext. Grid coordinates can do much of what PointSupplyM was intended to achieve, although the Turtle monad in Wumpus-Drawing will now be broken - and its likely I'll drop Turtle rather than fix it, at least for the time being.

wumpus

Copperbox revision 2123.

I've added new trace drawing functions for Connectors and LocGraphics to Wumpus-Basic. Using them avoids the needing the `at` combinator, so there is an argument that they are clearer - whichever is clearer, it seems good to have choice.

The Petri net example in Wumpus-Drawing has been updated to use them.

Tuesday, February 8, 2011

wumpus-drawing

Copperbox revision 2122.

Work on a Label class so I can decorate objects without having to bind (>>=) to an anchor.

Unfortunately the formulation isn't quite right as I cannot build an isntance for PosImage.

wumpus-basic

Copperbox revision 2121.

I've made text_colour a distinct property in the DrawingContext. As the drawings I'm making are getting complicated, not having text_colour distinct from stroke_colour was adding clutter from additional localize blocks.

wumpus-drawing

Copperbox revision 2120.

I've made a new directory in the modules hierarchy for half-baked modules - Wumpus.Drawing.Extras. The Grids and Turtle modules have been moved into it.

wumpus - new releases

Copperbox revision 2118.

Minor updates to version numbers and cabal files.

Copperbox revision 2119.

New releases:
wumpus-core-0.43.0
wumpus-basic-0.16.0
wumpus-drawing-0.2.0
wumpus-tree-0.14.0

The main changes are a lot more Shapes in Wumpus-Drawing, plus reworking of Chains and LRText. Wumpus-Basic now has the Geometry modules and work has been done on the drawing objects, particularly CtxPicture, AdvGraphic and PosImage.

wumpus-drawing

Copperbox revision 2117.

I've updated the demos to work with changes to Chains.

Monday, February 7, 2011

wumpus

Copperbox revisions 2115 and 2116.

I've moved the Geometry modules from Wumpus-Drawing to Wumpus-Basic. Wumpus-Basic seems a better place for them, although they will need a fair amount of improvement at some stage.

wumpus-drawing

Copperbox revision 2114.

I've generalized and documented Chains.

wumpus-basic

Copperbox revision 2113.

Improvements to the Haddock documentation and added some empty__ functions for the drawing objects.

wumpus-drawing

Copperbox revision 2112.

Grid drawing via Chains is now working again. The new code looks like its an improvement as it doesn't have to use safeconcat from Wumpus-Basic. safeconcat is the Wumpus way of handling empty lists when concatenating a semigroup - an alternative element has to be provided for the empty list case as semigroup has no mempty.

Sunday, February 6, 2011

wumpus-drawing

Copperbox revision 2111.

I've reworked the Chain modules so the types are more like the other drawing types - i.e. the main Chain type has become a LocCF function.

The Grids module and some of the demos will need changing to work with the new formulation. Also the derived chains could be simplified, I re-wrote them quickly only to work at the new types rather than to do so elegantly.

wumpus-drawing

Copperbox revision 2110.

More work on CatText. I've added margins to the rendering - as CatText will be the main text drawing object in Wumpus it should respect margins. Note - as CatText is quite computationally expensive it won't be the only text drawing object and it won't replace LRText as LRText can be inclined / rotated.

Both CatText and LRText merit new names when I can think of good ones.

Saturday, February 5, 2011

wumpus-drawing

Copperbox revision 2109.

More work on CatText - combinators for horizontal concatenation and changing font colour.

In the example below 'multiline' is blue although the conversion to JPEG seems to have reduced its colour value:

wumpus-drawing

Copperbox revision 2108.

I've added center-aligned and right-aligned rendering for CatText.

wumpus-drawing

Copperbox revision 2107.

More work on CatText. The text object is now the right type a PosImage u (BoundingBox u) rather than a LocGraphic u.

wumpus

Copperbox revision 2106.

Initial work on a more general text object than LRText. The new object is provisionally called CatText, I expect it to have a pretty-print like interface, with support for changing colour, strike-through and underline and hopefully changing font (to get bold or italic text).

Friday, February 4, 2011

wumpus-basic

Copperbox revision 2105.

First round of work filling out the AdvGraphic module, previously it was just the type definition and a couple functions that had bit-rotted.

I want a more versatile text type than LRText in Wumpus-Drawing, and AdvGraphic looks like the candidate to build such a type on.

wumpus-drawing

Copperbox revision 2104.

I've fixed a bug in LRText (an operator precedence error) and updated the examples that use LRText to work again.

Thursday, February 3, 2011

wumpus-drawing

Copperbox revision 2103.

I've re-implemented the LRText module to use the new PosImage type. The code ended up being more complicated than I expected, so it is perhaps not a significant improvement on the previous version. It has pointed to a limitation with Chains that was useful to spot now rather than later - its related to yesterday's problem where I'd misjudged whether a type should need access to the DrawingContext.

Wednesday, February 2, 2011

wumpus-basic

Copperbox revision 2102.

Bad news - I had seriously over-estimated the worth of the new PosGraphic type. The demos so far always used a "context-free" initial rectangle, as they were drawing rectangles the frame rectangle just took the same dimensions as the drawing. However, text isn't context-free in Wumpus-Basic - font size information is taken from the drawing context - and I realized today that PosGraphic would only ever work with context-free dimensions making it incompatible with text its the most important use-case.

I've rectified this now, but the change has the serious consequence that the new PosGraphic (and its more general version PosImage) cannot support composition operators. This means the last two days work is effectively lost.

Tuesday, February 1, 2011

wumpus-basic

Copperbox revision 2101.

I've re-worked the CtxPicture module so the naming scheme is consistent, although I've had to use a rather ugly prefix for the functions (I want to import all the Basic.Kernel modules with one import so can't have name clashes).

That I've had to use ugly names makes me feel there is less value in this module now that other graphic types are more sophisticated. Maybe composing CtxPictures needs a smaller set of better combinators...

wumpus-basic

Copperbox revision 2100.

Adding haddock docs to PosGraphic module and initial re-working of the CtxPicture module.

CtxPicture lost the good combinator names to PosGraphic, so it needs new ones. One problem is that I'd like to encode directions rather than positions, but "horizontal" and "vertical" are too long and I already (over-) use h and v as prefix letters. I'm not sure all the name changes I've just made are suitable.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.