CImage:Imbed
The Imbed method pastes an image into the current image. The second image is imbedded at coordinate offsets that are integral values. If fractional pixel positioning is needed, first use Shift on the imbedding image to adjust the fractional pixel offsets to integral offests, then use Imbed with full pixel offsets. This method has two forms: one for an opaque imbedding, and the other for a transparent imbedding that combines the values from both images.
bResult = CImage:Imbed( CImage2, nColMin, nRowMin ) bResult = CImage:Imbed( CImage2, nColMin, nRowMin, nTransparency ) |
CImage2 is another CImage to be imbedded into the current one.
nColMin and nRowMin are the integral (column, row) offsets to the corner where CImage2 is to be imbedded.
nTransparency is a percent transparency of the current image, between 0 and 100.
On success, this method returns true.
On failure, this method returns false.
This method imbeds a second image (the CImage2 parameter) into the current CImage object. The current CImage object is therefore a a background, or "canvas", into which the second image is pasted. The imbedding can be either opaque or transparent. If no transparency value is specified, an opaque insertion is done—that is, the second image replaces the current image underneath it.
The nTransparency parameter specifies the percent transparent of the current (background) image. This applies only over the region where the two images overlap. To describe transparent imbedding mathematically, consider imbedding image II into the current image IBG which acts as the background. Converting nTransparency from percentage T to a decimal value t, we have the following equation for the intensity of the final imageI:
For example, if nTransparency = 25, then the current image is only 25% transparent, and the resulting image contains 75% of the current image. By this definition, the opaque mode corresponds to a transparency of 100 percent, in which the current image is totally transparent and is replaced by the imbedding image.
The insertion point is determined by coordinate offsets applied to the origin ("corner") of the second image. Setting dx=0, dy=0 imbeds the CImage2 into the current image with the two origins aligned. Setting dx=400, dy=100 imbeds CImage2 so that its corner is shifted (400,100) pixels relative to the current image. In this case, since image coordinates are measured relative to (1,1), the corner of CImage2 will appear at coordinate (401,101) in the current image
Suppose that a CImage I and a second CImage I2 exist. The following script imbeds I2 into the current image I1. The imbedding corner is at (100,250) in image I, and the pixel values are merged with 50% transparency:
|
-- position the corner of I2 at these offsets in I |
|
-- imbed I2 into I at corner (100,250) |
CImage class, CRect class, Expand, CImage:TableToRect
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.