Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1448

VB6 - WIA "BlendPaint" Demo - comparison with Cairo-Drawing

$
0
0
The Demo here depends on a reference to vbRichClient5 (http://vbrichclient.com/#/en/Downloads.htm)

Just demonstrating what is needed (coding wise) and what the performance-differences
are - compared with preinstalled MS-system-libs.

Below is all the code which is needed, to achieve the same effect as the nice Demo of dilettante
here: http://www.vbforums.com/showthread.p...aint-quot-Demo

Code:

Option Explicit

Private Sub mnuPGBsCairo_Click()
    Cairo.ImageList.AddImage "BGnd", App.Path & "\background.jpg"
    Cairo.ImageList.AddImage "Ball", App.Path & "\glass_ball.png"

    New_c.Timing True
      RenderPerCairo Cairo.CreateSurface(480, 360).CreateContext
    Caption = New_c.Timing
End Sub

Private Sub RenderPerCairo(CC As cCairoContext)
    CC.RenderSurfaceContent "BGnd", 0, 0
    CC.RenderSurfaceContent "Ball", 20, 200, 160, 120, , , True
    CC.RenderSurfaceContent "Ball", 300, 220, 160, 120, , , True
    CC.RenderSurfaceContent "Ball", -60, -80
    Set Picture = CC.Surface.Picture
End Sub

Performance is about factor 10 better (4-5msec for Cairo-Blending vs. 45-55msec for the WIA-approach).

Here the Download as a Zip-Archive (re-using dilettantes resources):
http://vbrichclient.com/Downloads/WIA_and_Cairo.zip

And a Screenshot:


Olaf

Viewing all articles
Browse latest Browse all 1448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>