GdPicture.NET Reference Guide
GetPixelArrayByte Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : GetPixelArrayByte Method
GdPicture Image Identifier.
Output parameter. Array of pixel data.
The left source pixel of the area.
The top source pixel of the area.
The width of the area in pixel.
The height of the area in pixel.
Stores into an array of byte each Blue, Green, Red and Alpha components of the pixel contained into an area of a GdPicture image.
Syntax
'Declaration
 
Public Function GetPixelArrayByte( _
   ByVal ImageID As Integer, _
   ByRef Data As Byte(), _
   ByVal SrcLeft As Integer, _
   ByVal SrcTop As Integer, _
   ByVal Width As Integer, _
   ByVal Height As Integer _
) As GdPictureStatus
public GdPictureStatus GetPixelArrayByte( 
   int ImageID,
   ref byte[] Data,
   int SrcLeft,
   int SrcTop,
   int Width,
   int Height
)
public function GetPixelArrayByte( 
    ImageID: Integer;
   var  Data: array of Byte;
    SrcLeft: Integer;
    SrcTop: Integer;
    Width: Integer;
    Height: Integer
): GdPictureStatus; 
public function GetPixelArrayByte( 
   ImageID : int,
   Data : byte[],
   SrcLeft : int,
   SrcTop : int,
   Width : int,
   Height : int
) : GdPictureStatus;
public: GdPictureStatus GetPixelArrayByte( 
   int ImageID,
   ref byte[] Data,
   int SrcLeft,
   int SrcTop,
   int Width,
   int Height
) 

Parameters

ImageID
GdPicture Image Identifier.
Data
Output parameter. Array of pixel data.
SrcLeft
The left source pixel of the area.
SrcTop
The top source pixel of the area.
Width
The width of the area in pixel.
Height
The height of the area in pixel.

Return Value

A member of the GdPictureStatus enumeration. A member of the GdPictureStatus enumeration.
Example
Usage of GetPixelArrayByte() and SetPixelArrayByte() methods to apply negative effect on a GdPicture image
Dim oGdPictureImaging As New GdPictureImaging
Dim arPixel() As Byte
Dim X As Integer
Dim Y As Integer
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("image.tif")
Dim ImageHeight As Integer = oGdPictureImaging.GetHeight(ImageID)
Dim ImageWidth As Integer = oGdPictureImaging.GetWidth(ImageID)
ReDim arPixel(ImageWidth * ImageHeight * 4)
oGdPictureImaging.GetPixelArrayByte(ImageID, arPixel, 0, 0, ImageWidth, ImageHeight)
For X = 0 To ImageWidth - 1
   For Y = 0 To ImageHeight - 1
      arPixel((Y * 4 * ImageWidth) + X * 4) = Not arPixel((Y * 4 * ImageWidth) + X * 4) 'Blue channel
      arPixel((Y * 4 * ImageWidth) + X * 4 + 1) = Not arPixel((Y * 4 * ImageWidth) + X * 4 + 1) 'Green channel
      arPixel((Y * 4 * ImageWidth) + X * 4 + 2) = Not arPixel((Y * 4 * ImageWidth) + X * 4 + 2) 'Red channel
      arPixel((Y * 4 * ImageWidth) + X * 4 + 3) = 255 'Alpha channel. Set 255 for full opacity
   Next Y
Next X
oGdPictureImaging.SetPixelArrayByte(ImageID, arPixel, 0, 0, ImageWidth, ImageHeight)
oGdPictureImaging.SaveAsTIFF(ImageID, "imageneg.tif", TiffCompression.TiffCompressionAUTO)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
SetPixelArrayByte Method