LBitmap::ColoredPencilExt

Summary

Applies an effect to a bitmap that makes it look like it has been drawn with colored pencils.

Syntax

#include "ltwrappr.h"

L_INT LBitmap::ColoredPencilExt(uSize, uStrength, uThreshold, uPencilRoughness, uStrokeLength, uPaperRoughness, nAngle, uFlags)

Parameters

L_UINT uSize

Size of the neighborhood used to determine the width of the outlines.

L_UINT uStrength

Strength factor used to create the "outline". This can be any number that is 0 or greater.

L_UINT uThreshold

Threshold value used to determine which pixels are edge pixels (outlines). If the difference determined for a pixel is greater than this value, the pixel is an edge pixel. Valid values ranges are:

Use this parameter to control the number of edge pixels found.

L_UINT uPencilRoughness

Percentage of coloring coverage (colored pencil roughness), expressed in tenths of a percent. Valid values are 0 to 1000.

L_UINT uStrokeLength

Length of the colored pencil stroke, in pixels.

L_UINT uPaperRoughness

Percentage of paper surface roughness, expressed in tenths of a percent. Valid values are 0 to 1000.

L_INT nAngle

Value that represents the direction of the coloring motion, in hundredths of a degree (+/-) This value can be a number from -18000 to 18000. This parameter is ignored when uColoringType = ARTISTIC_COLOREDPENCIL.

L_UINT uFlags

Flags that determine which the type of direction to use and whether to combine the resulted bitmap with the original one or not. You can specify one flag or combine both groups of flags by using a bitwise OR ( | ).

The following flags indicate which type of direction to use:

Value Meaning
ARTISTIC_COLOREDPENCIL [0x01] The coloring is more artistic, since no certain direction dominates the whole image.
DIRECTIONAL_COLOREDPENCIL [0x02] The coloring motion is directed in a certain direction determined by the nAngle value.

The following flag indicates whether to combine the resulted bitmap with the original one, if you do not want to use combine just ignore this group.

Value Meaning
COMBINE_ORIGINAL [0x10] Combines the resulted bitmap with the original one.

Returns

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

Comments

This function applies an effect to a bitmap that makes it look like it has been drawn with colored pencils.

For an example, click here

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 only in the Document/Medical toolkits.

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

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.

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.

Advanced Colored Pencil Function - Before

Advanced Colored Pencil Function - Before

Advanced Colored Pencil Function - After

Advanced Colored Pencil Function - After

View additional platform support for this Advanced Colored Pencil function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

The following example loads a bitmap and applies the colored pencil extended effect:
Load the bitmap, keeping the bits per pixel of the file

L_INT LBitmap__ColoredPencilExtExample() 
{ 
   L_INT nRet; 
   LBitmap LeadBitmap;  
 
   nRet =LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet =LeadBitmap.ColoredPencilExt(5, 4, 0, 250, 15, 100, 0, ARTISTIC_COLOREDPENCIL); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.