Previous Document Next Document
PatternCanvas.Pixel

Property Pixel(x As Long, y As Long) As Boolean

Member of PatternCanvas

The Pixel property returns or sets the color of a pixel in a bitmap pattern. If set to True, the pixel represents black. If set to False, the pixel represents white.

This property is equivalent to the Visual Basic PSet command, for changing and reading pixel colors.

Parameters
Description
x
Specifies the horizontal position of a pixel on the pattern canvas. This value is measured in document units.
y
Specifies the vertical position for a pixel on the pattern canvas. This value is measured in document units.

The following code example inverts an existing bitmap pattern and applies both the inverted pattern and the original pattern to a rectangle.

Sub Test() 
 Dim c As New PatternCanvas 
 Dim x As Long, y As Long 
 c.PutCopy PatternCanvases(8) 
 For x = 0 To c.Width - 1 
  For y = 0 To c.Height - 1 
   c.Pixel(x, y) = Not c.Pixel(x, y) 
  Next y 
 Next x 
 With ActiveLayer.CreateRectangle(0, 0, 3, 3) 
  .Fill.ApplyPatternFill cdrTwoColorPattern, , 8 
 End With 
 With ActiveLayer.CreateRectangle(3, 0, 6, 3) 
  .Fill.ApplyPatternFill cdrTwoColorPattern 
  .Fill.Pattern.Canvas = c 
 End With 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.