Prev: Is it possible to read directly bytes from within my application?
Next: New Webcam and VB6 source code
From: Schmidt on 21 May 2010 02:50 Hi all, the new dhCairo-Version is online now, as well as a huge and wellcommented Tutorial, consisting of several Tutorial-Folders which all host only one single VB-project, each Folder self- contained (no cross-references to other Folders of the tutorial, to keep things simple and "in focus"). I've also tried, to order the folders by numbers - in a way that seemed appropriate to me with regards to "stepping up on a learning-curve". Please download from either: www.thecommon.net/3.html or directly per: www.datenhaus.de/Downloads/dhRichClient3.zip (about 1.6MB) www.datenhaus.de/Downloads/VB-cairoTutorial.zip (about 4MB) Tutorial-folders 1-19 contain just plain cairo-drawing-functions (as well as a bunch of picture-resources, hence the 4MB-size) and interact only with "normal standard-VB-controls" ... but tutorial folder 20 now already contains the first simple Widget-Implementations, so that you can take a look, how the widget-engine wants to "get feeded", and how "all the magic" is done...) What's that stuff at all? In short, cairo is a library for 2D-Vector-Drawing, comparable in functionality to GDI+ ... but it covers an eaven broader "spectrum" - its functionality made available in a _very_ comfortable way over wrapper-classes (dhCairo.dll providing the COM/ActiveX-wrapper - and cairo2_engine.dll is a C-compiled StdCall-Dll which does most of the rendering-work. What do I need it for? Well, that depends - when I say: "for antialiased drawings of graphics- primitives and layered blending-operations on all kind of surfaces" - then this perhaps sounds a little bit abstract at the moment... ;-) but if you always wanted to know, how to do stuff like this here: http://people.mozilla.com/~vladimir/demos/photos.svg (covered nearly exactly with a low amount of VB-code in Demo #12) ... as well as: (in extracts) different BSpline-Types (Demo #6) text along curves (Demo #7) all sorts of different gradients (Demo #9) superfast thumbnailing of huge JPGs (Demo #14) direct PDF-generation (Demo #17) write small 2D-animations or games, thereby using a capable collision-detection, respecting physics (Demos #18 und #19) Or finally: write powerful, modern looking Controls (Widgets) without having to fiddle around with subclassing (Demo #20) ... ....then I'd recommend you should take a good look at the package and start to dive in. ;-) A warning up-front (since the problem already popped up in the german group): There's currently a hardware-restriction to CPUs with SSE2- support - but I'll provide a different compile of cairo2_engine.dll (without this SSE2-enforcement) soon for the about 3-5% of CPU-users out there, which yet own a PentiumIII - or one of the older AMD-CPUs which were labeled "Athlon-XP"). Another restriction is with regards to OS-versions lower than W2K (affecting the users of Win98/Me versions) - sorry about that, since I know, that many of you here yet prefer these versions. .... Ok, what's new in comparison to earlier versions of the wrapper: - SVG-support is now in (directly written in VB6, since the usual cairo-companion: librsvg, would have increased the binarys size significantly ... well, of the thousands of SVG-Icons in the modern Oxygen-package (now also coming under "business friendly" LGPL-terms) only a remaining handful doesn't render correctly - goal reached. - JPG-support is in there too - and not the "first best one" - it's the (yet relative unknown) "libjpeg-turbo" which was carefully handoptimized and does its De- and Encoding with about 3-4 times the speed of the "normal libjpeg" (same speed-advantage is there, when compared with Windows OleLoadPicture-functions). So this is (IJL) Intel-JPG-Lib-level now, but usable without any uncertainties regarding the license. For fast thumbnailing there also exist 1/16, 1/8, etc. modes. - And since JPG-encoding/decoding now comes at "very low costs", the wrapper was enhanced about a proprietary feature, which is currently in no way "standardized" - but IMO very useful nonetheless (Flash supports similar things): Alpha-JPGs. Currently most devs store, use and deploy their Alpha- Channel-resources per *.ico or sometimes *.png ... but alpha-jpgs can help to significantly reduce the deployment- size of such resources (in case you have many of them) by about factor 3-5. - BSpline-support - comfortable usage per single (optional) Enum-parameter in the (also new) Polygon-rendering-calls. The Enum offers different "damping-scales" on the interpolated Spline-curve. And since we are at the Polygon-Functions - there's also a new comfort-function for "regular shapes" now - these are all these different pentagrams, hexagons, triangles which are symmetrically constructable "around a given radius". And the BSpline-damping is working on these new shape- drawing-functions too. - All the different cairo-gradient-calls got some convenience- functions - among them now different helpers, to add "difficult to calculate color-stop-sequences" - as for example: Two- and Three-ColorStop-Gaussians (aka TwoColorBell, ThreeColorBell). - Integrated into the PixelSurfaces is now a pretty fast working Gaussian Blur (implemented in plain VB6) which especially the more complex SVG-images need very often - but usable of course also in your own, normal drawings (e.g. to create real dropshadows). - Uploading of PixelSurfaces into DirectX-Surfaces: from there a fast up- or downstretching in high quality onto normal Window-Handles can be achieved. The feature will work independently from the (normally needed) dx7vb.dll & Co. even on Vista and Win7 - this was possible due to the (slightly adapted) DX-Typelib of Patrice Scribe. Useful especially for PixelSurfaces with "fixed Dimensions" - as for example in small 2D-games - or if you have incoming decoded Videcontent, which you want to overlay with e.g. semitransparent cairo-drawings and text-outs, before uploading the result as a texture into a DX-Surface, followed by fast, stretched-DX-Blitting onto your Window of choice (no matter what WindowSize). - chipmunk-physics engine ... thought about its inclusion for a while, but then decided to integrate it as well, since such stuff is appealing especially for the younger devs - thought we all want to see new faces in the community, do we? ;-) Anywas, the results look good and work well - and got even me hooked for some time (being no gamer at all)... cairo and chipmunk are apparently a well-matching pair, both working with SubPixel-precision using Double-Coords, and the performance-breakup between collision-detection and the final rendering-efforts per cairo lay with complex simulations at a ratio of about 50:50. Here are some links, what one can achieve with chipmunk, (but the VB-Demos in the tutorial are at least that good, I tell ya...;-): http://www.youtube.com/watch?v=V1xiVyJ3EOM http://www.youtube.com/watch?v=sTHoWaTNJiA - and finally a bunch of new convenience-functions throughout the whole wrapper - with the goal: "less lines of code per graphics-effect" ... Anything which was looking cumbersome to me whilst writing the tutorials, I've tried to cut short, so the tutorial now contains already "optimal best-practise-code" for working against cairo in an efficient way. Generally there's to say (and this holds true also for the ..Net-Devs with their new WPF-Vectorengine), that the whole thing does not "come for free" - you will need to invest time, to learn these new APIs. And that the toolset-libs of course (regfree mode to-or-fro) mean an additional deployment-volume of about 1.6MB shouldn't remain unmentioned, but IMO this is the time and the way we can polish up the "Visual" part in VB. Now, (with respects to modern graphics-tools) why work with cairo - and not with i.e. GDI+? A few (subjective of course) arguments: Cairo IMO offers the more complete Interface over its different Surface-Types - the perhaps most important one (aside from the Pixel-Surfaces) is the PDF-surface, drawable over the very same routines one works with against any cairo-surface. The cairo-API is IMO cleaner and easier to learn - the more so, when already being available over already proven VB- Classes and Intellisense. And although this intermediate VB-Class-Layer is more convenient to use than plain cairo-drawing-APIs, the drawing-sequences and the naming you learn, is reusable nevertheless in a whole lot of different languages. For example, if you find an interesting cairo-drawing- sequence (covering a certain effect) online per WebSearch, no matter if it was written in Java, Python or C - you will have no larger problems, to adapt it back into "wrapper- understandable VB-code-sequences" - and the same thing would work in the other direction too of course. And that cairo is used by the FireFox-devs as their rendering engine too, ensures a well-driven development of new cairo-features and bindings with a good pace. For example - at the end of this year (together with the release of the new FireFox 4) a new windows-backend for cairo will be available, working against the new Direct2D and DirectWrite-APIs, which were introduced with Win7 - but also available (per Servicepack) on Vista now. As soon as these new backend-drivers for cairo become visible in cairos official source-repositories, I will only need to recompile cairo2_engine.dll against these latest checkouts - and the Apps using the wrapper would have a benefit from even better render-performance at nearly no costs. Ok, hope all this was convincing enough (and not too longwinded up to this point here ;-) ... anyways, have fun with the new demos, and let me know about problems when they arise. Olaf
From: Norm Cook on 21 May 2010 09:08 Wow!!! Thanks for sharing. "Schmidt" <sss(a)online.de> wrote in message news:%236rtnJL%23KHA.1892(a)TK2MSFTNGP05.phx.gbl... > Hi all, > > the new dhCairo-Version is online now, as well as a huge and > wellcommented Tutorial, consisting of several Tutorial-Folders > which all host only one single VB-project, each Folder self- > contained (no cross-references to other Folders of the tutorial, > to keep things simple and "in focus"). > I've also tried, to order the folders by numbers - in a way that seemed > appropriate to me with regards to "stepping up on a learning-curve". > > Please download from either: > www.thecommon.net/3.html > or directly per: > www.datenhaus.de/Downloads/dhRichClient3.zip (about 1.6MB) > www.datenhaus.de/Downloads/VB-cairoTutorial.zip (about 4MB) > Tutorial-folders 1-19 contain just plain cairo-drawing-functions > (as well as a bunch of picture-resources, hence the 4MB-size) > and interact only with "normal standard-VB-controls" ... > but tutorial folder 20 now already contains the first simple > Widget-Implementations, so that you can take a look, how > the widget-engine wants to "get feeded", and how "all the magic" > is done...) > > What's that stuff at all? > In short, cairo is a library for 2D-Vector-Drawing, comparable in > functionality to GDI+ ... but it covers an eaven broader "spectrum" - > its functionality made available in a _very_ comfortable way over > wrapper-classes (dhCairo.dll providing the COM/ActiveX-wrapper - > and cairo2_engine.dll is a C-compiled StdCall-Dll which does most > of the rendering-work. > > What do I need it for? > Well, that depends - when I say: "for antialiased drawings of graphics- > primitives and layered blending-operations on all kind of surfaces" - > then this perhaps sounds a little bit abstract at the moment... ;-) > but if you always wanted to know, how to do stuff like this here: > http://people.mozilla.com/~vladimir/demos/photos.svg > (covered nearly exactly with a low amount of VB-code in Demo #12) > ... as well as: (in extracts) > different BSpline-Types (Demo #6) > text along curves (Demo #7) > all sorts of different gradients (Demo #9) > superfast thumbnailing of huge JPGs (Demo #14) > direct PDF-generation (Demo #17) > write small 2D-animations or games, thereby using a capable > collision-detection, respecting physics (Demos #18 und #19) > > Or finally: write powerful, modern looking Controls (Widgets) > without having to fiddle around with subclassing (Demo #20) ... > > ...then I'd recommend you should take a good look at the > package and start to dive in. ;-) > > A warning up-front (since the problem already popped up in the > german group): > There's currently a hardware-restriction to CPUs with SSE2- > support - but I'll provide a different compile of cairo2_engine.dll > (without this SSE2-enforcement) soon for the about 3-5% of > CPU-users out there, which yet own a PentiumIII - or one of > the older AMD-CPUs which were labeled "Athlon-XP"). > Another restriction is with regards to OS-versions lower > than W2K (affecting the users of Win98/Me versions) - > sorry about that, since I know, that many of you here yet > prefer these versions. > > ... > > Ok, what's new in comparison to earlier versions of the wrapper: > > - SVG-support is now in (directly written in VB6, since the > usual cairo-companion: librsvg, would have increased the > binarys size significantly ... well, of the thousands of SVG-Icons > in the modern Oxygen-package (now also coming under > "business friendly" LGPL-terms) only a remaining handful > doesn't render correctly - goal reached. > > - JPG-support is in there too - and not the "first best one" - > it's the (yet relative unknown) "libjpeg-turbo" which was > carefully handoptimized and does its De- and Encoding > with about 3-4 times the speed of the "normal libjpeg" > (same speed-advantage is there, when compared with > Windows OleLoadPicture-functions). > So this is (IJL) Intel-JPG-Lib-level now, but usable > without any uncertainties regarding the license. > For fast thumbnailing there also exist 1/16, 1/8, etc. modes. > > - And since JPG-encoding/decoding now comes at "very > low costs", the wrapper was enhanced about a proprietary > feature, which is currently in no way "standardized" - but > IMO very useful nonetheless (Flash supports similar things): > Alpha-JPGs. > Currently most devs store, use and deploy their Alpha- > Channel-resources per *.ico or sometimes *.png ... but > alpha-jpgs can help to significantly reduce the deployment- > size of such resources (in case you have many of them) > by about factor 3-5. > > - BSpline-support - comfortable usage per single (optional) > Enum-parameter in the (also new) Polygon-rendering-calls. > The Enum offers different "damping-scales" on the interpolated > Spline-curve. > And since we are at the Polygon-Functions - there's also a > new comfort-function for "regular shapes" now - these are > all these different pentagrams, hexagons, triangles which > are symmetrically constructable "around a given radius". > And the BSpline-damping is working on these new shape- > drawing-functions too. > > - All the different cairo-gradient-calls got some convenience- > functions - among them now different helpers, to add "difficult > to calculate color-stop-sequences" - as for example: Two- > and Three-ColorStop-Gaussians (aka TwoColorBell, > ThreeColorBell). > > - Integrated into the PixelSurfaces is now a pretty fast working > Gaussian Blur (implemented in plain VB6) which especially > the more complex SVG-images need very often - but usable > of course also in your own, normal drawings (e.g. to create > real dropshadows). > > - Uploading of PixelSurfaces into DirectX-Surfaces: > from there a fast up- or downstretching in high quality onto > normal Window-Handles can be achieved. > The feature will work independently from the (normally needed) > dx7vb.dll & Co. even on Vista and Win7 - this was possible > due to the (slightly adapted) DX-Typelib of Patrice Scribe. > Useful especially for PixelSurfaces with "fixed Dimensions" - > as for example in small 2D-games - or if you have incoming > decoded Videcontent, which you want to overlay with e.g. > semitransparent cairo-drawings and text-outs, before uploading > the result as a texture into a DX-Surface, followed by fast, > stretched-DX-Blitting onto your Window of choice (no > matter what WindowSize). > > - chipmunk-physics engine ... thought about its inclusion for a > while, but then decided to integrate it as well, since such stuff > is appealing especially for the younger devs - thought we all > want to see new faces in the community, do we? ;-) > Anywas, the results look good and work well - and got even > me hooked for some time (being no gamer at all)... > cairo and chipmunk are apparently a well-matching pair, > both working with SubPixel-precision using Double-Coords, > and the performance-breakup between collision-detection > and the final rendering-efforts per cairo lay with complex > simulations at a ratio of about 50:50. > Here are some links, what one can achieve with chipmunk, > (but the VB-Demos in the tutorial are at least that good, I tell > ya...;-): > http://www.youtube.com/watch?v=V1xiVyJ3EOM > http://www.youtube.com/watch?v=sTHoWaTNJiA > > - and finally a bunch of new convenience-functions throughout > the whole wrapper - with the goal: "less lines of code per > graphics-effect" ... > Anything which was looking cumbersome to me whilst writing > the tutorials, I've tried to cut short, so the tutorial now contains > already "optimal best-practise-code" for working against cairo > in an efficient way. > > > Generally there's to say (and this holds true also for the > .Net-Devs with their new WPF-Vectorengine), that the > whole thing does not "come for free" - you will need to > invest time, to learn these new APIs. > And that the toolset-libs of course (regfree mode to-or-fro) > mean an additional deployment-volume of about 1.6MB > shouldn't remain unmentioned, but IMO this is the time > and the way we can polish up the "Visual" part in VB. > > Now, (with respects to modern graphics-tools) why > work with cairo - and not with i.e. GDI+? > > A few (subjective of course) arguments: > > Cairo IMO offers the more complete Interface over its > different Surface-Types - the perhaps most important one > (aside from the Pixel-Surfaces) is the PDF-surface, drawable > over the very same routines one works with against any > cairo-surface. > > The cairo-API is IMO cleaner and easier to learn - the more > so, when already being available over already proven VB- > Classes and Intellisense. > > And although this intermediate VB-Class-Layer is more > convenient to use than plain cairo-drawing-APIs, the > drawing-sequences and the naming you learn, is reusable > nevertheless in a whole lot of different languages. > For example, if you find an interesting cairo-drawing- > sequence (covering a certain effect) online per WebSearch, > no matter if it was written in Java, Python or C - you will > have no larger problems, to adapt it back into "wrapper- > understandable VB-code-sequences" - and the same > thing would work in the other direction too of course. > > And that cairo is used by the FireFox-devs as their rendering > engine too, ensures a well-driven development of new > cairo-features and bindings with a good pace. For example - > at the end of this year (together with the release of the new > FireFox 4) a new windows-backend for cairo will be available, > working against the new Direct2D and DirectWrite-APIs, which > were introduced with Win7 - but also available (per Servicepack) > on Vista now. As soon as these new backend-drivers for cairo > become visible in cairos official source-repositories, I will > only need to recompile cairo2_engine.dll against these latest > checkouts - and the Apps using the wrapper would have > a benefit from even better render-performance at nearly > no costs. > > Ok, hope all this was convincing enough (and not too longwinded > up to this point here ;-) ... anyways, have fun with the new demos, > and let me know about problems when they arise. > > Olaf > >
From: Schmidt on 26 May 2010 22:03
"Jim Carlock" <jcarlock(a)NOSPAM.example.com> schrieb im Newsbeitrag news:eifNxdF$KHA.5476(a)TK2MSFTNGP06.phx.gbl... > > : http://people.mozilla.com/~vladimir/demos/photos.svg > > : (covered nearly exactly with a low amount of VB-code > > in Demo #12) > > I love that link there. The first time I loaded it I did not > really take a good look at it and it did not impress. > I loaded it again about an hour > or so later and WOW!!! I am impressed. Just to make sure ... I'm not the author of the (SVG/Javascript)- based code, used in this online-demo (as the name in the link above perhaps already suggests) ;-). But yes, it's nice to play around with that for a little while - although its usefulness in "serious applications" is somewhat questionable - covering it in VB-code was done for the same "eye-candy-purposes", but also to be able to compare "matching cairo-performance" (since Firefox is using the cairo-library too for its rendering-output) - and the Demo is a real CPU-stresser, when the images are rotatet in larger sizes. The result was good - in my tests, the VB-Demo ran even a bit faster than the above link works within Firefox. > : A warning up-front (since the problem already popped up in the > : german group): > : There's currently a hardware-restriction to CPUs with SSE2- > : support - but I'll provide a different compile of cairo2_engine.dll > : (without this SSE2-enforcement) soon for the about 3-5% of > : CPU-users out there, which yet own a PentiumIII - or one of > : the older AMD-CPUs which were labeled "Athlon-XP"). > : Another restriction is with regards to OS-versions lower > : than W2K (affecting the users of Win98/Me versions) - > : sorry about that, since I know, that many of you here yet > : prefer these versions. > > I use an AMD-XP (2400MHz) processor. ... Ouch, that's bad (dampening your interest perhaps), since that is one of the few models nowadays, which do *not* have the SSE2-CPU-instructionset built in. And that's exactly the one processor-model (although being a little bit older) which is yet fast enough for todays Apps, so I will need to provide another (lower optimized) version of my cairo-compile soon as it seems - thought I'd be able to avoid all that, but the AMD-XP-CPU was flying under my Radar. It's exactly the same model, which came up in the german group. The older Pentium-IV CPUs which were sold roughly at the same time (about 2002/2003) already had SSE2 built in, but able to win only against a similar clocked AMD-XP, in all these Video-encoding comparisons, which made use of these newer "long-word-instructions". So I fear (or better: I'm sure), you will not be able to run the VB-demos with the current (for SSE2-CPUs only) speed- optimized version of the included cairo-library-compile - please be patient for a while - will deliver an alternatively compiled lib-version in the next weeks (I'm just waiting for the next release of new cairo-sources, to avoid double efforts, since a successful cairo-build on windows is something to pull your hair out, till everything "goes through" <g>) Olaf |