[cairo] Help the struggling newby!

Andrew Ellis andrewjellis at hotmail.com
Sun Aug 14 18:02:52 PDT 2011


Hi MaartenI'm very tied to VB6.  The application in question is currently around 130,000 lines of code.  It's in several layers (client-server) and of course, I guess the user interface layer could be migrated to something else if I can still access objects in the middleware (which resides on a server machine as an out-of-process COM object).  But I'd really rather not have to do that.There are several things I'd like to do with my graphics, and while it would be *possible* to do them using VB, it would be rather slow.  I could possibly use Windows GDI calls to achieve these objectives, but I don't have a lot of experience with that, so the idea of using a DLL built as a wrapper for tried-and-tested graphics functionality is attractive.The application has objects with two kinds of image.  The first type is calculated from other properties the object may have, and is then drawn using VB's line-drawing primitives.  Such an image is stored as two collections: (1) all the straight lines (between two cartesian coordinates) and (2) all the curved lines (each having a cartesian coordinate for the centre of the circle, a radius, and a starting and finishing angle).  These are precisely the parameters I have to provide for VB's line-drawing methods, so that minimal processing is required when rendering the image.  I might need to repeatedly redraw the image while tracking a drag-and-drop operation, for example, and so I don't want to perform any more processing than necessary.  Imagine the application to be producing a map.  All the end-points of the roads can be calculated once, and the connections between them stored for future use.  If I need to rotate the map, pan across it, or zoom in and out, I simply redraw it but at the same time modifying its stored parameters to reflect the new X or Y offset, the viewing angle, and the scale factor.  The shape itself doesn't change, but the drawing methods are quite slow.  I'm sure that a performance improvement could be gained by rendering the image onto something like a Cairo surface, and the surface rotated or transformed as required.The second type of image is more like the drawing of a physical object.  The shape is a collection of regions, each with a shape (like the shape used for the first image type) and a colour.  Alternatively, it may be a bitmap, perhaps because the user has taken a photograph of the object in question.  Using the map analogy again, these objects might represent fields or areas of water, or aerial photographs.  The bitmap-type image is rather difficult to scale or rotate using VB.  BitBlt and StretchBlt can be used from Windows GDI to achieve the translation and scaling, but the rotation is still difficult.  Once again, there appears to be an advantage in using Cairo, since the surface doesn't care what was used to generate the image, and the same code may be used for the final rendering of both types of image.Andy

> Date: Sun, 14 Aug 2011 23:13:19 +0200
> Subject: Re: [cairo] Help the struggling newby!
> From: mkbosmans at gmail.com
> To: andrewjellis at hotmail.com
> CC: cairo at cairographics.org
> 
> Hi Andrew,
> 
> I doubt anyone on this list has any experience with Visual Basic using Cairo.
> 
> So what exactly are your problems? If you can show us some code and
> describe what you are trying to achieve, we can probably suggest to
> you how to use cairo to achieve your goal.
> 
> That being said, how tied are you to VB6? Python is a really nice
> language to develop apps quickly in and has good supported cairo
> bindings. Another suggestion is to develop a .NET app in
> VisualBasic.NET and use the Mono.Cairo bindings from the Mono project.
> 
> Maarten
> 
> 
> 2011/8/14 Andrew Ellis <andrewjellis at hotmail.com>:
> > Hello all.
> > I've joined this group in the hope that someone might give me some pointers
> > to some documentation.  I'm developing a VB6 application, and need some
> > better graphics capabilities...
> > I was persuaded to buy into the idea of using Cairo by someone in one of the
> > VB6 groups.  Someone named Olaf Schmidt.  He's produced a Cairo wrapper
> > (dhcairo.dll) and several VB6 tutorial projects.  I've tried experimenting
> > with the tutorials - altering lines of code to see what the new effect is,
> > for example - but I don't understand why the thing behaves the way it does.
> >  I don't have any fit-for-purpose documentation, specifically to tell me (1)
> > what is available for my application to use, (2) in what order they should
> > be called, and (3) what the various parameters mean.  His commentary is not
> > very helpful - German translated into English, and not very well.  I can't
> > make head or tail of it!
> > I haven't been able to get a lot of support from Olaf, and this problem has
> > been waiting for a solution for over a year.  I'm not vastly experienced in
> > graphics work, as I said, I just need something better than the standard
> > graphics calls in VB6.
> > If you've used dhCairo, perhaps you know of some docs I can look at?
> > Andy
> > --
> > cairo mailing list
> > cairo at cairographics.org
> > http://lists.cairographics.org/mailman/listinfo/cairo
> >
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110815/1b3f9a53/attachment.htm>


More information about the cairo mailing list