L_ColoredPencilBitmapExt

#include "l_bitmap.h"

L_LTIMGSFX_API L_INT EXT_FUNCTION L_ColoredPencilBitmapExt(pBitmap, uSize, uStrength, uThreshold, uPencilRoughness, uStrokeLength, uPaperRoughness, nAngle, uFlags)

pBITMAPHANDLE pBitmap;

pointer to the bitmap handle

L_UINT uSize;

size of the neighborhood

L_UINT uStrength;

strength of the outlines

L_UINT uThreshold;

threshold value

L_UINT uPencilRoughness;

percentage of coloring coverage

L_UINT uStrokeLength;

length of colored pencil stroke

L_UINT uPaperRoughness;

percentage of paper surface roughness

L_INT nAngle;

direction of coloring motion

L_UINT uFlags;

flags

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

Parameter Description
pBitmap Pointer to the bitmap handle that references the bitmap on which to apply the effect.
uSize Size of the neighborhood used to determine the width of the outlines.
uStrength Strength factor used to create the "outline". This can be any number that is 0 or greater.
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 range from 0 through 65535 for 64-bit, 48-bit and 16-bit grayscale images and from 0 through 4095 for 12-bit grayscale images. Otherwise, it is from 0 to 255. Use this parameter to control the number of edge pixels found.
uPencilRoughness Percentage of coloring coverage (colored pencil roughness), expressed in tenths of a percent. Valid values range from 0 to 1000.
uStrokeLength Length of the colored pencil stroke, in pixels.
uPaperRoughness Percentage of paper surface roughness, expressed in tenths of a percent. Valid values range from 0 to 1000.
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 uFlags = ARTISTIC_COLOREDPENCIL.
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 combine the two,  ignore this group.
  Value Meaning
  COMBINE_ORIGINAL [0x10] Combines the resulted bitmap with the original one.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function is like the L_ColoredPencilBitmap function, but has been extended to produce more realistic results.

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 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 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.

Required DLLs and Libraries

LTIMGSFX

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

L_ImpressionistBitmap, L_DryBitmap, L_ColoredPencilBitmap

Topics:

Raster Image Functions: Modifying Intensity Values

 

Raster Image Functions: Filtering Images

 

Detecting and Enhancing Edges and Lines

 

Applying Artistic Effects

Example

The following example loads a bitmap and applies the extended colored pencil effect:

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT ColoredPencilBitmapExtExample(L_VOID) 
{ 
   L_INT nRet; 
   /* Bitmap handle to hold the loaded image. */ 
   BITMAPHANDLE LeadBitmap; 
   /* Load the bitmap, keeping the bits per pixel of the file */ 
   nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\NaturalFruits.jpg")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet = L_ColoredPencilBitmapExt(&LeadBitmap,  5, 4, 0, 250, 15, 100, 0, ARTISTIC_COLOREDPENCIL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   // free bitmap 
   if(LeadBitmap.Flags.Allocated) 
      L_FreeBitmap(&LeadBitmap); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help