|
|
|
|
|
- Properties specific to Image variables
- Accessing the pixels
- Managing the Alpha channel
- Image variable and Image control
- Image variable and debugger
- Creating an image with a specific size
- Available EXIF tags
- Functions that use Image variables
- Functions (prefix syntax) that handle Image variables
Image (Type of variable) In french: Image
The Image type is used to define the advanced characteristics of an image. The characteristics of this image can be defined and changed using different WLanguage properties. Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
MyImage is Image MyImage.Width = 500 MyImage.Height = 100 // 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, "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 Image variables The following properties can be used to handle Image variables: | | | Property name | Type used | Effect |
---|
BitPerPixel | Integer | Number of bits per pixel. This property is read-only. | DrawingScale | Real | Scale that will be used for the drawing functions (dXXX functions): the coordinates used by these functions will be multiplied by this value. | EXIF[Exif tag] | Associative array | Allows you to get and change the content of the specified Exif tag. Modified Exif tags can be saved using dSaveImageJPEG with the imgSaveTag constant. The Empty property is used to determine if the content of the Exif tag is empty. For example: MyImage is Image ... IF NOT MyImage.EXIF[320]..Empty THEN IsTagValue = MyImage.EXIF[320] END
The available Exif tags are listed in the Remarks. | FillColor | Color variable | Fill color of the image. This color is used: - when the image is resized (Height and Width properties).
- when turning the image around (dRotation).
| Height | Integer | Image height in pixels. If this property is modified, the image is not deformed: additional pixels are added. The color of these pixels is defined with the FillColor property. | Image | All types | Used to load an image from a buffer, a file or a memo. This property is equivalent to dLoadImage. Remarks: - 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.
- You have the ability to draw a chart in an Image variable via grDestinationImage.
| Pixel[x,y] | Array of Color | Used to handle the pixels of the image. | Valid | Boolean | Returns the validity of the image: - True if the image is valid: it was successfully loaded or created.
- False otherwise.
This property is read-only. | Width | Integer | Image width in pixels. If this property is modified, the image is not deformed: additional pixels are added. The color of these pixels is defined with the FillColor property. | WithAlpha | Boolean | Used to find out whether the image contains an alpha channel: - True if the image contains an alpha channel,
- False otherwise.
This property is read-only. |
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 channel An image contains an Alpha channel in the following cases: - if it was created by default with an alpha channel, specified with the FillColor property.
- if it was loaded from an image format containing an alpha channel (PNG format for example).
You can also handle the Alpha channel 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. Available EXIF tags The table below lists the Exif tag values and the corresponding constants:
| | | Tag | WLanguage constant | Value |
---|
37510 | imgComment | Character string Comments about the image | 37122 | imgCompression | Real Compression of the image in bits/pixel | 33432 | imgCopyright | Character string Copyright of the image | 306 | imgDate | Date Date and time of the image in YYYY:MM:DD HH:MM:SS format | 270 | imgDescription | Character string Image description | 37382 | imgSubjectDistance | Real Distance from the subject in meters | 37380 | imgExposureBias | Real Exposure bias in APEX | 37385 | imgFlash | Integer Status of the flash during the shot:- 0: Flash off.
- 1: Flash on.
- 5: Flash on and light not detected.
- 7: Flash on and light detected.
| 928 | imgHeight | Integer Height of image in pixels | 672 | imgWidth | Integer Width of image in pixels | 305 | imgRecordingSoftware | Character string Name of the software that was used to record the image. | 37386 | imgFocalLength | Real Focal length in millimeters | 37379 | imgBrightness | Real Brightness of the image in APEX | 271 | imgDeviceMark | Character string Mark of the camera that took the photo | 272 | imgDeviceModel | Character string Model of camera that took the photo | 37383 | imgMeteringMode | Integer Metering mode:- 0: unknown.
- 1: average.
- 2: average centered.
- 3: point.
- 4: multidot.
- 5: pattern.
- 6: partial.
- 7 to 254: reserved.
- 255: other.
| 37500 | imgManufacturerNote | Character string Name of the camera manufacturer | 274 | imgOrientation | Integer Orientation of the image: This information indicates the location of the point (0,0) in the image. To display the image in the correct direction based on this information, use the following values:- 1: the point (0,0) is at the top left, there is nothing to do.
- 2: the point (0,0) is at the top right, the image must be flipped horizontally.
- 3: the point (0,0) is at the bottom right, the image must be flipped horizontally and vertically.
- 4: the point (0,0) is at the bottom left, the image must be flipped horizontally.
- 5: the point (0,0) is at the top left, the image must be flipped horizontally and rotated 90°.
- 6: the point (0,0) is at the top right, the image must be rotated 90°.
- 7: the point (0,0) is at the bottom left, the image must be flipped vertically and rotated 90°.
- 8: the point (0,0) is at the bottom right, the image must be rotated -90°.
| 37378 | imgAperture | Real Aperture in APEX | 33437 | imgFAperture | Real Focal | 37381 | imgMaxAperture | Real Maximum aperture in APEX | 34850 | imgExposureProgram | Integer Exposure mode used during the shot:- 0: undefined.
- 1: manual.
- 2: normal.
- 3: priority to aperture.
- 4: priority to speed.
- 5: creation.
- 6: action.
- 7: close-up portrait without background.
- 8: landscape.
- 9 to 255: others.
| 282 | imgXResolution | Real Horizontal resolution of the image | 283 | imgYResolution | Real Vertical resolution of the image | 37384 | imgLightSource | Integer Light source for the image:- 0: unknown.
- 1: daylight.
- 2: fluorescent.
- 3: tungsten.
- 17: standard light A.
- 18: standard light B.
- 19: standard light C.
- 20: D55.
- 21: D65.
- 22: D75.
- 23 to 254: reserved.
- 255: other.
| 33434 | imgExposureTime | Real Exposure time | 296 | imgResolutionUnit | Integer Unit for the horizontal and vertical resolution of the image: - 2: inches.
- 3: centimeters.
| 36864 | imgEXIFVersion | Character string Version of Exif information | 65536 | imgThumbnail | Binary string Thumbnail corresponding to the image | 37377 | imgShutterSpeed | Real Shutter speed in APEX |
Other tags are also available. These unlisted tags are specific to some types of cameras or correspond to custom tags. Functions that use Image variables | | AlbumSave | Saves an image, a photo or a video in the photo album of the mobile device. | BCToImage | Generates the image of a bar code. | Clipboard | Retrieves the text or image found in the system clipboard. | dAlphaBlend | Blends two images together. This allows you to create fade-in effects between 2 images. | dArc | Draws an arc of circle or an arc of ellipse: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dBackground | Declares the default background color for the rectangles, circles, etc.:: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dBlur | Blurs the entire given area: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dBorder | Draws the borders. | dChangeMode | Changes the drawing mode used by the drawing functions (dLine, dRectangle, ....). | dChord | Draws the chord of a circle (intersection between an ellipse and a straight line): - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dCircle | Draws a circle or an ellipse: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dCopieImageChamp | Copies the image of a control in a WINDEV window to a variable of type Image. | dCopy | Copies an image to another image. | dCopyImage | Copies an image: - from an Image control to another Image control.
- from an Image variable to another Image variable.
| dCopyScreenImage | Copies the screen content to an Image variable or to an Image control. | dCopyWindowImage | Copies the image from a WINDEV window to an Image variable or to an Image control. | dCrop | Returns the cropped part of an image. This image is in an Image variable. | dDominantImageColor | Returns the dominant (i.e. most frequent) color of an image in an Image variable or in an Image control. | dEncrustColor | Encrusts a color in an image found in an Image variable]. | dEndDrawing | Deletes all the drawings made since the last call to dStartDrawing. | dFill | Colors an area: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dFont | Declares the font that will be used by dText: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dHalo | Adds a halo effect on an image found in an Image variable]. | dHorizontalSymmetry | Flips an image with respect to a horizontal axis (symmetry with respect to a horizontal axis). | DiagramToImage | Exports a diagram to a variable of type Image. | dInvertColor | Inverts the colors: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dLine | Draws a line: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dLoadImage | Loads an image in an Image variable from a memo, a file or a binary buffer. | dModifyHSL | Modifies the hue, the saturation and the lightness of an image found: - in an Image control,
- in an Image variable.
| dModifyHue | Changes the hue of an image: - in an Image control,
- in an Image variable.
| dModifyLightness | Changes the lightness of an image found: - in an Image control,
- in an Image variable.
| dModifyOpacity | Modifies the opacity of an image (which means the alpha channel of the image). | dModifySaturation | Modifies the saturation of an image found: - in an Image control,
- in an Image variable.
| DocAdd | Adds: - at the end of a Word Processing document: an element, a document, a paragraph, a text, an image or a fragment.
- at the end of a fragment: an element, a text or an image.
| DocInsert | Inserts an object into a Word Processing document or replaces the content of the current fragment. The objects that can be used are: - an element,
- a document,
- a paragraph,
- a text,
- an image,
- a fragment.
| DocToImage | Exports a page found in a Word Processing document in image format. | dPen | Declares the default color and style for the lines, rectangles, circles, ... found: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dPixelColor | Identifies the color of a pixel: | dPixelOpacity | Identifies the opacity of a pixel in an image that has an Alpha channel. This image can be: - an Image control,
- an Image variable,
- a WDPic variable (on the background layer),
- a picLayer variable.
| dPoint | Draws a point: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dPolygon | Draws a polygon: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dPolyline | Draws a line composed of multiple segments. | dRectangle | Draws a rectangle: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dRectangleGradient | Draws a rectangle: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dResize | Resizes an image: - in an Image control.
- in an Image variable.
- in a picLayer variable].
| dRotation | Performs a rotation: | dRoundedRectangle | Draws a rounded rectangle:- in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dSaveImageBMP | Saves an image:- in a file in BMP format.
- in memory.
| dSaveImageGIF | Saves an image:- in a file in GIF format.
- in memory.
| dSaveImageJPEG | Saves an image:- in a JPEG file.
- in memory.
| dSaveImagePNG | Saves an image: | dShadow | Adds a shadow effect on an image found in an Image variable]. | dSlice | Draws a circle section or an ellipse section: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dStartDrawing | Indicates that the drawing functions that will be used are intended for: - the specified Image control,
- the specified Image variable,
- the specified Image variable,
- the specified WDPic variable (on the background layer),
- the specified picLayer variable.
| dText | Draws a text: - in an Image control,
- in an Image variable,
- in a WDPic variable (on the background layer),
- in a picLayer variable.
| dTextRTF | Draws RTF text:- in an Image control,
- in an Image variable.
| 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. | dVerticalSymmetry | Flips an image with respect to a vertical axis (symmetry with respect to a vertical axis). | grDestinationImage | Defines an Image variable as destination of a chart. | grSaveImage | Saves the image of a chart in an Image variable. | iImageHeight | Calculates the height of the image to print (in millimeters). | iImageWidth | Calculates the width of the image to print (in millimeters). | iPrintImage | Sends the image file to print to the print buffer. | PDFExtractPage | Extracts a page from a PDF file in a variable of type Image. | ToClipboard | Writes text or image information into the system clipboard. |
Functions (prefix syntax) that handle Image variables
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|