Documentation
[SDK Documentation] [CGapiCursor]

 

GapiDraw Classes CGapiSurface CGapiRGBASurface CGapiDraw CGapiDisplay CGapiMaskSurface CGapiBitmapFont CGapiCursor CGapiApplication CGapiInput CGapiVFS CGapiTimer CGapiGradient

CGapiGradient

Overview

CGapiGradient is used to pre-render a gradient that can later be drawn using CGapiSurface::DrawGradient.

This document has been updated for use with GapiDraw 4.0 or later.
Last updated on October 5, 2008.

 

CGapiCursor::CreateGradient

This method creates the gradient.

HRESULT CreateGradient(DWORD dwNumPixels, COLORREF cFirst, COLORREF cLast);

Parameters
dwNumPixels
Number of pixel steps of the gradient. Must match the width and height of the clipped rectangle that is later used to draw the gradient.
cFirst
The first color.
cLast
The last color.
Return values

If this method succeeds, the return value is GD_OK.

If the method fails, the return value may be one of the following return values:

GDERR_INVALIDPARAMS

Remarks

GapiGradient uses six multiplications and six divisions for each pixel in the gradient (since it is precalculated in two directions), so it is not recommended to re-create the entire gradient on each frame update. You might instead want to create several gradients as member variables for re-use.


CGapiCursor::GetNumPixels

Returns the number of pixels in the gradient.

DWORD GetNumPixels();

Parameters

None

Return values

Returns the number of pixels in the gradient.


CGapiCursor::GetFirstColor

Returns the first color of the gradient.

HRESULT GetFirstColor(COLORREF* pFirst);

pFirst
Will be set to the first color of the gradient.
Return values

If this method succeeds, the return value is GD_OK.

If the method fails, the return value may be one of the following return values:

GDERR_INVALIDPARAMS
GDERR_NOTINITIALIZED


CGapiCursor::GetLastColor

Returns the last color of the gradient.

HRESULT GetLastColor(COLORREF* pLast);

pLast
Will be set to the last color of the gradient.
Return values

If this method succeeds, the return value is GD_OK.

If the method fails, the return value may be one of the following return values:

GDERR_INVALIDPARAMS
GDERR_NOTINITIALIZED