This function uses spline function to modifiy the RGB values of a raster image.

[C++Builder]   HANDLE IKRGBSpline(PTR_IKSELECT_IMAGE SrcHandle, BYTE SelectMode, LPPOINT lpPoint, int Points, LPRECT Rect, BOOL InOut, LPPOINT lpSpPoint, int SpPoints, BOOL Red, BOOL Green, BOOL Blue, IKPROCESSPROC UserProc, LPCTSTR Caption, LPCTSTR Message, LPCTSTR Button);
[Delphi]   function IKRGBSpline(var SrcHandle: IKSELECT_IMAGE; SelectMode: Byte; var lpPoint: TPoint; Points: Integer; var Rect : TRect; InOut: LongBool; var lpSpPoint: TPoint; SpPoints: Integer; Red, Green, Blue: LongBool; UserProc: LONG_PTR; Caption, Message, Button: PChar): THandle;

Parameters

Name Explanation
SrcHandle A structure containing the image handle and the mask image handle member variables
hImgBmh can be 1, 4, 8, 16, 24, or 32 bit images
SelectMode Sets the method for selecting the area on the image that will be processed (0: Mask handle, 1: Total image, 2: Polygon, 3: Ellipse)
lpPoint A structure defining coordinates for the points of the polygonal area on the image. (This parameter is enabled when SelectMode is 2)

In C++Builder, pass the pointer to the first element in the structure array.

In Delphi, if Pt is an array of TPoint, then the arguments are returned in the first elements of the array Pt[0]

Points The number of points defining the polygonal area on the image, i.e. the number of points in the lpPoint array (This parameter is enabled when SelectMode is 2).
Rect A structure specifying the coordinates for the rectangle bounding the elliptical area on the image (This parameter is enabled when SelectMode is 3)
InOut Determines whether the area inside the selected area will be processed or the area outside the selected area will be processed. Enabled for polygon and ellipse (SelectMode is 2 or 3). If False (0), the area outside the selected area is processed. If True (nonzero) the area inside the selected area is processed.
lpSpPoint A structure of arrays containing output RGB values defining the coordinates for points on the RGBSpline curve (Values are set in the same way as lpPoints).
SpPoints The number of (spx, spy) coordinates in the array (from 3 to 10)
Red Affects the red component of the RGB value (False(0): does not affect the red component, True( nonzero): affects the red component)
Green Affects the green component of the RGB value (False(0): does not affect the green component, True( nonzero): affects the green component)
Blue Affects the blue component of the RGB value (False(0): does not affect the blue component, True( nonzero): affects the blue component)
UserProc The address of the user function (If not using the user function then set to 0)
Caption Sets the text displayed in the title bar of the progress dialog box
Message Sets the message displayed in the progress dialog box
Button Sets the name of the button displayed in the progress dialog box

Return Value

Returns the raster image handle if successful. Returns 0 if unsuccessful.

Explanation

The IKRGBSpline function uses spline function to modifiy the RGB values of a raster image. A spline function is a method of interpolating values that lay in between data points. In other words it produces a smooth curve from a limited set of points.

The IKRGBSpline function allows you to define the relationship between the input RGB values in the original image and output RGB values in the newly created image. You do this by specifying a set of coordinate points where the input RGB values are the x coordinates and the output RGB values are the y coordinates. These coordinate points are stored in arrays and passed to the IKRGBSpline function through the lpSpPoint structure. The IKRGBSpline function then interpolates a "smooth" curve from these coordinate points. The graphic representation of this relationship between input RGB and output RGB values is known as the RGBSpline curve. A sample RGBSpline curve is shown in the diagram below:

In the above diagram, the green default RGBSpline curve represents no change between input RGB values and output RGB values. In this case, the newly created image is exactly the same as the orginal image. The red RGBSpline curve represents an increase in contrast between the original image and the newly created image. It was generated from the following points: (The lpSpPoint point values are specified below. SpPoints=5)

Point (x values,y values)
Point A (0,0)
Point B (64,32)
Point C (128,128)
Point D (192,160)
Point E (255,255)

At the midpoint of the red RGBSpline curve, the input RGB value of 128 equals the output RGB value of 128. At points below the midpoint, however, the output RGB values are lower than the input RGB values. This means that dark colors become darker. Conversely, at points above the midpoint, output RGB values are higher than input RGB values. This means that light colors become lighter. This particular RGBSpline curve therefore increases the contrast of the image.

An RGBSpline curve that decreases contrast could be defined with the following points: (The lpSpPoint point values are specified below. SpPoints=5)

Point (x values,y values)
Point A (0,0)
Point B (64, 96)
Point C (128,128)
Point D (225,192)
Point E (255,255)

Before executing this function, you must set the area on the image that will be affected. There are 4 ways to do this.

  1. To use a mask image, set SelectMode to 0. Then set the mask image handle in SrcHandle.
  2. To process the total image, set SelectMode to 1.
  3. To process the polygonal area on the image, set SelectMode to 2. Select the polygon by setting the appropriate coordinate values for the points of the polygon in the lpPoint structure. Then set the number of points defining the polygon in Points (must be 3 or more).
  4. To process an elliptical area on the image, set SelectMode to 3. Select the ellipse by setting the appropriate values for the bounding rectangle in the Rect structure.

For the lpPoint and Rect structure members, coordinate points are in pixel units. When SelectMode is set to a value other than 2, set a dummy array in lpPoint and set Points to 0. When SelectMode is set to a value other than 3, then set a dummy array in Rect. When processing a 1, 4 or 8 bit image, the whole image will be processed regardless of the value of the SelectMode. Please set the lpSpPoint members to values from 0 to 255.

Note: the image handles passed to IKSELECT_IMAGE are NOT automatically freed after executing this function.

If the user function is set or if the Caption, Message, and Button parameters are blank then the Progress dialog box is not displayed. If the Progress dialog box is displayed, it indicates the percentage of the current process completed. For more information about the user function please refer to the Definition of User Function in the Ik10Effect.dll, Ik10EffectA.dll, Ik10Effect64.dll, Ik10Effect64A.dlll section.

 

The ImageKit10 VCL is a product created by Newtone Corporation