ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Drawing functions
  • Zoom on an image
  • Drawing in PHP
  • Drawing in Browser code
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Warning
From version 28 (66), dCopyBlt is kept for backward compatibility. This function has been replaced with dCopyImage.
are replaced with:
Copies an image:
  • from an Image control to another Image control.
  • in a variable of type Image.
    WEBDEV - Browser codePHP This type of variable is not available.
AndroidJava Only the first syntax can be used with the Image type.
// Copie simple du contenu du champ Image "IMG_ImageDessin"
// dans le champ Image "IMG_ImageCopie"
ResCopie = dCopyImage(IMG_ImageDessin, IMG_ImageCopie)
WINDEVReports and QueriesUser code (UMC)
// Copie de l'image de l'écran dans un champ Image
dCopyImage(copyScreen, IMG_MonImage)
Syntax

Copying images from Image controls Hide the details

<Result> = dCopyImage(<Source image control> , <Destination Image control> [, <Copy mode> [, <Source image X-coordinate> [, <Source image Y-coordinate> [, <Source image height> [, <Source image width> [, <Destination image X-coordinate> [, <Destination image Y-coordinate> [, <Destination image height> [, <Destination image width>]]]]]]]]])
<Result>: Boolean
  • True if the image was copied,
  • False otherwise.
Note: The dCopyImage function may return False if the screen driver does not support this function.. In this case, a message is displayed in the copied image. We recommend that you update your screen driver in order to get the proper behavior.
<Source image control>: Control name
Name of the source Image control to be used.
To perform a Hard Copy , use the constant copieEcran: the entire screen content is copied..
WEBDEV - Server codeWEBDEV - Browser code The copyScreen constant is not available. The image to copy must necessarily be found in an Image control and it must be a generated image.
Android The copyScreen constant is not available.
AndroidJava This parameter can correspond to:
  • the name of an Image control,
  • the name of a variable of type Image.
<Destination Image control>: Control name
Name of the destination Image control the image will be copied to.
AndroidJava This parameter can correspond to:
  • the name of an Image control,
  • the name of a variable of type Image.
WEBDEV - Server codeWEBDEV - Browser code The destination Image control must contain a generated image.
<Copy mode>: Optional constant
Copy mode to be used.
copyBlacknessFills the destination Image control with black.
AndroidJava This constant is not available.
copyDstInvertInverts the colors of the destination Image control.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copyImageCombines the source image with the destination image using the transparency information of the destination image
Can be used to include a logo in the destination image for example.
Note: Size and position in the source are not taken into account. No homothety and no zoom are allowed in this mode.
iPhone/iPadIOS WidgetMac Catalyst This constant is not available.
copyMergeCopyMerges the source Image control and the destination Image control.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copyMergePaintCombines the source Image control with the "pattern" of the destination Image control via the "Logical AND" method.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copyNotSrcCopyInverts the colors of the source Image control.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copyNotSrcEraseInverts the combination between the source and the destination Image controls via the "OR" method.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copyPatCopyCopies the "pattern" from the source Image control to the destination Image control.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copyPatInvertCombines the pattern of the source and destination Image controls via the "XOR" (Exclusive Or) method. The current brush, defined by dBackground, is used.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copyPatPaintCombines the inverted source Image control with the "pattern" of the destination Image control via the "OR" method.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copySrcAndCombines the pixels of the source and destination Image controls via the "AND" method.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copySrcCopy
(Default value)
Copies the source Image control to the destination Image control (simple copy).
copySrcEraseInverts the destination Image control and combines the result with the copy of the source Image control.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copySrcInvertCombines the pixels of the source and destination Image controls via the "XOR" (Exclusive Or) method.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copySrcPaintCombines the pixels of the source and destination Image controls via the "OR" method.
AndroidiPhone/iPadIOS WidgetMac CatalystJava This constant is not available.
copyWhitenessFills the destination Image control with white.
AndroidJava This constant is not available.
<Source image X-coordinate>: Optional integer
X-coordinate (in pixels) of the upper-left corner of the area to copy (upper-left corner of the source Image control by default).
<Source image Y-coordinate>: Optional integer
Y-coordinate (in pixels) of the upper-left corner of the area to copy (upper-left corner of the source Image control by default).
<Source image height>: Optional integer
Height (in pixels) of the area to copy (height of the source Image control by default).
<Source image width>: Optional integer
Width (in pixels) of the area to copy (width of the source Image control by default).
<Destination image X-coordinate>: Optional integer
X-coordinate (in pixels) of the upper-left corner of the copy destination area (upper-left corner of the destination Image control by default).
<Destination image Y-coordinate>: Optional integer
Y-coordinate (in pixels) of the upper-left corner of the copy destination area (upper-left corner of the destination Image control by default).
<Destination image height>: Optional integer
Height (in pixels) of the area the image will be copied to (height of the destination Image control by default). If this height is greater than the height of the source image, the image will be enlarged when copied.
<Destination image width>: Optional integer
Width (in pixels) of the area the image will be copied to (width of the destination Image control by default). If this width is greater than the width of the source image, the image will be enlarged when copied.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadIOS WidgetMac CatalystUser code (UMC)

Copying the images found in the Image variables Hide the details

<Result> = dCopyImage(<Source image name> , <Destination image name> [, <Source image X-coordinate> [, <Source image Y-coordinate> [, <Source image height> [, <Source image width> [, <Destination image X-coordinate> [, <Destination image Y-coordinate> [, <Destination image height> [, <Destination image width>]]]]]]]])
<Result>: Boolean
  • True if the image was copied,
  • False otherwise.
Note: The dCopyImage function may return False if the screen driver does not support this function.. In this case, a message is displayed in the copied image. We recommend that you update your screen driver in order to get the proper behavior.
<Source image name>: Image variable
Name of the Image variable to be used. This image is the source image.
<Destination image name>: Image variable
Name of the Image variable the image will be copied to.
<Source image X-coordinate>: Optional integer
X-coordinate (in pixels) of the upper-left corner of the area to copy (upper-left corner of the source image by default).
<Source image Y-coordinate>: Optional integer
Y-coordinate (in pixels) of the upper-left corner of the area to copy (upper-left corner of the source image by default).
<Source image height>: Optional integer
Height (in pixels) of the area to copy (height of the source image by default).
<Source image width>: Optional integer
Width (in pixels) of the area to copy (width of the source image by default).
<Destination image X-coordinate>: Optional integer
X-coordinate (in pixels) of the upper-left corner of the copy destination area (upper-left corner of the destination image by default).
<Destination image Y-coordinate>: Optional integer
Y-coordinate (in pixels) of the upper-left corner of the copy destination area (upper-left corner of the destination image by default).
<Destination image height>: Optional integer
Height (in pixels) of the area the image will be copied to (height of the destination image by default). If this height is greater than the height of the source image, the image will be enlarged when copied.
<Destination image width>: Optional integer
Width (in pixels) of the area the image will be copied to (width of the destination image by default). If this width is greater than the width of the source image, the image will be enlarged when copied.
Remarks

Zoom on an image

During a copy, you can enlarge or reduce a section of the source image when copying it to the destination image. To do so:
  • Define the area to enlarge (or reduce) in the source image (with the <Source image X-coordinate>, <Source image Y-coordinate>, <Source image height> and <Source image width> parameters),
  • Define the display area of the result image. This area must be larger to enlarge the image and smaller to reduce the image. By default, the entire destination image is taken into account. Use <Destination image X-coordinate>, <Destination image Y-coordinate>, <Destination image height> and <Destination image width> if necessary.
The zoom percentage depends on the multiplying coefficient between the dimensions of the two areas.
For example:
1. The area to zoom is included in a rectangle whose width is set to 30 pixels and whose height is set to 40 pixels.2. To zoom in by 200%, the destination area must be twice as large as the source area: a rectangle 60 pixels wide and 80 pixels high.
area to zoom in
zoomed area
In this case, the following line of code is used to perform the zoom operation during the copy:
dCopyImage(IMG_ChampSource, IMG_ChampDestination, copySrcCopy, 10, 10, 30, 40, 10, 10, 60, 80)
PHP

Drawing in PHP

In PHP, the drawing functions are based on the graphic library GD. This library is commonly used by the PHP hosting providers and therefore it is always enabled. The version of the GD library must be version 2.0.28 (or later). This library can be downloaded from the PHP site.
To enable (if necessary) this library locally, the following elements are required:
  • PHP installed.
  • the PHP.INI file found in the Windows directory must contain the following line: "extension=php_gd2.dll" (instead of ";extension=php_gd2.dll").
  • the php_gd2.dll file must exist in the directory of PHP extensions. This directory is defined in the PHP.INI file by the "extension_dir" variable.
WEBDEV - Browser code

Drawing in Browser code

Some drawing functions are available in Browser code. The drawing functions in Browser code are based on the HTML 5 standard. More specifically, these functions are based on the "canvas" tag of HTML 5.
The drawing features in browser code are available for the recent browsers only (supporting the HTML 5 standard). To find out whether the drawing features are proposed by your browser, use DrawingAvailable.
Attention: To use the drawing functions with Internet Explorer 9, the project must include the reference to the DTD file. To do so, the HTML mode must be "HTML 4.01 Transitional + DTD". This option is available in the "Advanced" tab of the project description window.
Reminder: To display the project description window, under the "Project" pane, in the "Project" group, click on "Description".
Special case: Drawing in the browser of an Android phone: Browser drawing functions are only available in Android version 3 and higher..
Component: wd300obj.dll
}}
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/24/2024

Send a report | Local help