Stores into an array of byte each Blue, Green, Red and Alpha components of the pixel contained into an area of a GdPicture image.
public GdPictureStatus GetPixelArrayByte( int ImageID, ref Byte arPixels, int SrcLeft, int SrcTop, int Width, int Height );
Public Function GetPixelArrayByte( ByVal ImageID As Integer, ByRef arPixels() As Byte, ByVal SrcLeft As Integer, ByVal SrcTop As Integer, ByVal Width As Integer, ByVal Height As Integer ) As GdPictureStatus
|
Parameters |
Description |
|
ImageID |
GdPicture Image Identifier. |
|
arPixels |
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. |
A member of the GdPictureStatus enumeration.
A member of the GdPictureStatus enumeration.
usage of GetPixelArrayByte() and SetPixelArrayByte() functions 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 Dim ImageHeight As Integer Dim ImageWidth As Integer oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a demo or commercial license key ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("image.tif") ImageHeight = oGdPictureImaging.GetHeight(ImageID) ImageWidth = 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 chanel. 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)
|
What do you think about this topic? Send feedback!
|
|
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.
|