'Auto-reshell the script to the 32Bit-WSH-version on Win64 (if needed) With CreateObject("WScript.Shell") WS32 = .ExpandEnvironmentStrings("%SYSTEMROOT%\SysWOW64\wscript.exe") If StrComp(WScript.FullName, WS32, vbTextCompare) Then If CreateObject("Scripting.FileSystemObject").FileExists(WS32) Then .Run """" & WS32 & """ """ & WScript.ScriptFullName & """", 1, 0 WScript.Quit End If End If End With '**** Cairo-related Demo-Code starts here... **** Private New_c, Cairo, CC, Patterns Set New_c = CreateObject("vbRichClient5.cConstructor") 'MainConstructor Set Cairo = New_c.Cairo Const TS=400, TOf=20, CAIRO_EXTEND_REPEAT=1, CAIRO_EXTEND_REFLECT=2 CreateAlhambraTiles 3 * TS + 4 * TOf, TS + 2 * TOf, 0.5 CreateAlhambraTiles 3 * TS + 4 * TOf, TS + 2 * TOf, 1 CreateAlhambraTiles 3 * TS + 4 * TOf, TS + 2 * TOf, 1.5 Sub CreateAlhambraTiles(dx, dy, Zoom) Set CC = Cairo.CreateSurface(dx * Zoom, dy * Zoom).CreateContext CC.Paint , Cairo.CreateSolidPatternLng(vbWhite) CC.ScaleDrawings Zoom, Zoom Set Patterns = New_c.Collection AddTriWingPattern "TriWing", vbBlack AddArrowPattern "Arrow", vbBlack AddTriAngularPattern "TriAng", vbBlack CC.Rectangle TOf, TOf, TS, TS CC.Fill , Patterns("TriWing") CC.Rectangle TS + 2 * TOf, TOf, TS, TS CC.Fill , Patterns("Arrow") CC.Rectangle 2 * TS + 3 * TOf, TOf, TS, TS CC.Fill , Patterns("TriAng") Path = Replace(WScript.ScriptFullName, WScript.ScriptName, "") CC.Surface.WriteContentToPngFile Path&"Alhambra_Zoom_"&Zoom&".png" End Sub Sub AddTriWingPattern(Key, Color) Dim i, j, n, R, A: Redim P(18 - 1) CC.PushGroup , 0, 0, 78, 136 For j = 1 To 3 For i = 1 To 3 A = 270 * Cairo.PI / 180 For n = 0 To 8 R = Choose(n Mod 3, Array(-10, 55, 45)) A = A + Choose(n Mod 3, Array(5, 45, 70)) * Cairo.PI / 180 P(2 * n + 0) = R * Cos(A): P(2 * n + 1) = R * Sin(A) Next CC.MoveTo P(16), P(17) CC.CurveTo P(0), P(1), P(2), P(3), P(4), P(5) CC.CurveTo P(6), P(7), P(8), P(9), P(10), P(11) CC.CurveTo P(12), P(13), P(14), P(15), P(16), P(17) CC.Fill , Cairo.CreateSolidPatternLng(Color) CC.TranslateDrawings 78, 0 Next CC.TranslateDrawings -78 * (i - 0.5), 68 Next Patterns.Add CC.PopGroup(True, CAIRO_EXTEND_REPEAT), Key End Sub Sub AddArrowPattern(Key, Color) CC.PushGroup , 0, 0, 68, 68 CC.MoveTo 34, 34 CC.RelLineTo 9, 19 CC.LineTo 0, 68 CC.LineTo 0, 0 CC.RelLineTo 17, 42 CC.LineTo 34, 34 CC.RelLineTo -9, -19 CC.LineTo 68, 0 CC.LineTo 68, 68 CC.RelLineTo -17, -42 CC.Fill , Cairo.CreateSolidPatternLng(Color) Patterns.Add CC.PopGroup(True, CAIRO_EXTEND_REFLECT), Key End Sub Sub AddTriAngularPattern(Key, Color) Dim i, j, n, R, A, x, y CC.PushGroup , 0, 0, 78, 136 For j = 1 To 3 For i = 1 To 3 A = 270 * Cairo.PI / 180 For n = 0 To 8 R = Choose(n Mod 3, Array(13, 36, 45)) A = A + Choose(n Mod 3, Array(17, 56, 47)) * Cairo.PI / 180 x = R * Cos(A): y = R * Sin(A) If n = 0 Then CC.MoveTo x, y Else CC.LineTo x, y Next CC.Fill , Cairo.CreateSolidPatternLng(Color) CC.TranslateDrawings 78, 0 Next CC.TranslateDrawings -78 * (i - 0.5), 68 Next Patterns.Add CC.PopGroup(True, CAIRO_EXTEND_REPEAT), Key End Sub Function Choose(Index, Choices) Choose = Choices(Index) End Function