![]() |
![]() |
PatternCanvas.FlipArea
Sub FlipArea(x1 As Long, y1 As Long, x2 As Long, y2 As Long, Axes As cdrFlipAxes)
Member of PatternCanvas
The FlipArea method repositions an area of a pattern canvas, defined by two coordinates. You can flip the area horizontally or vertically, or both.
The following code example creates a pattern that uses the Mandelbrot set. The set is built only in the upper half of the complex plane, while the other half is a flipped duplicate.
Sub Test() Dim c As New PatternCanvas Dim nx As Long, ny As Long Dim cx As Double, cy As Double Dim zx As Double, zy As Double, zz As Double Dim n As Long c.Height = 256 c.Width = 256 For nx = 0 To 255 cx = nx / 100 - 2 For ny = 0 To 127 cy = 1.27 - ny / 100 zx = 0: zy = 0: n = 0 While n < 10 And zx * zx + zy * zx < 4 zz = zx * zx - zy * zy + cx zy = 2 * zx * zy + cy zx = zz n = n + 1 Wend c.PSet (nx, ny), (n < 10) Next ny Next nx c.CopyArea 0, 0, 255, 127, 0, 128 ' Since the axes are mixed up, ' as a workaround, the following ' command should be called with ' cdrFlipVertical as the last parameter: c.FlipArea 0, 128, 255, 255, cdrFlipHorizontal With ActiveLayer.CreateRectangle(0, 0, 2, 2) .Fill.ApplyPatternFill cdrTwoColorPattern .Fill.Pattern.Canvas = c End With End Sub
![]() |
![]() |
![]() |
Copyright 2007 Corel Corporation. All rights reserved.