# NNS_G2dCharCanvasInitForOBJ1D

## Syntax

      #include <nnsys/g2d/g2d_CharCanvas.h>

      void NNS_G2dCharCanvasInitForOBJ1D(
          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 the `NNSG2dCharCanvas` structure for displaying a text string using one-dimensional mapping OBJ. With this function, the CharCanvas gets built with n number of characters, assigned starting from charBase, where n = areaWidth * areaHeight.

colorMode takes either of these values:

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

There are certain restrictions on the values that can be set to areaWidth and areaHeight, depending on the color mode colorMode and the OBJ VRAM capacity. The table explains these restrictions:

Color mode | OBJ VRAM Capacity
--- | ---
32K | 64K | 128K | 256K
16 colors | (No restrictions) | (No restrictions) | Cannot be an odd number that has a remainder of 3 when divided by 4. | Cannot be an odd number.
256 colors | (No restrictions) | (No restrictions) | (No restrictions) | Cannot be an odd number that has a remainder of 3 when divided by 4.

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_G2dArrangeOBJ1D`. To find out the required number of OBJ for display, use `NNS_G2dCalcRequiredOBJ1D`.

## See Also

`NNS_G2dArrangeOBJ1D, NNS_G2dCalcRequiredOBJ1D`

## Revision History

2005/09/29 Revised the argument IN/OUT display
2005/05/25 Initial version

CONFIDENTIAL