PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Properties specific to the description of Image variables
  • Accessing the pixels
  • Managing the Alpha layer
  • Image variable and Image control
  • Image variable and debugger
  • Creating an image with a specific size
  • Functions that handle the Image variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
The Image type is used to define the advanced characteristics of an image. The characteristics of this image can be defined and modified by several WLanguage properties.
Note: See Declaring a variable for more details.
Versions 18 and later
Java This type of variable is now available for the Java applications.
Android This type of variable is now available for the Android applications.
Universal Windows 10 App This type of variable is now available in Windows Store apps mode.
New in version 18
Java This type of variable is now available for the Java applications.
Android This type of variable is now available for the Android applications.
Universal Windows 10 App This type of variable is now available in Windows Store apps mode.
Java This type of variable is now available for the Java applications.
Android This type of variable is now available for the Android applications.
Universal Windows 10 App This type of variable is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Example
MyImage is Image
// Load from a file
MyImage = dLoadImage("image.png")
// Equivalent syntaxes
// MyImage = "image.png"
// MyImage..Image = "image.png"

// Draw in the image
dStartDrawing(MyImage)

// Write a text
dFont("Arial", 12, iNormal, 0)
dText(4, 0, "I am writing my text in an Image control!")

// Resize
dResize(MyImage, 100, 100)

// End of drawing
dEndDrawing(MyImage)

// Assign to an Image control
IMG_ImageControl = MyImage
Remarks

Properties specific to the description of Image variables

The following properties can be used to handle an Image variable:
Property nameType usedEffect
WithAlphaBooleanUsed to find out whether the image contains an alpha layer:
  • True if the image contains an alpha layer,
  • False otherwise.
This property is available in read-only.
BitPerPixelIntegerNumber of bits per pixel.
This property is available in read-only.
FillColorColor variableFill color of the image. This color is used:
  • when resizing the image (..Height and ..Width)
  • when turning the image around (dRotation).
Versions 21 and later
DrawingScale
New in version 21
DrawingScale
DrawingScale
RealScale that will be used for the drawing functions (dXXX functions): the coordinates used by these functions will be multiplied by this value.
Java This property is not available.
EXIF[Exif tag]Associative arrayUsed to find out the content of the specified Exif tag.
..Empty is used to find out whether the content of the Exif tag is empty or not. For example:
IF not MyImage..EXIF[320]..Empty THEN
IsTagValue = MyImage..EXIF[320]
END
The Exif Tags that can be used are the ones listed in the documentation of ImageInfoValue.
This property is available in read-only.
AndroidiPhone/iPadJava This property is not available.
HeightIntegerHeight of image in pixels.
If this property is modified, the image is not deformed: additional pixels are added. The color of these pixels is defined by ..FillColor.
ImageAll typesUsed to load an image from a buffer, a file or a memo. This property is equivalent to dLoadImage.
Notes:
  • In read mode, this property returns a buffer containing the image in PNG format.
  • The images in SVG or PDF format are not supported. To manage these formats, you must use dLoadImage.
  • The animated images are not supported.
  • A single page of multi-page images (TIF, ICO) can be loaded. Only the first page is loaded.
  • Versions 19 and later
    You have the ability to draw a chart in an Image variable via grDestinationImage.
    New in version 19
    You have the ability to draw a chart in an Image variable via grDestinationImage.
    You have the ability to draw a chart in an Image variable via grDestinationImage.
iPhone/iPad The ICO format is not supported by iOS.
WidthIntegerWidth of image in pixels.
If this property is modified, the image is not deformed: additional pixels are added. The color of these pixels is defined by ..FillColor.
Pixel[x,y]Array of ColorUsed to handle the pixels of the image.
ValidateBooleanReturns the validity of the image:
  • True if the image is valid: it was successfully loaded or created.
  • False otherwise.
This property is available in read-only.

Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

Accessing the pixels

To access the pixels of the image, you have the ability to use the following syntax:
<Name of Image Variable>[<Horizontal Coordinate>, <Vertical Coordinate>]
The origin of the coordinates is (0,0).
For example:
// Modify the pixel at coordinates 220,300
MyImage[220,300] = LightYellow
You also have the ability to use the Color properties. For example:
MyImage[220,300]..Lightness = MyImage[220,300]..Lightness + 10

Managing the Alpha layer

An image contains an Alpha layer in the following cases:
  • if it was created by default with an alpha layer, specified by ..FillColor.
  • if it was loaded from an image format containing an alpha layer (PNG format for example).
You also have the ability to handle the Alpha layer of the image by handling its pixels.

Image variable and Image control

You can:
  • assign an Image variable to an Image control.
  • assign an Image control to an Image variable.
These operations are available for the Image controls found in the window editor, page editor and report editor.

Image variable and debugger

The content of an Image variable can be viewed in the debugger.

Creating an image with a specific size

To create an image with a specific size, all you have to do is use ..Width and ..Height.
For example:
MyImage is Image
MyImage..Width = 10
MyImage..Height = 10
The unit used is the pixel.
The following code creates an image of 0 x 0.
MyImage is Image

Functions that handle the Image variables

Versions 18 and later
dCopy
New in version 18
dCopy
dCopy
Copies an image into another image.
Versions 09 and later
dCopyBlt
New in version 09
dCopyBlt
dCopyBlt
Copies an image
  • from an Image control into another Image control.
  • from an Image variable into another Image variable
Versions 17 and later
dCopyScreenImage
New in version 17
dCopyScreenImage
dCopyScreenImage
Copies the screen content into an Image variable or into an Image control.
Versions 17 and later
dCopyWindowImage
New in version 17
dCopyWindowImage
dCopyWindowImage
Copies the image from a WINDEV window into an Image variable or into an Image control.
Versions 17 and later
dCrop
New in version 17
dCrop
dCrop
Returns the cropped part of an image. This image is found in an Image variable
Versions 17 and later
dEncrustColor
New in version 17
dEncrustColor
dEncrustColor
Encrusts a color in an image found in an Image variable].
Versions 17 and later
dHalo
New in version 17
dHalo
dHalo
Adds a halo effect on an image found in an Image variable].
Versions 17 and later
dLoadImage
New in version 17
dLoadImage
dLoadImage
Loads an image in an Image variable from a memo, a file or a binary buffer.
Versions 17 and later
dShadow
New in version 17
dShadow
dShadow
Adds a shadow effect on an image found in an Image variable].
Versions 17 and later
dTransferToImage
New in version 17
dTransferToImage
dTransferToImage
Creates an image from a buffer of pixels encoded in a specific format This function is an advanced function. This function is mainly used to handle the images returned by external APIs via Image variables
Versions 19 and later
grDestinationImage
New in version 19
grDestinationImage
grDestinationImage
Defines an Image variable as destination of a chart.
Versions 09 and later
iImageHeight
New in version 09
iImageHeight
iImageHeight
Calculates the height of the image to print (in millimeters).
Versions 09 and later
iImageWidth
New in version 09
iImageWidth
iImageWidth
Calculates the width of the image to print (in millimeters).
Versions 09 and later
iPrintImage
New in version 09
iPrintImage
iPrintImage
Sends the image file to print to the print buffer.
Minimum required version
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment