Results 1 to 5 of 5

Thread: [VB6] Tutorial: Vector- and PixelGraphics using Cairo

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    [VB6] Tutorial: Vector- and PixelGraphics using Cairo

    Whilst the graphics-support of the VB6-runtime (e.g. PictureBox, Shape-Controls, Line-, Circle-, Print-commands)
    is often sufficient for simpler graphics-scenarios, there are things which require the usage of "heavier guns"...
    Meaning - the usage of a more capable graphic-lib with support for e.g.:
    - Antialiased Drawings
    - full Transparency-support using Alpha-Parameters for all Drawing-Primitives (Alpha-Colors and Alpha-Bitmaps)
    - Unicode-TextOutput
    - modern "Blend-Operations" for Pixel-Buffers (meaning "more than just Alpha-Blending")
    - all kind of "nestable Transforms" (as e.g. Translate, Scale, Rotate)

    One of those libs is the one from cairographics.org, which is platform-independent - and in use worldwide.
    IMO - it's a worthwhile API to learn and invest time into - considering, that we all have to "switch from VB6 to another language"
    at some point in time... and learning a lib which has bindings for "all other languages" and not only works on Windows, might come in handy later...

    Tutorial-Contents:

    I will not write much text here about the several "Sub-Steps in the Tutorial" -
    since all that is explained in the comments of a lot of VB6-Projects which are organized into SubFolders of the Tutorial-Zip:
    (the numbered Project-Folder-Names are "increasing in difficulty, along your learning-curve-progress")

    • 1 Hello World
    • 2 Scaling and simple Transforms
    • 3 Lines and Stroking
    • 4 Poly-Lines and BSpline-Interpolation
    • 5 Bezier-Curves
    • 6 Spline-Interaction
    • 7 (A) Text along Curves
    • 7 (B) Text along Circles
    • 7 (C) FontRendering-Options
    • 8 Shapes and Alpha-Opacities
    • 9 Gradients
    • 10 Clipping
    • 11 Masking
    • 12 (A) ImageSurfaces Rotate+Scale
    • 12 (B) ImageSurfaces Skew+Perspective
    • 12 (C) ImageSurfaces Ken Burns Effect
    • 13 Alpha-JPGs
    • 14 Thumbnailing per ImageList
    • 15 ImageList and IconResources
    • 16 SVG
    • 17 PDF-Creation
    • 18 Chipmunk-Physics (simple Balls)
    • 19 Chipmunk-Physics (Fluid)
    • 20 first simple Widgets (GUI-Controls)


    The Tutorial-Zip was too large to upload (in total it's about 7MB, since the Project-Folders contain a lot of Demo-PNG-, JPG- and SVG-images) -
    so I'm providing a GitHub-URL instead (which is an allowed workaround for this forum in the meantime):
    https://github.com/vbRichClient/CairoTutorial

    So - please download the Tutorial-Zip from the GitHub-link above...
    Note, that before running the Tutorial-Projects - one has to install the COM-Class-wrapper for cairo first (vbRichClient5).

    Here a ScreenShot of a Tutorial-Project, which is more related to handling of PixelGraphics via Cairo:


    And two others, which show-off the Vector-graphics-support of the cairo-wrapper-classes:




    Happy studying...

    Olaf

  2. #2
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,742

    Re: [VB6] Tutorial: Vector- and PixelGraphics using Cairo

    rc6 svg,The displayed picture is jagged, but Google Chrome does not have jagged. Is there a solution?
    (Disable VB’s DPI scaling and it’s no problem, IE’s webbrowser control can also display SVG)
    Last edited by xiaoyao; Apr 7th, 2021 at 10:29 AM.

  3. #3
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,223

    Re: [VB6] Tutorial: Vector- and PixelGraphics using Cairo

    My plan is to convert my as yet unfinished GDI+ dock to RC5 Cairo when I do finally complete the current GDI+ version and finish up my remaining tasks. I have a bit to do yet before that happens, one small thing is the conversion of the GDI+ dock to D3D (just for the experience of having done so).

    It makes sense to have a little preparation done for multi-platform graphic support assuming TwinBasic or RADBasic do get off the ground and hoping that one day there is a future for VB6 on other platforms. So, Cairo fits into that idea quite nicely and it will be the incentive I will need to dip into RC5.

    I know you think I should have been there with RC5 right from the start but my aim was building a typical Windows app. using the components that existed in the XP era alone. That is why I chose GDI+ and VB6.

    That task has been largely accomplished, the D3D conversion is the next step in the chain for me and then I can start thinking of bigger and better things, those being RC5, Cairo and VB6 and/or perhaps the conversion of my dock to VB.NET if the RADBasic/TwinBasic thing does not quite work out in the way I want them both to.

    Edit - Added the latest image of my dock.
    Last edited by yereverluvinuncleber; May 13th, 2021 at 01:08 PM.

  4. #4
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,742

    Re: [VB6] Tutorial: Vector- and PixelGraphics using Cairo

    HTML5 IS EASY THAN cairo

  5. #5
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,223

    Re: [VB6] Tutorial: Vector- and PixelGraphics using Cairo

    Quote Originally Posted by xiaoyao View Post
    HTML5 IS EASY THAN cairo
    English is easier than Chinese but I'm not sure whether either comment is relevant to this discussion.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width