# NNS_G2dCharCanvasInitForOBJ2DRect

## Syntax

      #include <nnsys/g2d/g2d_CharCanvas.h>

      void NNS_G2dCharCanvasInitForOBJ2DRect(
          NNSG2dCharCanvas* pCC,
          void* charBase,
          int areaWidth,
          int areaHeight,
          NNSG2dCharaColorMode colorMode
      );

## Arguments

pCC | [OUT] Pointer to CharCanvas.
charBase | [IN] Pointer to starting point of characters assigned to CharCanvas. Must have 4-byte alignment.
areaWidth | [IN] Number of characters in the horizontal direction of CharCanvas
areaHeight | [IN] Number of characters in the vertical direction of CharCanvas
colorMode | [IN] Color mode of target OBJ

## Return Values

None.

## Description

Initializes a rectangular region in Character memory to be used as a CharCanvas for two-dimensional mapping OBJ. The hardware specifications restrict areaWidth to a maximum value of 32 characters (= 256 pixels) in 16-color mode, and to a maximum value of 16 characters (= 128 pixels) in 256-color mode. For areaHeight, the maximum value is 32 characters (=256 pixels) in either color mode.

colorMode takes either of these values:

NNS_G2D_CHARA_COLORMODE_16 | Use 16-color characters
NNS_G2D_CHARA_COLORMODE_256 | Use 256-color characters

This function assigns areaWidth characters in the horizontal direction and areaHeight characters in the vertical direction to CharCanvas, treating the character specified by charBase as the reference point.

If the combination of areaWidth and areaHeight does not fit within the size of OBJ, then CharCanvas will display using multiple OBJ. To place these OBJ appropriately, use `NNS_G2dArrangeOBJ2DRect` . To find out the required number of OBJ for display, use `NNS_G2dCalcRequiredOBJ2DRect`.

## See Also

`NNS_G2dArrangeOBJ2DRect, NNS_G2dCalcRequiredOBJ2DRect`

## Revision History

2007/01/11 Changed the fifth argument's type from NNSG2dColorMode to NNSG2dCharaColorMode.
2005/09/29 Corrected IN/OUT indications for arguments.
2005/05/25 Initial version

CONFIDENTIAL