digitalmars.D.announce - Updated cairo bindings on dsource
- Daniel Keep (37/37) May 18 2006 I've just updated the cairo bindings on dsource. Changes included:
- renox (5/56) May 19 2006 Why do you mean by inconsistent?
- Daniel Keep (10/25) May 20 2006 Basically, inconsistent in the sense that some objects use constructors
I've just updated the cairo bindings on dsource. Changes included: * Several bugfixes. * Addition of the Glitz and Xlib backends. * New OO layer called cairooo. * cairooo snippets. * A very *very* basic cairooo tutorial. * A neat little demo program, which renders one of FunkyM's D logos in various styles. * D scripts for building import libraries. http://dsource.org/projects/bindings/browser/trunk/cairo Also, if anyone is interested, I'd like to get some eyes other than my own on to the design of the OO layer; this is my first attempt at putting together something this large. Specifically, I have a few classes that can't decide between using constructors or static methods. The problem is this: * Certain objects can be constructed in different ways. For example: SolidPattern can be created using an RGB or RGBA colour. * However, the cairo developers have said NOT to overload these methods, since RGBA using premultiplied alpha might be added; and what if CMYK gets added as well? * Thus, my choices are to make a ludicrous number of subclasses so that I can have distinct constructors, * OR I can use static createXXX methods (which is basically what cairomm, C++'s binding does). For example: Pattern red = new SolidPatternRGB(1,0,0); versus: Pattern red = SolidPattern.createRGB(1,0,0); I'm leaning towards using the createXXX functions since it creates less clutter and useless "constructor" classes, but I'm worried that this will make the library inconsistent. Or maybe I should keep as much of it using constructors and only use createXXX where neccecary. Ideas? Opinions? Suggestions? -- Daniel Keep -- v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
May 18 2006
Daniel Keep wrote:I've just updated the cairo bindings on dsource. Changes included: * Several bugfixes. * Addition of the Glitz and Xlib backends. * New OO layer called cairooo. * cairooo snippets. * A very *very* basic cairooo tutorial. * A neat little demo program, which renders one of FunkyM's D logos in various styles. * D scripts for building import libraries. http://dsource.org/projects/bindings/browser/trunk/cairo Also, if anyone is interested, I'd like to get some eyes other than my own on to the design of the OO layer; this is my first attempt at putting together something this large. Specifically, I have a few classes that can't decide between using constructors or static methods. The problem is this: * Certain objects can be constructed in different ways. For example: SolidPattern can be created using an RGB or RGBA colour. * However, the cairo developers have said NOT to overload these methods, since RGBA using premultiplied alpha might be added; and what if CMYK gets added as well? * Thus, my choices are to make a ludicrous number of subclasses so that I can have distinct constructors, * OR I can use static createXXX methods (which is basically what cairomm, C++'s binding does). For example: Pattern red = new SolidPatternRGB(1,0,0); versus: Pattern red = SolidPattern.createRGB(1,0,0); I'm leaning towards using the createXXX functions since it creates less clutter and useless "constructor" classes, but I'm worried that this will make the library inconsistent.Why do you mean by inconsistent? Just curious.. Regards, Renaud Hebert.Or maybe I should keep as much of it using constructors and only use createXXX where neccecary. Ideas? Opinions? Suggestions? -- Daniel Keep
May 19 2006
renox wrote:Daniel Keep wrote:Basically, inconsistent in the sense that some objects use constructors like so: Context cr = new Context(surface); Whilst others would be using createXXX functions like so: Pattern red = SolidPattern.createRGB(1,0,0); -- Daniel Keep -- v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/[snip] I'm leaning towards using the createXXX functions since it creates less clutter and useless "constructor" classes, but I'm worried that this will make the library inconsistent.Why do you mean by inconsistent? Just curious.. Regards, Renaud Hebert.
May 20 2006