OkfApplyEffect

Apply a definitive special effect on a registered font.

int OkfApplyEffect( int handle, OKFEFFECTTYPE type, int color, int intensity );

Routine Required Header
OkfApplyEffect "okf.h"
 

Libraries

OKLIB.A Oankali's GP32 run-time library
 

Return Value

In case of success OkfApplyEffect returns 0, otherwise it returns -1. Look at okf.lastError for details on what happened.


Parameters

handle

The handle of the font on which the special effect has to be applied. The handle must belong to a valid registered font.

type

An OKFEFFECTTYPE value that indicates the type of the special effect to apply.

color

The color to use for the special effect to be applied.

intensity

The intensity of the special effect to be applied. Value range from 0 to 31.


Remarks

The OkfApplyEffect function applies type special on all pixels of a font bitmap. The modification is permanent. The intensity argument is only used for okfOverlay special effect type.

This function is used to change permanently the color of an OKF Font at the beginning of the program. That can be helpful when the rendering of the font has to be as quick as possible. Real-time special effects can be very time consuming.

Use OkfClone function to make a copy of the font, in case the original font is also needed in the program.


Example

#include <gpstdlib.h>
#include <gpgraphic.h>
#include "okf.h"
...

GPDRAWSURFACE gtSurface[2];
int giSurface;

void GpMain(void *arg)
{
  // Init graphics mode and surfaces
  ...

  // Initialize OKF Font Engine
  OkfInitialize(gtSurface, &giSurface);

  // Register fonts
  OkfLoadAndRegister("gp:\\gpmm\\fonts\\fancy.okf");     // handle: 1

  // Clone last registered font
  OkfClone(okf.pFonts->lastHandle);                      // handle: 2

  // Change color of the new font to red
  OkfApplyEffect(okf.pFonts->lastHandle, okfOverlay, 0xF800, 31);

  // Follow with the execution of the program
  ...

  // Terminate OKF Font Engine
  OkfTerminate();

  // Exit program
  GpAppExit();
}


See Also

OKF Font Engine Routines, OKF Font Engine Constants, OkfClone