Dissecting Drawables - could Brush attributes become public?


#1

I want to convert SVGs to a small&fast homebrew vector graphics format and I thought I could exploit the SVG -> Drawable import rather than dealing with the SVG spec directly.

Unfortunately, I can’t extract the req’d information from the brushes because the attributes of GradientBrush and ImageBrush are protected.

Everything else seems extractable so I wonder if these attributes could be made public?

The attributes in question are:

GradientBrush::gradient

ImageBrush::image
ImageBrush::anchorX
ImageBrush::anchorY
ImageBrush::opacity


#2

Yes, I’m sure I can expose those values.

I’m planning to make some improvements to the drawables soon, so if you’re using your own classes because of something that’s missing from the drawable classes, I’d be keen to hear you opinions on what they could do better…


#3

How many bananas does it take to make Josephine Baker decent?

Reference-counting might have saved some fruit for the hungry.

But it’s probably too late to change that.

My specific reasons for wanting reference counted drawables instead of deep copying have to do with PILS using uniquely represented constants. By embedding hidden Juce objects in PILS graphs, I can get easy construction with PILS and fast drawing with Juce - but I had to construct my own Drawable-like thing to make it work with reference counted PILS objects.

A serialization protocol would be nice. Perhaps OpenGL integration…


#4

Well, I was certainly going to add some kind of serialisation to them.

What I’d like to do make the library’s drawing more declarative rather than procedural, by making much heavier use of drawables.

My current plan is, (vaguely):

  1. make drawables powerful enough to handle more complex layouts, e.g. making their co-ordinate specifications support the kind of things that PositionedRectangle can do.

  2. change most of the lookandfeel code to return drawables instead of rendering the graphics directly.

  3. to extend the jucer into a more powerful drawing tool that creates these drawables

  4. to add a lookandfeel designer to the jucer, so you can build and test all the elements of your l+f graphically, and save it in a serialised form that you can load into your app


#5

Re Recent update

JuceDemo doesn’t build due to changes in Draw


#6

Yeah, I know, just doing some tidying up…