Previous Document Next Document

Object Model Reference : Classes : P : PatternCanvas : Methods : PatternCanvas.FlipArea


PatternCanvas.FlipArea

Sub FlipArea(x1 As Long, y1 As Long, x2 As Long, y2 As Long, Axes As cdrFlipAxes)

Description

Member of PatternCanvas

The FlipArea method repositions an area of a pattern canvas, as defined by two coordinates. You can flip the area horizontally or vertically, or both.

Parameter
Description
x1
Specifies the x-coordinate of the first point that defines the area to flip on the pattern canvas. This value is measured in document units.
y1
Specifies the y-coordinate of the first point that defines the area to flip on the pattern canvas. This value is measured in document units.
x2
Specifies the x-coordinate of the second point that defines the area to flip on the pattern canvas. This value is measured in document units.
y2
Specifies the y-coordinate of the second point that defines the area to flip on the pattern canvas. This value is measured in document units.
Axes
Specifies how the area of the pattern canvas is flipped. An area can be flipped horizontally or vertically, or both.

VBA example

The following VBA 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

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.