L_CanvasBitmap

#include "l_bitmap.h"

L_LTIMGSFX_API L_INT L_CanvasBitmap(pBitmap, pThumbBitmap, uTransparency, uEmboss, nXOffset, nYOffset, uTilesOffset, uFlags)

Combines two bitmaps, superimposing one bitmap on another bitmap that is used like a canvas.

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle that references the bitmap that will be applied to the canvas bitmap.

pBITMAPHANDLE pThumbBitmap

Pointer to the bitmap handle that references the canvas bitmap.

L_UINT uTransparency

The transparency amount between the image and the canvas. Valid range is from 0 to 100. When set to 0, only the canvas image displays, and when set to 100, the canvas image is barely visible.

L_UINT uEmboss

Apparent depth of the canvas image. Valid range is from 0 to 200. When uTransparency is at 100, and uEmboss is 0 only the image displays. Increasing uEmboss increases the apparent depth of the canvas image.

L_INT nXOffset

The X distance between the canvas origin point and the image origin point (in pixels). Valid range is from Canvas bitmap width to +Canvas bitmap width.

L_INT nYOffset

The Y distance between the canvas origin point and the image origin point (in pixels). Valid range is from Canvas bitmap height to +Canvas bitmap height.

L_UINT uTilesOffset

The amount to shift every row of canvas image from the origin. This parameter is not used when uFlags is set to CANVAS_FIT.

L_UINT uFlags

Flags that identifiy how to distribute the canvas image with respect to the image and how to handle resizing. Possible values are:

Value Meaning
Distribution of canvas image with respect to the image:
CANVAS_FIT [0x0000] Fit the canvas image so it has the same dimensions as the bitmap that is being applied to the canvas, without tiling.
CANVAS_SHIFT [0x0010] Shift the canvas image by the amount specified in uTilesOffset.
Resizing method to be used to resize the canvas image to fit the original image:
SIZE_NORMAL [0x0000] Resize normally.
SIZE_RESAMPLE [0x0002] Use linear interpolation and averaging to produce a higher quality image.
SIZE_BICUBIC [0x0004] Use bicubic interpolation and averaging to produce a higher quality image. This is slower than SIZE_RESAMPLE.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

The L_CanvasBitmap function combines two bitmaps, superimposing one bitmap on another bitmap that is used like a canvas.

For an example, click here

Other functions that allow you to combine images include:

For more information on this and other functions that can be used to combine bitmaps, refer to Processing an Image.

This function supports 12- and 16-bit grayscale and 48- and 64-bit color images. Support for 12- and 16-bit grayscale and 48- and 64-bit color images is available in the Document and Medical Imaging toolkits.

To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT CanvasBitmapExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle for the image */ 
   BITMAPHANDLE CanvasBitmap; /*Bitmap handle for the canvas image */ 
   /* Load a bitmap at its own bits per pixel */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("cannon.jpg")), &LeadBitmap, sizeof (BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* Load a bitmap at its own bits per pixel */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ULAY1.bmp")), &CanvasBitmap, sizeof (BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* Apply the Canvas bitmap effect to the image*/ 
   nRet = L_CanvasBitmap(&LeadBitmap, &CanvasBitmap, 100, 100, 0, 0, 10, CANVAS_SHIFT); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   //free bitmap  
   if(LeadBitmap.Flags.Allocated)   
      L_FreeBitmap(&LeadBitmap); 
   if(CanvasBitmap.Flags.Allocated) 
      L_FreeBitmap(&CanvasBitmap); 
   return SUCCESS; 
} 
Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help