RZ/A1H Group Graphics Library RGA Application Note

Add to my manuals
130 Pages

advertisement

RZ/A1H Group Graphics Library RGA Application Note | Manualzz

APPLICATION NOTE

RZ/A1H Group

Graphics Library "RGA"

R01AN2162EJ0210

Rev. 2.10

Mar. 29, 2016

Introduction

This application note describes the Graphics Library RGA (Renesas Graphics Architecture) of RZ/A1H.

The following lists features of the RGA.

 Allows high-speed drawing using the hardware acceleration.

 The API created based on the W3C standard HTML Canvas 2D Context achieves easy learning. In addition, the

RGA provides C++API that is operable as an interface that is backward compatible with HTML Canvas 2D

Context.

 The memory area provided by the application is available as a drawing destination or for input images.

 Allows drawing of translucent images and translucent drawing using an alpha mask.

 The RGA provides a conversion tool that can access image files as global variables. (This conversion tool operates on the host PC.)

Target Device

RZ/A1H Group

RZ/A1M Group

RZ/A1L Group

When applying the sample program covered in this application note to another microcomputer, modify the program according to the specifications for the target microcomputer and conduct an extensive evaluation of the modified program.

Restrictions

This library is not compatible with the vector graphics supported by Renesas Graphics Processor for OpenVG™ (R-

GPVG2).

The hardware acceleration is used only for a part of drawing (Table 1-2), (6.11.1).

RZ/A1L does not use hardware acceleration. And it can not use a part of drawing. (Table 1-3)

This library cannot be used in multiple threads. Use the RGA in a single thread.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 1 of 127

RZ/A1H RGA

Contents

Graphics Library "RGA" .................................................................................................................................. 1

1.

Specifications .......................................................................................................................................... 4

2.

File Configuration .................................................................................................................................... 9

3.

Operation Verification Conditions ......................................................................................................... 11

4.

Reference Application Note(s) .............................................................................................................. 12

5.

Description of Hardware ....................................................................................................................... 13

5.1

Hardware Configuration ................................................................................................................ 13

5.2

List of Pins to be Used .................................................................................................................. 14

6.

Description of Software ......................................................................................................................... 15

6.1

Outline of Operations .................................................................................................................... 15

6.1.1

6.1.2

When Drawing on a Buffer Defined by the Application ...................................................... 15

Drawing on the Display Screen .......................................................................................... 17

6.2

Hardware resource allocation ....................................................................................................... 20

6.3

Required Memory Size ................................................................................................................. 21

6.4

Using OS resources...................................................................................................................... 22

6.5

List of Constants ........................................................................................................................... 23

6.6

Types and Classes ....................................................................................................................... 24

6.6.1

Basic Types and Values ..................................................................................................... 24

Error Codes ........................................................................................................................ 24

Types Only for the C Language .......................................................................................... 25

Classes Only for the C++ Language .................................................................................. 27

6.6.2

6.6.3

6.6.4

6.6.5

6.6.6

6.6.7

6.6.8

Types/Classes Available for C Language and C++ Language .......................................... 29

String Format ...................................................................................................................... 38

Type of porting layers ......................................................................................................... 39

Changing state of class ...................................................................................................... 40

6.7

List of Variables ............................................................................................................................ 41

6.8

Properties ..................................................................................................................................... 42

6.8.1

6.8.2

6.9

Functions and Methods ................................................................................................................ 45

6.9.1

6.9.2

Canvas2D_ContextClass Properties .................................................................................. 42

Canvas2D_ImageClass Properties .................................................................................... 44

6.9.3

6.9.4

6.9.5

6.9.6

6.9.7

6.9.8

6.9.9

6.9.10

Functions Equivalent to graphics_t Class Member Function ............................................. 45

Functions Equivalent to graphics_image_t Class Member Function ................................. 62

Functions Equivalent to graphics_pattern_t Class Member Function ................................ 65

Functions Related to Creating C++ Object ......................................................................... 66

Canvas2D_ContextClass Member Functions..................................................................... 67

Functions Related to Canvas2D_ImageClass .................................................................... 74

Functions Related to Canvas2D_PatternClass .................................................................. 74

Functions Related to WindowSurfacesClass...................................................................... 75

6.9.11

6.9.12

6.9.13

6.9.14

Functions Equivalent to window_surfaces_t Class Member Functions ............................. 77

Functions Related to byte_per_pixel_t Class ..................................................................... 81

Functions Related to v_sync_t Class ................................................................................. 82

Functions Related to vram_ex_stack_t class ..................................................................... 84

Functions Related to animation_timing_function_t class ................................................... 85

Other Functions .................................................................................................................. 87

6.9.15

Functions in strings ............................................................................................................. 89

6.10

Porting layer Functions ................................................................................................................. 90

6.10.1

6.10.2

Functions on Default Settings of RGA ................................................................................ 90

Porting layer functions of OSPL ......................................................................................... 92

6.10.3

Porting layer functions of RGPNCG ................................................................................... 93

6.11

Supplementary Explanation .......................................................................................................... 97

6.11.1

6.11.2

6.11.3

Correspondence to Canvas 2D and Correspondence to Hardware Acceleration .............. 97

Internal operation in initialize function .............................................................................. 100

Identifying Image Format .................................................................................................. 101

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 2 of 127

RZ/A1H RGA

6.11.4

6.11.5

6.11.6

6.11.7

Changing RGAH and RGAS ............................................................................................. 102

Flush Mode ....................................................................................................................... 103

Using SDRAM ................................................................................................................... 104

Layer structure of sample screen controller ..................................................................... 105

6.11.8

6.11.9

Flagged Structure Parameters ......................................................................................... 106

Defaultable Flags .............................................................................................................. 107

6.11.10

Function to Initialize Internal Variables with Constants (*_initConst Function) ................ 109

6.11.11

Finalize (*_Finalize Function) ........................................................................................... 110

6.11.12

Compatibility between C++ Language and JavaScript Object ......................................... 112

7.

Tools ................................................................................................................................................... 113

7.1

Image Format Conversion by ImagePackager ........................................................................... 113

7.1.1

7.1.2

7.1.3

7.1.4

7.1.5

7.1.6

7.1.7

7.1.8

Operational Procedure...................................................................................................... 113

List of files ......................................................................................................................... 113

Sample .............................................................................................................................. 114

Types of Output Binary File (Language) ........................................................................... 114

File Formats in the Output Binary File .............................................................................. 114

Input Formats .................................................................................................................... 115

Parameters That Can Be Described in BinaryImageConfig.image.xml ........................... 116

Basic forms of writing XML ............................................................................................... 121

7.2

Searching for Error Information by SearchErrorInformation ....................................................... 123

7.3

Converting binary by ConvertBin ................................................................................................ 124

7.4

Creating image file by RawToBmp ............................................................................................. 125

8.

Sample Codes .................................................................................................................................... 126

9.

Reference Documents ........................................................................................................................ 126

Website and Support .................................................................................................................................. 127

Revision History .......................................................................................................................................... 128

General Precautions in the Handling of MPU/MCU Products .................................................................... 129

Notice ......................................................................................................................................................... 130

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 3 of 127

RZ/A1H RGA

1. Specifications

The RGA is used to draw graphics images.

Table 1-1 lists Peripheral Functions to Be Used and Applications, Figure 1-1 shows a Block Diagram, and Table 1-2 and Table 1-3 list available pixel formats.

Table 1-1 Peripheral Functions to Be Used and Applications

Peripheral Function

Renesas Graphics

Processor for OpenVG™ (R-

GPVG2)

JPEG Codec Unit (JCU)

Video Display Controller 5 (VDC5)

RZ/A1H, M, L

RGA - C++ language API

Application

RGA - C language API

Application

Graphics drawing

JPEG decompression

Screen display

Library

Driver

Porting layer

H/W

RGA Library

RGPNCG

R-GPVG2

*1

Sample Window Surfaces

JCU

*1

VDC5

OSPL

Interrupt control

JCU

*1

VDC5 VRAM

LCD

Host PC

Image file

(*.bmp, *.jpg, *.png)

ImagePackager

Outline of image data

Binary module provided by Renesas

Sample source provided by Renesas

Interface

*1 RZ/A1L does not have the function. The function is operated by software.

Figure 1-1 Block Diagram

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 4 of 127

RZ/A1H RGA

The coordinate system of this library has an origin at the upper left. The value in the X-axis direction increases from left to right. The value in the Y-axis direction increases downward. The maximum width of a frame buffer to be drawn is 1280 pixels, and its maximum height is 1024 pixels. The maximum size of source image is 2048x2048. First address and size of 1 line of the frame buffer and source image must be a multiple of 32.

Left Right

Left Right

Up

(0, 0)

X axis

(2047, 0)

Up

(0, 0)

Target Frame

Buffer

X axis

(1279, 0)

Source Image

Down

(0, 2047)

Y axis

Figure 1-2 Max size of drawing target and source image

Table 1-2 Available Pixel Formats of Drawing Destination

(0, 1023)

Down

Y axis

Hardware rendering

Software rendering

Matrix, enlargement/ reduction, blend

Image drawing

(6.9.1.29 etc.)

DrawImageChild

(6.9.1.31)

Alpha only image

Square fill

Byte per pixel

(reference)

4

4

2

2

2

x

2

x

x x x x

1 x

x

2 x x x

1/2 x

x

2

x x x

1/8 x

x

2

1

RGB component is not multiplied alpha.

2

Restrictions. For details, see the description on functions.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 5 of 127

RZ/A1H RGA

Table 1-3 Combinations of Available Pixel Formats of Images and Pixel Formats of Drawing Destination

Output

Input Image

JPEG

PNG

XRGB8888

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓ x x x x x x x x x x x

ARGB8888

RGB565

ARGB1555

ARGB4444

R8G8B8A8

3

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓

✓✓ x x x x x x x x x x x x x x x x x x x x

YUV422

CLUT8

CLUT4

CLUT1

2

x x x x x x x x x x x x x x x x

A8

4 ✓

A4

A1

4

4

✓✓=RZ/A1H,M,L, ✓=RZ/A1H,M, x=Not available

x x x x

✓✓ x x x x x x x

✓✓ x x x x x x x

✓✓ x x x x x x x

✓✓ x x x

The JPEG above is a case where JPEG data is specified for arguments of the image drawing function

(R_GRAPHICS_DrawImage). Table 1-4 shows supported JPEG format. When a JPEG file or PNG file is converted to the raw format (including XRGB8888) by using the ImagePackager tool, see the column of the pixel format.

Table 1-4 Supported JPEG format

Decoding module

JPEG standard

Pixel format in JPEG

RZ/A1H,M

JPEG Codec Unit (JCU) in RZ/A baseline

YCbCr420 (H=2:1:1,V=2:1:1)

YCbCr422 (H=2:1:1,V=1:1:1)

YCbCr444 (H=1:1:1,V=1:1:1)

YCbCr411 (H=4:1:1,V=1:1:1)

RZ/A1L

IJG JPEG (libjpeg) baseline

YCbCr420 (H=2:1:1,V=2:1:1)

YCbCr422 (H=2:1:1,V=1:1:1)

3

If the source image was R8G8B8A8 or YCbCr422, S/W rendering is used.

4

Width of A8, A4 and A1 format image must be same as width of drawing target frame buffer.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 6 of 127

RZ/A1H

Table 1-5 Supported PNG format

RGA

RZ/A1H,M,L

Decoding module LibPNG, zlib

The following tables describes the detail of pixel format. RGA for RZ/A is little endian. For example, Red of

XRGB8888 is at first address of the pixel + 2.

XRGB8888 bit 31 24 23 16 15 8 7

0 Red Green Blue

ARGB8888 bit 31 24 23 16 15 8 7

Alpha Red Green Blue

RGB565 bit 15 11 10 5 4 0

Blue Red Green

ARGB1555 bit 15

Alpha

14

Red

10 9

ARGB4444 bit 15 12 11 8 7

Alpha

R8G8B8A8 address +0 +1

Red

+2

Red

YCbCr422 address +0

Green

+1 +2

Cb Y (Left)

FourCC = UYVY, CbCr center (grayscale) = 0x80

Green

Green

Blue

Cr

5 4

4 3

+3

+3

Blue

Blue

Alpha

Y (Right)

0

0

0

0

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 7 of 127

RZ/A1H

CLUT8 bit 7 0

Index

CLUT4 bit 7

Alpha

4 3 0

Index (Left) Index (Right)

CLUT1 bit 7 6 5 4 3

Index 0 Index 1 Index 2 Index 3 Index 4

Index 0 is the most left pixel. Index 7 is the most right pixel.

A8 bit 7 0

A4

2

Index 5 bit 7 4 3 0

Alpha (Right) Alpha (Left)

A1 bit 7 6 5 4 3

Alpha 7 Alpha 6 Alpha 5 Alpha 4 Alpha 3

Alpha 0 is the most left pixel. Alpha 7 is the most right pixel.

2

Alpha 2

1

Index 6

RGA

0

Index 7

1

Alpha 1

0

Alpha 0

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 8 of 127

RZ/A1H RGA

2. File Configuration

src

drivers

ospl

RGA

samples

RGA

inc

RGPNCG

Sample_Common

scriptlib

RGA_Tools.vbs

Sample of porting layer for OS less

C/C++ language header

Sample of porting layer for OS less

Sample source of RGA

Sample source of RGA

Sample source (common of platform)

Internal files for commands

Tools, see section 7.

lib

RGA

RGAH

PNG

IJG_JPEG

RGA library

RGA internal library

PNG library

JPEG library (This is not used for RZ/A1H, M)

When you installed RGA library to your project folder, copy "src\drivers\inc" folder and "lib" folder. When link error was raised, copy source files defined error raised function. When an error of not found #include file, copy header files.

And copy source files of drivers and common functions defined functions that was raised the unreferenced link error.

Write '#include "RGA.h"' in the application program using RGA.

Set the work buffer of RGA in uncached area and put in available memory area. The address of work buffer (the value of "work_buffer_address" member variable in "R_GRAPHICS_STATIC_OnInitializeDefault" function) is changed to uncached area by calling "R_OSPL_ToUncachedAddress" function in "r_ospl_memory.c" file from inside of RGA (or checked to be already in uncached area) and changed to physical address accessible from hardware by calling "R_OSPL_ToPhysicalAddress" function.

If memory area became few, reduce frame buffer to the size of showing only and set the size of work buffer B to 0. It is necessary to increase stack size depending on existing environment.

Check that the memory map by setting in "r_ospl_memory.c" is same as the setting of MMU. See "Memory" section in "OS porting guide" section in application note of RZ/A1H group OS porting layer "OSPL" (R01AN1887JJ).

Table 2-1 Main header files (in src\drivers\RGA\inc)

File Name

RGA.h

RGA_API.h

RGA_Config.h

RGA_Cpp.h

Table 2-2 Library files

Description

Main of RGA

Sub of RGA : API. This file is included from RGA.h

Sub of RGA : setting. This file is included from RGA.h

Sub of RGA : C++ API. This file is included from RGA.h

File Name libRGA.a

RGA hardware rendering

RGA software rendering

✓ ✓

Description

Main of RGA

Hardware accelerator using version is in ForRGAH folder.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 9 of 127

RZ/A1H libRGAH.a libPNG.a libjpeg.a

-

-

RGA

No hardware accelerator using version is ForRGAS folder. libRGA.a has the rendering routine (RGAS). libRGA.a internal module (RGAH). This is not used by

RGA for no hardware accelerator version.

This decodes PNG image. Both RGA for hardware accelerator version and no hardware accelerator version use libPNG.a. Both RGA do not use hardware accelerator for decoding PNG image.

The environment of gcc not supported longjmp function can not continue after raising an error. It calls

user_error_fn function and PNG_ABORT macro.

Set the size of work buffer for PNG module to

work_size_for_libPNG member variable.

This library can be made from source files in PNG folder. If you want to update the newest LibPNG module, modify and build source files for RZ/A by source files for reference.

This decodes JPEG image. RGA for hardware accelerator version does not use libjpeg.a.

This library can be made from source files in IJG_JPEG folder. If you want to update the newest libjpeg module, modify and build source files for RZ/A by source files for reference.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 10 of 127

RZ/A1H

3. Operation Verification Conditions

Operations of the sample code of this application note are verified under the following conditions.

Table 3.1 Operation Verification Conditions

Item

MCU used

Operating frequency

Operating voltage

Integrated development environment

C compiler

Operating mode

Communication setting of terminal software

Board used

Device used

Description

RZ/A1H

CPU clock (I

φ): 400MHz

Image processing clock (G

φ): 266.67MHz

Internal bus clock (B

φ): 133.33MHz

Peripheral clock 1 (P1

φ): 66.67MHz

Peripheral clock 0 (P0

φ): 33.33MHz

Power supply voltage (I/O): 3.3V

Power supply voltage (Internal): 1.18V

ARM® integrated development environment

ARM Development Studio 5 (DS-5TM) Version 5.16

ARM C/C++ Compiler/Linker/Assembler Ver.5.03 [Build 102]

Compiler options (Excluded directory path)

-O3 -Ospace --cpu=Cortex-A9 --littleend --arm --apcs=/interwork

--no_unaligned_access --fpu=vfpv3_fp16 -g

Boot mode 0

(CS0 space 16bit boot)

 Communication speed: 115200bps

 Data length: 8 bits

 Parity: None

 Stop bit length: 1 bit

 Flow control: None

GENMAI board

 RTK772100BC00000BR (R7S72100 CPU board)

 RTK77210000B00000BR (R7S72100 Option board)

LCD.

Serial interface (D-sub 9-pin connector)

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 11 of 127

RZ/A1H

4. Reference Application Note(s)

For additional information associated with this document, refer to the following application note(s).

 RZ/A1H Group Example of Initialization (R01AN1646EJ)

 RZ/A1H Group I/O definition header file <iodefine.h> (R01AN1860EJ)

 RZ/A1H Group OS porting layer "OSPL" Sample Program (R01AN1887EJ)

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 12 of 127

RZ/A1H

5. Description of Hardware

5.1 Hardware Configuration

Figure 5.1 shows Example of Hardware Configuration.

GENMAI board

Option board

(Optional)

Figure 5.1 Example of Hardware Configuration (RZ/A1H)

RGA

Power supply

ULINK2 (ICE)

To host PC's

USB

LCD output

(Optional)

To host PC's serial port

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 13 of 127

RZ/A1H

5.2 List of Pins to be Used

Table 5-1 lists the pins to be used and their functions.

Table 5-1 Pins to be Used and their Functions

Pin name I/O

None

Description

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 14 of 127

RZ/A1H RGA

6. Description of Software

6.1 Outline of Operations

6.1.1 When Drawing on a Buffer Defined by the Application

6.1.1.1

Flowchart

Figure 6.1 shows a flowchart of drawing on a frame buffer defined by the application.

For the actual operation procedure, see the attached document, RGA Tutorial.

When using the C++ language API, see the description below using the C language API and the relationship between

the C language API described in section 6.11.1, Correspondence to Canvas 2D and Correspondence to Hardware

Acceleration, and the C++ language API.

Initialize the constant part of each object.

(Call the R_GRAPHICS_InitConst function.)

Prepare a frame buffer.

(Set member variables of the frame_buffer_t type structure.)

Initializing

Create an object of graphics_t class object.

(Call the R_GRAPHICS_Initialize function.)

Start of animation loop

Call the drawing API.

(Call the R_GRAPHICS_FillRect function.)

Wait until drawing is completed.

(Call the R_GRAPHICS_Finish function.)

Display drawing result stored in the frame buffer.

End of animation loop

Finalize the graphics_t class object.

(Call the R_GRAPHICS_Finalize function.)

Figure 6.1 Drawing on a Buffer Defined by the Application - Flowchart

Drawing

Finalizing

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 15 of 127

RZ/A1H

6.1.1.2

Sequence Chart

The following shows an operation timing chart of the software (application and library) and hardware (drawing hardware and display hardware) in the case of drawing on the frame buffer provided by the application.

RGA

Drawing hardware Frame buffer Application RGA

Prepare a frame buffer.

Create an object of graphics_t class.

Always displayed or display is controlled by the application.

Initialization

Call the drawing API. (1)

Drawing (1)

Call the drawing API. (2)

Buffering or waiting

Drawing (2)

Call R_GRAPHICS_Finish.

Waiting for an interrupt

End of drawing

Finalize the graphics_t class object.

When the frame buffer is always displayed, drawing progress is displayed.

When the frame buffer is always displayed, it is displayed correctly.

Finalization

Asynchronous message

Synchronous message

Return

Figure 6.2 Operation sequence

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 16 of 127

RZ/A1H RGA

6.1.2 Drawing on the Display Screen

6.1.2.1

Flowchart

Figure 6.3 shows a flowchart of drawing on the display screen.

For the actual operation procedure, see the attached document, RGA Tutorial.

When using the C++ language API, see the description below using the C language API and the relationship between

the C language API described in section 6.11.1, Correspondence to Canvas 2D and Correspondence to Hardware

Acceleration, and the C++ language API.

Initialize the constant part of each object.

(Call the R_WINDOW_SURFACES_InitConst function and the

R_GRAPHICS_InitConst function.)

Create a display screen and a frame buffer.

(Call the R_WINDOW_SURFACES_Initialize function and the

R_WINDOW_SURFACES_GetLayerFrameBuffer function.)

Initializing

Create an object of the graphics_t class object.

(Call the R_GRAPHICS_Initialize function.)

Start of animation loop

Call the drawing API.

(Call the R_GRAPHICS_FillRect function, etc.)

Drawing

Display the drawing result.

(Call the R_WINDOW_SURFACES_Swap function.)

End of animation loop

Finalize the graphics_t class object.

(Call the R_GRAPHICS_Finalize function.)

Finalize the display screen and the frame buffer.

(Call the R_WINDOW_SURFACES_Finalize function.)

Figure 6.3 Drawing on the Display Screen - Flowchart Processing

Finalization

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 17 of 127

RZ/A1H RGA

6.1.2.2

Sequence Chart

The following shows an operation timing chart of the software (application and library) and hardware (drawing hardware and display hardware) in the case of drawing on the frame buffer provided by the RGA's WindowSurfaces library.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 18 of 127

RZ/A1H

Application RGA

Create a display screen and a frame buffer.

Create a graphics_t class object.

(For details, refer to section 6.1.1.2.)

Drawing hardware

Initialization

Call the drawing API twice or more.

(For details, refer to section 6.1.1.2.)

Drawn on frame buffer 1

Call R_WINDOW_SURFACES_Swap.

Waiting for an interrupt

End of drawing

Setting for displaying frame 1

Waiting for an interrupt

Display hardware and frame buffer

RGA

Initialization; black color is displayed.

V-Sync

Frame 1 is displayed.

Call the drawing API.

Drawn on frame buffer 2

Call R_WINDOW_SURFACES_Swap.

Waiting for an interrupt

End of drawing

Setting for displaying frame 2

Waiting for an interrupt

Finalize graphics_t class object, display screen, and frame buffer.

Finalization

V-Sync

Frame 2 is displayed.

Finalization; unless LCD is turned off, the screen is broken.

Figure 6.4 Operation sequence

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 19 of 127

RZ/A1H RGA

6.2 Hardware resource allocation

Renesas Graphics Processor for OpenVG™ (R-GPVG2) and JPEG Codec Unit (JCU) are allocated by an instance as

"graphics_t" class. If 2nd instance as "graphics_t" class was initialized, an error is raised.

Video Display Controller 5 (VDC5)'s hardware layers are allocated with layers in "window_surfaces_t" object.

If "graphics_config_t ::jpeg_decoder = GRAPHICS_JPEG_DECODER_NONE", RGA does not access to JPEG

Codec Unit (JCU).

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 20 of 127

RZ/A1H

6.3 Required Memory Size

Table 6.1 shows required memory size of the sample program.

Table 6.1 Required Memory Size

Memory Size (bytes) Note

ROM

ROM, RAM

39228 libRGA.a - Code

21732 libRGAH.a - Code

53 libRGA.a - Read Only Data

0 libRGAH.a - Read Only Data

812 libRGA.a - Read Write Data

RAM

28 libRGAH.a - Read Write Data

0 libRGA.a - Zero Initialized Data

940 libRGAH.a - Zero Initialized Data

Refer to R_RGA_CalcWorkBufferSize

6.9.14.3

Work buffer

Refer to R_RGA_CalcWorkBufferB_Size

6.9.14.4

Work buffer B

1536000 (2x16bit x800x480) Frame buffer

2304000 (3x16bit x800x480) Back buffer for application

1388 Used stack size of the sample program

Note: These required memory sizes vary depending on the C compiler version and the compile option.

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 21 of 127

RZ/A1H RGA

6.4 Using OS resources

RGPNCG attached RGA for RTX uses the thread assigned event in "NCGSYS_*_State" function. Using bit of event can be specified at initialize of RGA.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 22 of 127

RZ/A1H

6.5 List of Constants

Table 6.2 lists Constants Used for the Sample Code.

Table 6.2 Constants Used for the Sample Code

RGA

Constant Name

RGA_VERSION

RGA_VERSION_STRING

RGA_FRAME_BUFFER_ADDRES

S_ALIGNMENT

RGA_SOURCE_IMAGE_STRIDE_

ALIGNMENT

RGA_DESTINATION_STRIDE_ALI

GNMENT

RGA_JPEG_ADDRESS_ALIGNME

NT

RGA_JPEG_MAX_WIDTH_ALIGN

MENT

RGA_JPEG_MAX_HEIGHT_ALIGN

MENT

RGA_VDC5_BUFFER_ADDRESS_

ALIGNMENT

RGA_WORK_BUFFER_STRIDE

RGA_WORK_BUFFER_ADDRESS

_ALIGNMENT

RGA_WORK_BUFFER_HEIGHT_A

LIGNMENT

RGA_WORK_BUFFER_B_ADDRE

SS_ALIGNMENT

RGA_MAX_WORK_SIZE_FOR_LI

B_PNG_DEFAULT

Value for RGAH

32

32

32

8

64

64

8

Value for RGAS

Description

210 RGA version

"2.10" RGA version string

4 Address alignment of drawing target frame buffer (bytes)

4 Byte count alignment to next line

(stride) of source image (bytes)

4 Byte count alignment to next line

(stride) of drawing target (bytes)

4 Address alignment of JPEG data

(bytes)

16 Maximum width of MCU of source

JPEG image. (pixel)

16 Maximum height of MCU of source

JPEG image. (pixel)

64 First address alignment of the frame buffer shown by Video Display

Controller 5 (VDC5) (bytes)

- One line size of work buffer (bytes)

4 First address alignment of work buffer

(bytes)

- Height alignment of work buffer (pixel)

32 4 First address alignment of work buffer

B (bytes)

0x40000 Default size (bytes) of memory area as heap area allocated by PNG decoding.

This memory area is allocated in work buffer B See work_size_for_libPNG member variable.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 23 of 127

RZ/A1H

6.6 Types and Classes

6.6.1 Basic Types and Values

RGA

Symbol Description char_t bool_t int_t int8_t int16_t int32_t int64_t uint8_t uint16_t uint32_t uint64_t int_fast8_t int_fast16_t int_fast32_t uint_fast8_t uint_fast16_t uint_fast32_t uintptr_t size_t ptrdiff_t bit_flags_fast32_t bit_flags32_t float32_t float64_t

8-bit character

Logical data type. The value is true (1) or false (0).

The signed integer for this library is a 32-bit signed integer.

8-bit signed integer (defined by standard library)

16-bit signed integer (defined by standard library)

32-bit signed integer (defined by standard library)

64-bit signed integer (defined by standard library)

8-bit unsigned integer (defined by standard library)

16-bit unsigned integer (defined by standard library)

32-bit unsigned integer (defined by standard library)

64-bit unsigned integer (defined by standard library)

Fastest 8-bit minimum-width signed integer

Fastest 16-bit minimum-width signed integer

Fastest 32-bit minimum-width signed integer

Fastest 8-bit minimum-width unsigned integer

Fastest 16-bit minimum-width unsigned integer

Fastest 32-bit minimum-width unsigned integer

Same as pointer bit width unsigned integer as physical address

Same as pointer bit width unsigned integer as byte size

Same as pointer bit width signed integer as difference between pointers

Same as uint_fast32_t bit flags (bit field)

Same as uint32_t bit flags (bit field)

32-bit float

(Defined by standard library when "__ARM_NEON__" defined)

64-bit float

(Defined by standard library when "__ARM_NEON__" defined)

128-bit float float128_t

6.6.2 Error Codes

Error code can be got from the return value of C language API. Error code of C++ API can be got from

"R_OSPL_GetErrNum" function.

Refer to (7.2) Searching for Error Information by SearchErrorInformation.

0

E_OTHERS

Symbol

E_FEW_ARRAY

E_FEW_MEMORY

E_FIFO_OVER

E_NOT_FOUND_SYMBOL

E_NO_NEXT

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Value Description

0 No error

1 Others error

Check parameters

2 Error of few fixed length array

Increase elements of fixed length array

3 Few heap memory area

Increase heap memory size

4 Failed to enqueue

Decrease putting count or increase the queue

5 Not defined the symbol

Check the symbol

6 There is not next element of list

Page 24 of 127

RZ/A1H RGA

E_ACCESS_DENIED

E_NOT_IMPLEMENT_YET

E_ERRNO

E_LIMITATION

E_STATE

E_PATH_NOT_FOUND

E_BAD_COMMAND_ID

E_TIME_OUT

E_NO_DEBUG_TLS

E_EXIT_TEST

E_NOT_SUPPORTED_PIXEL_

FORMAT

Don't access next element

7 Error of denied read or write

Unlock or change the target

9 Not implemented yet

Don't use corresponding function

0x0E(=14) Refer to "errno"

0x0F(=15) Temporary limitation

Don't use corresponding function

0x10(=16) Cannot do at this state

Call function to change the state

0x12(=18) Not found file or folder

Check the name

0x16(=22) Out of number of command ID

Check the ID

0x17(=23) Time out

Check the target is enabled

0x1D(=29) Not set debug work area.

Refer to "R_OSPL_SET_DEBUG_WORK"

5

0x1E(=30) Request of exit from the test

0x9400

=37888

Unsupported pixel format.

Change to supported pixel format. See Table 1-2

6.6.3 Types Only for the C Language

The following are types supplied by the RGA and used only for the C language.

Type definitions shown in this section are also available for the C++ language, but there are classes available for the

C++ language. For details, see section 6.6.4.

For types available for the C language, also see section 6.6.5, Types/Classes Available for C Language and C++

Language.

6.6.3.1

List of Types

Table 6.3 C Language-Dedicated Types Provided by RGA

Section Type Description

6.6.3.2

6.6.3.3

6.6.3.4

graphics_t graphics_image_t graphics_pattern_t

Graphics drawing context

Input image

Image arranged pattern

6.6.3.2 graphics_t

Outline

Header

Graphics drawing context

RGA.h

Description

Function equivalent to the member function: See section 6.9.1.

Renesas Graphics Processor for OpenVG™ (R-GPVG2) or software rendering is used in the RZ/A1H.

Member Variable Access Inhibit

6.6.3.3 graphics_image_t

Outline Image

5

RZ/A1H group OS Porting Layer "OSPL" Sample Program (R01AN1887EJ)

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 25 of 127

RZ/A1H RGA

Header

Description

RGA.h

Function equivalent to the member function: See section 6.9.2.

The ImagePackager tool converts this type from an image file and outputs this type data.

Member Variable

It is also possible to dynamically generate a graphics_image_t-class object without using the ImagePackager tool.

Access Inhibit

6.6.3.4 graphics_pattern_t

Outline

Header

Description image-arranged pattern

RGA.h

Function equivalent to the member function: See section 6.9.3.

Member Variable Access Inhibit

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 26 of 127

RZ/A1H RGA

6.6.4 Classes Only for the C++ Language

The following describes C++ language classes provided by the RGA.

Be careful of coding because classes provided by the RGA are created to be compatible with JavaScript. For details,

see section 6.11.12 Compatibility between C++ Language and JavaScript Object.

For classes/types available for the C language, also see section 6.6.5, Types/Classes Available for C Language and

C++ Language.

6.6.4.1

List of Types

Table 6.4 C++ Language-Dedicated Types Provided by RGA

Section Type Description

6.6.4.2

6.6.4.3

6.6.4.4

6.6.4.5

6.6.4.6

6.6.4.7

6.6.4.8

Canvas2D_ContextClass Graphics drawing context

Canvas2D_ContextConfigClass Setting of "Canvas2D_ContextClass"

Canvas2D_ImageClass Input image

Canvas2D_PatternClass Image-arranged pattern

WindowSurfacesClass

WindowSurfacesConfigClass

LayerAttributesClass

Frame buffer and showing screen

Argument of "WindowSurfacesClass::initialize"

Argument of

"WindowSurfacesClass::access_layer_attributes"

6.6.4.2

Canvas2D_ContextClass

#include "RGA.h" class Canvas2D_ContextClass;

This is a graphics drawing context class only for the C++ language. This class follows a coding rule of JavaScript.

Renesas Graphics Processor for OpenVG™ (R-GPVG2) or software rendering is used in the RZ/A1H.

For the description on properties, refer to property specifications (section 6.8.1).

For the description on member functions, refer to function specifications (sections 6.9.5 and 6.9.4.2).

The graphics_t type member functions are made available by using the c_LanguageContext property. See section

6.9.1.

Sample:

Canvas2D_ContextClass canvas2d =

R_RGA_New_Canvas2D_ContextClass( frame );

/* JavaScript start of compatible part */ canvas2d.clearRect( 0, 0, frame_width, frame_height ); canvas2d.Style = "#0f0"; canvas2d.fillRect( 100, 100, 200, 100 );

/* JavaScript end of compatible part */ if ( R_OSPL_GetErrNum() != 0 ) { /* error */ }

R_WINDOW_SURFACES_SwapBuffers( ... ); canvas2d.destroy();

6.6.4.3

Canvas2D_ContextConfigClass

Outline

Header

This is a setting of "Canvas2D_ContextClass" for the C++ language

RGA.h

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 27 of 127

RZ/A1H

Description Default value is set by the constructor.

RGA

Member

Variable frame_buffer_t* frame_buffer bool_t is_fast_manual_flush

Drawing target frame buffer. This variables must be set.

Set the address of frame_buffer_t type structure.

Fast manual flush mode (6.11.5) or not. Default value is

"false".

6.6.4.4

Canvas2D_ImageClass

#include "RGA.h" class Canvas2D_ ImageClass;

This is a referable image object type only for the C++ language. This class follows a coding rule of JavaScript.

For the description on properties, refer to property specifications (section 6.8.2).

For the description on member functions, refer to function specifications (section 6.9.6).

6.6.4.5

Canvas2D_PatternClass

#include "RGA.h" class Canvas2D_PatternClass;

This is an image-arranged pattern class only for the C++ language. This class follows a coding rule of JavaScript.

For the description on member functions, refer to function specifications (section 6.9.7).

6.6.4.6

WindowSurfacesClass

#include "RGA.h" class WindowSurfacesClass;

This is a frame buffer and showing screen class only for the C++ language. This class follows a coding rule of mbed.

For the description on member functions, refer to function specifications (section 6.9.8).

6.6.4.7

WindowSurfacesConfigClass

#include "RGA.h" class WindowSurfacesConfigClass;

This is a class of argument for "WindowSurfacesClass::initialize" member function for C++ language. This class follows a coding rule of mbed.

Member variables of this class are inherited from "window_surfaces_config_t" type. See 6.6.5.6. Also, member

variables are initialized to default value by constructor. It is not necessary to set "flags" member variable.

6.6.4.8

LayerAttributesClass

#include "RGA.h" class LayerAttributesClass;

This is a class of argument for "WindowSurfacesClass::access_layer_attributes" member function for C++ language.

This class follows a coding rule of mbed.

Member variables of this class are inherited from "layer_attributes_t" type. See 6.6.5.7. Also, member variables are

initialized to default value by constructor. It is not necessary to set "flags" member variable.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 28 of 127

RZ/A1H

6.6.5 Types/Classes Available for C Language and C++ Language

For types available from the C language, also see section 6.6.3, Types Only for the C Language.

For types available from the C++ language, also see section 6.6.4, Classes Only for the C++ Language.

6.6.5.1

List of Classes/Types

Table 6.5 Types/Classes Provided by RGA, which are Available for C Language and C++ Language

RGA

Section Type Description

6.6.5.2

6.6.5.3

6.6.5.4

6.6.5.5

6.6.5.6

6.6.5.7

6.6.5.8

frame_buffer_t graphics_config_t graphics_quality_flags_t window_surfaces_t window_surfaces_config_t layer_attributes_t access_t

6.6.5.9

byte_per_pixel_t

6.6.5.10 pixel_format_t

6.6.5.11 frame_buffer_delegate_t

6.6.5.12 v_sync_t

6.6.5.13 vram_ex_stack_t

6.6.5.14 graphics_image_properties_t

6.6.5.15 graphics_composite_operation_t

6.6.5.16 graphics_status_t

6.6.5.17 graphics_matrix_float_t

6.6.5.18 repetition_t

6.6.5.19 r8g8b8a8_t

6.6.5.20 background_format_t

6.6.5.21 animation_timing_function_t

6.6.5.22 graphics_jpeg_decoder_t

6.6.5.23 graphics_async_status_t

Drawing destination frame buffer

Type for setting graphics_t

Defaultable flag indicating drawing quality

Frame buffer and screen display sample window_surfaces_t setting

Parameter of the

R_WINDOW_SURFACES_AccessLayerAttributes function

Operations such as specifying set values (write) and acquiring set values (read)

Number of bytes per pixel

Pixel format

Data related to frame buffer

V-Sync signal synchronization of display screen

Stack for off-screen buffer in external RAM

Properties of the image

Type of composite operation

Area to store graphics drawing context

Element of matrix

Pattern repetition type

Pixel format arranged in the order of R, G, B, and A

Contents of background layer.

Timing of animation (Bezier function)

Constant value of a kind of JPEG decoder

Status of drawing graphics and interrupt status

6.6.5.2 frame_buffer_t

Outline

Header

Drawing destination frame buffer type

RGA.h, frame_buffer.h

Description

Member

Variable uint8_t* buffer_address[ ] Array of starting address of the frame buffer, logical address of cache area (same as normal variables).

Specify a multiple of 32. int_fast32_t buffer_count Number of buffer_address array elements (1: Single buffer, 2: Double buffers) int_fast32_t show_buffer_index Buffer number being displayed or used as source image (buffer_address array number) int_fast32_t draw_buffer_index Buffer number being drawn (buffer_address array number) int_fast32_t width byte_per_pixel_t byte_per_pixel

Frame buffer width (pixels). See Figure 1-2

Number of bytes per pixel. See Table 1-2

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 29 of 127

RZ/A1H RGA int_fast32_t stride int_fast32_t height pixel_format_t pixel_format frame_buffer_delegate_t* delegate

Number of bytes of pixels having the same x coordinate in the previously below line. Specify a multiple of 32.

Frame buffer height (pixels). See Figure 1-2

Pixel format. See Table 1-2

User-defined variable

Sample: static uint8_t gs_frame_buffer_memory[2][800][480][4]; frame_buffer_t frame; frame.buffer_address[0] = gs_frame_buffer_memory [0]; frame.buffer_address[1] = gs_frame_buffer_memory [1]; frame.buffer_count = 2; frame.show_buffer_index = 0; frame.draw_buffer_index = 1; frame.width = 800; frame.byte_per_pixel = 4; frame.stride = 800 * 4; frame.height = 480 frame.pixel_format = PIXEL_FORMAT_ARGB8888; frame.delegate = NULL;

6.6.5.3 graphics_config_t

Outline

Header

Descriptio n

Member

Variable

Configuration of graphics_t type

RGA.h

To customize default values or assemble essential settings, use the function described in

section 6.10.1.3 R_GRAPHICS_OnInitialize_FuncType.

bit_flags_fast32_t flags

See section 6.11.8, Flagged Structure Parameters. (mandatory)

F_GRAPHICS_FRAME_BUFFER

F_GRAPHICS_WORK_BUFFER_ADDRESS

F_GRAPHICS_WORK_BUFFER_SIZE

F_GRAPHICS_MAX_HEIGHT_OF_FRAME_BUFFER

F_GRAPHICS_QUALITY_FLAGS

F_GRAPHICS_BACKGROUND_COLOR

F_GRAPHICS_IS_FAST_MANUAL_FLUSH frame_buffer_t* frame_buffer

F_GRAPHICS_WORK_BUFFER_B_ADDRESS

F_GRAPHICS_WORK_BUFFER_B_SIZE

F_GRAPHICS_JPEG_DECODER

F_GRAPHICS_WORK_SIZE_FOR_LIBPNG

F_GRAPHICS_INTERNAL_EVENT_VALUE

F_GRAPHICS_LOCK_OBJECT

F_GRAPHICS_CHANNEL_OF_DMAC_1

F_GRAPHICS_CHANNEL_OF_DMAC_2

F_GRAPHICS_EVENT_VALUE_OF_DMAC_1

F_GRAPHICS_EVENT_VALUE_OF_DMAC_2

Frame buffer to be drawn for which member variables must be set.

Set the address of frame_buffer_t type structure. void* work_buffer_address

Work buffer starting address that must be set, if in following condition. Set this address in uncached area.

 Drawing Raw format image

 Using work buffer B

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 30 of 127

RZ/A1H RGA size_t work_buffer_size Size (bytes) of work buffer used internally

Set this with "work_buffer_address"

See section 6.9.14.3, R_RGA_CalcWorkBufferSize.

int_fast32_t max_height_of_frame_buf fer

Maximum height of frame buffer to be drawn

Set this with "work_buffer_address"

Drawing quality. See 6.6.5.4.

graphics_quality_flags_t quality_flags r8g8b8a8_t background_color

Background color. See 6.9.1.25.

bool_t is_fast_manual_flush void* work_buffer_b_address

Whether the mode is fast manual flush mode. See 6.11.5.

size_t work_buffer_b_size

Work buffer B starting address that must be set, if in following condition.

 X coord value of left of JPEG image is not alignment by 4, when frame buffer was 16 bit color.

 X coord value of left of JPEG image is not alignment by 2, when frame buffer was 32 bit color.

 Drawing JPEG image with matrix

Size (bytes) of work buffer B

Set this with "work_buffer_b_address"

See 6.9.14.4, R_RGA_CalcWorkBufferB_Size.

Using JPEG decoder graphics_jpeg_decoder_t jpeg_decoder size_t work_size_for_libPNG bit_flags32_t internal_event_value

BSP_CFG_USER_LOCKI

NG_TYPE* lock_object

Size (bytes) of memory area as heap area allocated by PNG decoding. This memory area is allocated in work buffer B.

The value of thread attached event.

Default value is R_OSPL_UNUSED_FLAG.

Application can not wait this value.

See application note of OSPL.

Lock object managing right to use RGA.

Lock area is from R_GRAPHICS_Initialize function to

R_GRAPHICS_Finalize function.

See application note of OSPL.

Channel number of DMAC used in RGA. int_fast32_t channel_of_DMAC_1 int_fast32_t channel_of_DMAC_2 int_fast32_t event_value_of_DMAC_1 int_fast32_t event_value_of_DMAC_2

Channel number of DMAC used in RGA.

Flag of notification event as the end of DMA transfer.

Flag of notification event as the end of DMA transfer.

6.6.5.4 graphics_quality_flags_t

This is a defaultable flag indicating the drawing quality. See section 6.11.9, Defaultable Flags.

#include "RGA.h"

Constant Name

GRAPHICS_RENDERING_QUALITY_ANTIALIASED

Value

1

Description

Enable the antialiasing at the borders

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 31 of 127

RZ/A1H RGA

GRAPHICS_RENDERING_QUALITY_NONANTIALIASED 1<<16 Disable the antialiasing at the borders

GRAPHICS_IMAGE_QUALITY_ANTIALIASED 2 Enable the interpolation filter for image

GRAPHICS_IMAGE_QUALITY_NONANTIALIASED 2<<16 Disable the interpolation filter for image

6.6.5.5 window_surfaces_t

Outline

Header

This is a sample type of the frame buffer and screen display

RGA.h, window_surfaces.h

Description

For the function equivalent to the member function, see section 6.9.9.

Member Variable Access Inhibit

6.6.5.6 window_surfaces_config_t

Outline

Header

Description

This is a type that sets window_surfaces_t.

RGA.h, window_surfaces.h

Member Variable

bit_flags_fast32_t flags For flags, see section 6.11.8, Flagged Structure

Parameters.

F_WINDOW_SURFACES_PIXEL_FORMAT

F_WINDOW_SURFACES_LAYER_COUNT

F_WINDOW_SURFACES_BACKGROUND_COLOR

F_WINDOW_SURFACES_BUFFER_HEIGHT

F_WINDOW_SURFACES_BACKGROUND_FORMAT

F_WINDOW_SURFACES_BUFFER_COUNT_MAX pixel_format_t pixel_format int_fast32_t layer_count

Pixel format of showing window. See section 6.6.5.10.

[Condition] The following value can be set for the sample of RZ/A1H.

 PIXEL_FORMAT_ARGB8888

 PIXEL_FORMAT_XRGB8888

 PIXEL_FORMAT_RGB565 (default)

 PIXEL_FORMAT_ARGB4444

 PIXEL_FORMAT_ARGB1555

 PIXEL_FORMAT_YCbCr422

 PIXEL_FORMAT_CLUT1

 PIXEL_FORMAT_CLUT4

 PIXEL_FORMAT_CLUT8

Count of creating layer.

Default is 1.

If count was 2, all pixel formats of layers are same. But,

If pixel format was "PIXEL_FORMAT_YCbCr422", overlay layer's format is "PIXEL_FORMAT_ARGB4444" r8g8b8a8_t background_color int_fast32_t buffer_height

Background color. See 6.6.5.19 and 6.9.1.25.

Default is "R_RGA_Get_R8G8B8A8( 255, 255, 255, 0 )".

Height of the frame buffer.

Default is the height of the screen.

Contents of background layer. See 6.6.5.20.

background_format_t background_format int_fast32_t buffer_count_max

Max count of frame buffer in one layer. Default is 2.

[Setting range] 1 or 2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 32 of 127

RZ/A1H RGA

6.6.5.7 layer_attributes_t

Outline

Header

Description

The following lists parameter types of the "R_WINDOW_SURFACES

_AccessLayerAttributes" function

RGA.h, window_surfaces.h

See Layer structure of sample screen controller

Member Variable access_t access bit_flags_fast32_t flags

Whether to set or acquire values (essential)

Section 6.11.8, Flagged Structure Parameters

(essential)

Above value logical or. (e.g.) F_LAYER_ID int_fast32_t id Layer number to be accessed (-1: background)

(essential). See 6.11.7.

Reserved int_fast32_t priority bool_t is_show r8g8b8a8_t color_key bool_t is_color_key

Reserved

Reserved

Reserved r8g8b8a8_t layer_color Color of entire layer (available only for ID = -1). See

6.6.5.19 and 6.9.1.25.

int_fast32_t x Left position of layer window (pixel) int_fast32_t y int_fast32_t width int_fast32_t height int_fast32_t offset_x

Top position of layer window (pixel)

Width of layer window (pixel)

Height of layer window (pixel)

X coord in frame buffer at left end of layer window int_fast32_t offset_y uint32_t* CLUT

Y coord in frame buffer at top end of layer window

Array of colors to set to CLUT (Color Look Up Table).

(optional)

Set "CLUT" of graphics_image_properties_t (section

6.6.5.14).

Pixel format is ARGB8888.

If CLUT was overwritten for second image, first image using CLUT is not shown correctly. int_fast32_t CLUT_count Count of elements of CLUT. Set this with "CLUT" variable.

Set "CLUT_count" of graphics_image_properties_t

(section 6.6.5.14).

[Setting range] Max is 256(CLUT8), 16(CLUT4),

2(CLUT1).

6.6.5.8 access_t

This is a type that specifies Write (setting set values) or Read (acquiring set values).

Constant Name Value Description

ACCESS_READ

ACCESS_WRITE

1 Read values

2 Write values

6.6.5.9 byte_per_pixel_t

#include "RGA.h" typedef int byte_per_pixel_t;

This is a type of number of bytes per pixel. See Table 1-2.

When one pixel is less than one byte (BitPerPixel < 8), a value shifted from the number of bits per pixel is set.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 33 of 127

RZ/A1H

When 1 pixel is 1 byte or more:

0

15

0

8 7

When 1 pixel is less than 1 byte:

0

15 8 7

Number of bits

For related functions, see section 6.9.10.

6.6.5.10 pixel_format_t

This is a pixel format type.

See Table 1-3.

#include "RGA.h" /* or "frame_buffer.h" */

Constant Name Value Value Description

PIXEL_FORMAT_UNKNOWN

PIXEL_FORMAT_ARGB8888

PIXEL_FORMAT_RGB565

PIXEL_FORMAT_ARGB4444

PIXEL_FORMAT_A1

PIXEL_FORMAT_A4

PIXEL_FORMAT_A8

PIXEL_FORMAT_RGB888

PIXEL_FORMAT_R8G8B8A8

PIXEL_FORMAT_XRGB8888

PIXEL_FORMAT_ARGB1555

PIXEL_FORMAT_YCbCr422

PIXEL_FORMAT_YUV422

PIXEL_FORMAT_YUV422_G

RAY_SCALE_IS_0x80

PIXEL_FORMAT_JPEG

PIXEL_FORMAT_PNG

PIXEL_FORMAT_GIF

PIXEL_FORMAT_CLUT1

PIXEL_FORMAT_CLUT4

PIXEL_FORMAT_CLUT8

0 0x00

1 0x01

3 0x03

5 0x05

13 0x0D

14 0x0E

11 0x0B

15 0x0F

6 | (1 << 4) 0x16

0 | (1 << 6) 0x40

4 | (1 << 6) 0x44

12 | (2 << 8) 0x20C

12 | (3 << 8) 0x30C

12 | (4 << 8) 0x40C

12 | (1 << 12) 0x100C

12 | (4 << 12) 0x400C

12 | (8 << 12) 0x800C

Unknown

ARGB8888

RGB565

ARGB4444

1bit alpha

4bit alpha

8bit alpha

RGB888 (Reserved)

R8G8B8A8

XRGB8888

ARGB1555

2 | (1 << 16) 0x10002 YCbCr422

2 | (1 << 16) 0x10002 YUV422

2 | (1 << 16) 0x10002 YCbCr422

Cb, Cr = 0x80 is gray

JPEG

PNG

GIF (Reserved)

1 bit CLUT

4 bit CLUT

8 bit CLUT

6.6.5.11 frame_buffer_delegate_t

This is a class of objects referenced from the delegate member variable of frame_buffer_t.

This class can be defined by libraries that use frame_buffer_t or by the application.

This class is defined as follows by default. Therefore, frame_buffer_t::delegate is a void* type.

#include "RGA.h" typedef void frame_buffer_delegate_t;

To change the type, define the type before performing #include for the header file that defines frame_buffer_delegate_t, and then perform #define frame_buffer_delegate_t frame_buffer_delegate_t.

0

RGA

0

Number of bytes

0

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 34 of 127

RZ/A1H RGA typedef MyFrameBufferClass frame_buffer_delegate_t;

#define frame_buffer_delegate_t frame_buffer_delegate_t

#include "RGA.h" /* default define frame_buffer_delegate_t */

6.6.5.12 v_sync_t

Outline

Header

Synchronization with the V-Sync signal of the display screen.

RGA.h, vsync.h

Description

Function equivalent to the member function: See section 6.9.11.

Member Variable Access Inhibit

6.6.5.13 vram_ex_stack_t

Outline

Header

Description

This is a sample code of stack class for off-screen buffer in external RAM

RGA.h, RGA_SampleLib_Port.h

Function equivalent to the member function: See section 6.9.12.

For RZ/A1H, Video Display Controller 5 (VDC5) must not show the frame buffer in external RAM. Show the frame buffer in internal RAM copied from external RAM.

Member Variable Access Inhibit

6.6.5.14 graphics_image_properties_t

Outline

Header

This is a type of image properties.

RGA.h

Description

Related function : (6.9.2.6) R_GRAPHICS_IMAGE_GetProperties

If the source image is created in the program, call

"R_GRAPHICS_IMAGE_InitByShareFrameBuffer" function (6.9.2.5).

int_fast32_t width Width of image (pixel) Member

Variable int_fast32_t height uint8_t* data void* pixels

Height of image (pixel)

First address of array of image pixels. If the image format is not

R8G8B8A8, this value is NULL

First address of array of image pixels. Even if the image format is not R8G8B8A8, this value is available.

Pixel format pixel_format_t pixelFormat uint32_t* CLUT int_fast32_t

CLUT_count

CLUT (Color Look Up Table, Palette). Array of colors. If the image does not have CLUT, this value is NULL. Set to

"layer_attributes_t" (6.6.5.7).

Count of array elements of CLUT. Set to "layer_attributes_t"

(6.6.5.7).

6.6.5.15 graphics_composite_operation_t

This is a calculation method type for alpha blend.

#include "RGA.h"

Constant Name

GRAPHICS_SOURCE

_OVER

1

GRAPHICS_DESTINA

TION_OUT

7

Value Description

Performs calculation (SRC over DST) of general alpha blend.

Whether the calculation formula is the premultiplied alpha expression depends on whether alpha is present in the flag included in the header of an image to be drawn or in the drawing target pixel format. (default)

This type is used for drawing the inverted alpha mask.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 35 of 127

RZ/A1H RGA

GRAPHICS_COPY 0

Only the alpha component of drawing destination varies according to the following expression. a_dst = a_dst * ( 1 - a_src )

When drawing an image on a frame buffer without alpha component,

GRAPHICS_DESTINATION_OUT cannot be set.

When the final drawing destination is XRGB8888, draw the inverted alpha mask on the back buffer of ARGB8888.

Set 255 for the R_GRAPHICS_SetGlobalAlpha function or the globalAlpha property.

Performs no alpha blend and copy from source image data. It may be fast at that rate.

For faster, when PNG image with alpha channel was decoded to the back buffer, if CRAPHICS_COPY was specified, it is not necessary to clear the back buffer on ahead.

6.6.5.16 graphics_status_t

Outline

Header

Description

This is an area type that stores graphics drawing context.

RGA.h

Function equivalent to the member function:

 6.9.1.11 R_GRAPHICS_Save

 6.9.1.12 R_GRAPHICS_Restore

Member Variable Access Inhibit

6.6.5.17 graphics_matrix_float_t

This is a matrix element type.

#include "RGA.h" typedef float graphics_matrix_float_t;

6.6.5.18 repetition_t

This is a type that specifies the pattern repetition method.

#include "RGA.h"

Constant Name Value Description

GRAPHICS_REPEAT 1 Repeating

6.6.5.19 r8g8b8a8_t

Outline

Header

Pixel format in which bytes are arranged in the order of red, green, blue, and alpha

RGA.h

Description [Setting range] A value of 0 (black, transparent) to 255 (light, opaque) is specified for each of red, green, blue, and alpha.

Member Variable uint8_t u.red Red uint8_t u.green uint8_t u.blue uint8_t u.alpha

Green

Blue

Alpha, opaque level

6.6.5.20 background_format_t

Contents of background layer.

#include "window_surfaces.h"

Constant Name Value Description

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 36 of 127

RZ/A1H

BACKGROUND_FORMAT_SOLID_COLOR 0

BACKGROUND_FORMAT_VIDEO_INTERLACE 1

Solid color

Video of interlace format

6.6.5.21 animation_timing_function_t

Outline

Header

This is an object describing timing of animation (Bezier function).

RGA.h

Description

For the function equivalent to the member function, see section 6.9.13.

Member Variable Access Inhibit

6.6.5.22 graphics_jpeg_decoder_t

Constant value of a kind of JPEG decoder.

#include "RGA.h"

RGA

Constant Name Value Description

GRAPHICS_JPEG_DECODER_NONE 0 Not used JPEG decoder. JPEG hardware decoder can be used from any other than RGA.

JPEG hardware decoder. (default) GRAPHICS_JPEG_DECODER_HARD 1

6.6.5.23 graphics_async_status_t

Outline

Header

Status of drawing graphics and interrupt status

RGA.h

Description

Member Variable r_ospl_async_state_t

State

Status of drawing graphics. Inhibit write access. This value will update by calling

R_GRAPHICS_GetAsyncStatus function.

See r_ospl_async_state_t type - OS Porting Layer

"OSPL" Sample Program

Others are access inhibit

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 37 of 127

RZ/A1H RGA

6.6.6 String Format

6.6.6.1

#rrggbb, #rgb

This format describes a color by hex number of CSS Color format

Target : fillStyle (6.8.1.3) e.g.) "#FFFF00" : Red component is 255, Green component is 255, Blue component is 0 and Alpha component is 1.0 e.g.) "#FF0" : Red component is 255, Green component is 255, Blue component is 0 and Alpha component is 1.0

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 38 of 127

Type

NCGvoid

NCGenum

NCGboolean

NCGbitfield

NCGchar

NCGint8

NCGint16

NCGint32

NCGint64

NCGuint8

NCGuint16

NCGuint32

NCGuint64

NCGfloat32

NCGfloat64

NCGsizei

NCGclampf

NCGfixed

RZ/A1H

6.6.7

6.6.7.1

Type of porting layers

List

RGA

Description

Abstract of void type for RGPNCG

Abstract of enumeration type for RGPNCG

6

Abstract of _Bool type for RGPNCG

Abstract of bit flags type for RGPNCG

6

Abstract of string type for RGPNCG

Abstract of int8_t type for RGPNCG

6

Abstract of int16_t type for RGPNCG 6

Abstract of int32_t type for RGPNCG

Abstract of int64_t type for RGPNCG

6

Abstract of uint8_t type for RGPNCG

6

Abstract of uint16_t type for RGPNCG

6

Abstract of uint32_t type for RGPNCG

Abstract of uint64_t type for RGPNCG

6

Abstract of IEEE 754 single precision floating point number type for RGPNCG

6

Abstract of IEEE 754 double precision floating point number type for RGPNCG

6

Unsigned integer type described a size for RGPNCG

6

Abstract of floating point number type let the value from 0.0 to 1.0 for RGPNCG

6

Abstract of fixed point number type for RGPNCG

6

6

Not used in RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 39 of 127

RZ/A1H RGA

6.6.8 Changing state of class

Figure 6-1 shows a Figure of changing state of graphics_t class, and Table 6-1 shows List of functions of each classes having R_*_Finalize member function. The function not changing state can be called at Normal state.

Start state

Undefined

R_GRAPHICS_InitConst

R_GRAPHICS_Finalize

Uninitialized

R_GRAPHICS_Initialize

Normal

Figure 6-1 Figure of changing state of graphics_t class

Table 6-1 List of functions of each classes having R_*_Finalize member function

Class Undefined to Uninitialized Uninitialized to Normal Normal to Uninitialized graphics_t R_GRAPHICS_InitConst R_GRAPHICS_Initialize R_GRAPHICS_Finalize

Figure 6-2 shows a Figure of changing state of graphics_pattern_t class, and Table 6-2 shows List of functions of each classes not having R_*_Finalize member function. The function not changing state can be called at Normal state.

Start state

Undefined

R_GRAPHICS_PATTERN_Initialize

Normal

Figure 6-2 Figure of changing state of graphics_pattern_t class

Table 6-2 List of functions of each classes not having R_*_Finalize member function

Class graphics_image _t graphics_pattern_t

Undefined to Normal

R_GRAPHICS_IMAGE_InitR8G8B8A8

R_GRAPHICS_IMAGE_InitSameSizeR8G8B8A8

R_GRAPHICS_IMAGE_InitCopyFrameBufferR8G8B8A8

R_GRAPHICS_IMAGE_InitByShareFrameBuffer

The object created by ImagePackager is Normal state at the start state.

R_GRAPHICS_PATTERN_Initialize

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 40 of 127

RZ/A1H RGA

6.7 List of Variables

Table 6-3 shows Global Variables, Table 6-4 shows Static-Type Variables, and Table 6-5 shows Const-Type Variables.

Table 6-3 Global Variables

Variable

Type

Description

Applicable Function

None

Table 6-4 Static-Type Variables

Variable

Type

None

Table 6-5 Const-Type Variables

Variable

Type

None

Description

Description

Applicable Function

Applicable Function

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 41 of 127

RZ/A1H

6.8 Properties

6.8.1

6.8.1.1

Canvas2D_ContextClass Properties

List of Properties

RGA

Section Property Description

6.8.1.2

c_LanguageContext

6.8.1.3

fillStyle

6.8.1.4

globalAlpha One alpha value (opacity) multiplied by all drawings

6.8.1.5

globalCompositeOperation Calculation method for alpha blend

Context available for the C language API

Fill style

6.8.1.2 c_LanguageContext graphics_t* Canvas2D_ContextClass::c_LanguageContext; /* get only */

This property is a context available for the C language API.

Refer to this property when using a function that is provided by the C language API but is not provided by the

C++API.

6.8.1.3 fillStyle char* Canvas2D_ContextClass::fillStyle; /* set only */ /* CSS color */

Canvas2D_PatternClass Canvas2D_ContextClass::fillStyle; /* set only */

This property specifies a fill method. This property has the value of either type shown below.

For the char* type, this property specifies the single-color fill color expressed by CSS Color.

For the Canvas2D_PatternClass type, this property specifies pattern.

When the char* type is specified, the fill method is single-color fill. Refer to #rrggbb, #rgb (6.6.6.1), rgb (6.9.15.2), rgba (6.9.15.3)

The initial value is opaque black.

Use the fillRect method for drawing patterns.

6.8.1.4 globalAlpha float32_t Canvas2D_ContextClass::globalAlpha; /* get,set */

This property retains a single alpha value (opacity) to be multiplied by all drawings.

The default value is 1.0.

If a value less than 0.0 is set, 0.0 is retained.

If a value larger than 1.0 is set, 1.0 is retained.

This property affects the following drawing functions.

 Figure fill functions such as fillRect (Canvas2D_ContextClass)

 Pattern drawing functions such as fillRect (Canvas2D_ContextClass)

 Border drawing functions such as strokeRect (Canvas2D_ContextClass)

 Image drawing functions such as drawImage (Canvas2D_ContextClass)

This property does not affect the following drawing function.

 clearRect (Canvas2D_ContextClass)

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 42 of 127

RZ/A1H

6.8.1.5 globalCompositeOperation char* Canvas2D_ContextClass::globalCompositeOperation; /* get,set */

This property retains the calculation method for alpha blend. See section 6.6.5.15.

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 43 of 127

RZ/A1H

6.8.2

6.8.2.1

Canvas2D_ImageClass Properties

List of Properties

Section Property Description

6.8.2.2

src

6.8.2.3

width

6.8.2.4

height

6.8.2.5

data

Image data structure

Image width

Image height

Array containing pixel color components

6.8.2.2 src graphics_image_t Canvas2D_ImageClass::src; /* set only */

This property retains the raw image data structure created by ImagePackager.

6.8.2.3 width int_t Canvas2D_ImageClass::width; /* get only */

This property retains the image width.

6.8.2.4 height int_t Canvas2D_ImageClass::height; /* get only */

This property retains the image height.

6.8.2.5 data uint8_t* Canvas2D_ImageClass::data; /* get only */

This property is an array containing pixel color components.

Upper left is the top.

Color components are arranged in the order of R, G, B, and A.

R, G, B, A: 0 to 255

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 44 of 127

RZ/A1H

6.9 Functions and Methods

6.9.1

6.9.1.1

Functions Equivalent to graphics_t Class Member Function

List of Functions

RGA

Section Function Name Description

6.9.1.2

R_GRAPHICS_InitConst

6.9.1.3

R_GRAPHICS_Initialize

6.9.1.4

R_GRAPHICS_Finalize

6.9.1.5

R_GRAPHICS_SetFrameBuffer

6.9.1.6

R_GRAPHICS_GetFrameBuffer

6.9.1.7

R_GRAPHICS_Finish

6.9.1.8

R_GRAPHICS_FinishStart

Initializes the constant part.

Initializes the graphics drawing context object.

Finalizes the graphics drawing context object.

Changes the drawing target.

Gets the drawing target.

Waits until drawing is completed.

Starts to wait for drawing

6.9.1.9

R_GRAPHICS_GetAsyncStatus

6.9.1.10 R_GRAPHICS_OnInterrupting

6.9.1.11 R_GRAPHICS_Save

Gets the status of asynchronous operation and interrupt

Receives interrupts of drawing hardware

Saves the set value of context to the specified status structure.

Returns the status structure content to context.

6.9.1.12 R_GRAPHICS_Restore

6.9.1.13 R_GRAPHICS_ResetMatrix

6.9.1.14 R_GRAPHICS_SetMatrix_2x3

6.9.1.15 R_GRAPHICS_SetMatrix_3x3

6.9.1.16 R_GRAPHICS_GetMatrix_3x3

Resets the target matrix of the matrix calculation function to the unit matrix.

Sets each element of the matrix. (2x3)

Sets each element of the matrix. (3x3)

Acquires each element of the matrix.

6.9.1.17 R_GRAPHICS_TranslateMatrixI

6.9.1.18 R_GRAPHICS_TranslateMatrix

Translates matrix from the current matrix. (integer type specified)

Translate matrix from the current matrix. (floating-point type specified)

Enlarges or reduces matrix from the current matrix.

6.9.1.19 R_GRAPHICS_ScaleMatrix

6.9.1.20 R_GRAPHICS_RotateMatrixDegree

Rotates matrix from the current matrix. Rotation center:

(0,0)

6.9.1.21 R_GRAPHICS_ShearMatrix

6.9.1.22 R_GRAPHICS_TransformMatrix

6.9.1.23 R_GRAPHICS_MultiplyMatrix

6.9.1.24 R_GRAPHICS_GetProjectiveMatrix

Makes shear deformation from the current matrix.

Multiplies the current matrix by the specified 2x3 matrix.

Multiplies the current matrix by the specified 3x3 matrix.

Acquires a matrix that deforms a random profile quadrangle to a random profile quadrangle.

6.9.1.25 R_GRAPHICS_SetBackgroundColor

Sets the background color.

6.9.1.26 R_GRAPHICS_GetBackgroundColor

Acquires the background color.

6.9.1.27 R_GRAPHICS_GetClearColor

6.9.1.28 R_GRAPHICS_Clear

Acquires the color used for R_GRAPHICS_Clear.

Clears rectangle area.

6.9.1.29 R_GRAPHICS_DrawImage

6.9.1.30 R_GRAPHICS_DrawImageResized

6.9.1.31 R_GRAPHICS_DrawImageChild

6.9.1.32 R_GRAPHICS_FillRect

6.9.1.33 R_GRAPHICS_SetFillColor

Draws an image.

Enlarges or reduces an image and draws it in a rectangle.

Draws a part of an image.

Fills a rectangle.

6.9.1.34 R_GRAPHICS_SetFillPattern

6.9.1.35 R_GRAPHICS_BeginPath

6.9.1.36 R_GRAPHICS_Rect

Sets the color used for single-color fill for the current fill paint object.

Sets a pattern for the current fill paint object.

Resets the default path content to null.

Adds a rectangle to the default path.

6.9.1.37 R_GRAPHICS_Clip

6.9.1.38 R_GRAPHICS_SetGlobalAlpha

Sets the shape of the current default path to a clipping area.

Sets an alpha value (opacity) to be multiplied by all drawings.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 45 of 127

RZ/A1H RGA

6.9.1.39 R_GRAPHICS_GetGlobalAlpha

6.9.1.40 R_GRAPHICS_SetGlobalCompositeO

peration

6.9.1.41 R_GRAPHICS_GetGlobalComposite

Operation

6.9.1.42 R_GRAPHICS_STATIC_SetOnInitiali

ze

6.9.1.43 R_GRAPHICS_STATIC_SetOnFinaliz

e

6.9.1.44 R_GRAPHICS_SetQualityFlags

6.9.1.45 R_GRAPHICS_GetQualityFlags

6.9.1.46 R_GRAPHICS_SetStrokeColor

6.9.1.47 R_GRAPHICS_StrokeRect

6.9.1.48 R_GRAPHICS_BeginSoftwareRender

ing

6.9.1.49 R_GRAPHICS_EndSoftwareRenderin

g

6.9.1.50 R_GRAPHICS_EndRenderingInFin

6.9.1.51 R_GRAPHICS_BeginSoftwareRender

ing2

6.9.1.52 R_GRAPHICS_BeginSoftwareRender

ingA

Acquires an alpha value (opacity) to be multiplied by all drawings.

Sets the calculation method for alpha blend.

Acquires the calculation method for alpha blend.

Registers a callback function that sets the default graphics_config_t value.

Registers a function that releases the memory allocated in the R_GRAPHICS_OnInitialize_FuncType function.

Sets the drawing quality.

Acquires the current drawing quality.

Sets the color used for single-color fill for the paint object of the current border.

Draws sides of rectangle.

Notifies the graphics library of the start of software rendering.

Notifies the graphics library of the end of software rendering.

Calls this function from the end of the function that performs software rendering.

R_GRAPHICS_BeginSoftwareRendering for the memory on L2 cache.

Calls R_GRAPHICS_BeginSoftwareRendering2 depending on the address.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 46 of 127

RZ/A1H RGA

6.9.1.2

R_GRAPHICS_InitConst

Outline

Header

Declaration

Description

Argument

Return value

6.9.1.3

Initializes the constant part used by the RGA.

RGA.h void R_GRAPHICS_InitConst( graphics_t* self );

Refer to section 6.11.9, Function to Initialize Internal Variables with Constants

(*_initConst Function). graphics_t* self

None

R_GRAPHICS_Initialize

Graphics drawing context

Outline

Header

Declaration

Description

Argument

Return value

6.9.1.4

Initializes the graphics drawing context object.

RGA.h errnum_t R_GRAPHICS_Initialize (graphics_t* self, graphics_config_t* config );

Initializes internal variables.

Initializes

Renesas Graphics Processor for OpenVG™ (R-GPVG2) and JPEG Codec

Unit (JCU).

For the built-in version, register the interrupt handler before calling this function.

When "self" is no longer be used, call R_GRAPHICS_Finalize.

There is only one context. When two or more frame buffers was drawn, change the frame buffer by "R_GRAPHICS_SetFrameBuffer" function. graphics_t* self graphics_config_t* config

Graphics drawing context

See section 6.6.5.3.

Error code. If there is no error, the return value is 0. See section 7.2.

R_GRAPHICS_Finalize

Outline

Header

Declaration

Description

Argument

Return value

6.9.1.5

Finalizes the graphics drawing context object.

RGA.h errnum_t R_GRAPHICS_Finalize( graphics_t* self, errnum_t e ); graphics_t* self errnum_t e

Graphics drawing context

Errors that have occurred. No error = 0

Error code or e 0 = successful and e = 0. See section 6.11.11, 7.2.

R_GRAPHICS_SetFrameBuffer

Outline

Header

Declaration

Description

Argument

Return value

6.9.1.6

Changes the drawing target.

RGA.h errnum_t R_GRAPHICS_SetFrameBuffer( graphics_t* self, frame_buffer_t* frame_buffer ); graphics_t* self frame_buffer_t* frame_buffer

Graphics drawing context

Frame buffer to be drawn

Error code. If there is no error, the return value is 0. See section 7.2.

R_GRAPHICS_GetFrameBuffer

Outline

Header

Declaration

Description

Argument

Return value

Gets the drawing target.

RGA.h errnum_t R_GRAPHICS_GetFrameBuffer( graphics_t* self, frame_buffer_t** out_frame_buffer ); graphics_t* self frame_buffer_t** out_frame_buffer

Graphics drawing context

(Output) Frame buffer to be drawn

Error code. If there is no error, the return value is 0. See section 7.2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 47 of 127

RZ/A1H RGA

6.9.1.7

R_GRAPHICS_Finish

Outline

Header

Declaration

Description

Argument

Return value

6.9.1.8

Waits until drawing is completed.

RGA.h errnum_t R_GRAPHICS_Finish( graphics_t* self );

This waits for finish drawing by RGA or by the application directly to the frame buffer and changes to the state to able to show the frame buffer.

In fast manual flush mode (see section 6.11.5), when the CPU directly reads or

writes frame buffer data in the cache area or non-cache area after the RGA API is called, enclose by calling R_GRAPHICS_BeginSoftwareRendering to

R_GRAPHICS_EndSoftwareRendering. These functions wait hardware rendering and flush the CPU cache only if necessary.

If the process waits for finish drawing asynchronously, call

"R_GRAPHICS_FinishStart" function. graphics_t* self Graphics drawing context

Error code. If there is no error, the return value is 0. See section 7.2.

R_GRAPHICS_FinishStart

Outline

Header

Declaration

Description

Argument

Starts to wait for drawing

RGA.h errnum_t R_GRAPHICS_FinishStart( graphics_t* self, r_ospl_async_t* Async );

This is asynchronous version of R_GRAPHICS_Finish function.

See R_DRIVER_TransferStart function - OS Porting Layer "OSPL" Sample Program. graphics_t* self r_ospl_async_t* Async

Graphics drawing context

(Input/Output) Notify setting. NULL is not permitted

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.1.9

R_GRAPHICS_GetAsyncStatus

Outline

Header

Declaration

Description

Argument

Gets the status of asynchronous operation and interrupt

RGA.h errnum_t R_GRAPHICS_GetAsyncStatus( graphics_t* self, const graphics_async_status_t** out_Status );

See R_DRIVER_GetAsyncStatus function - OS Porting Layer "OSPL" Sample

Program. graphics_t* self Graphics drawing context const graphics_async_status_t** out_Status

(Output) Pointer to the structure of interrupt and asynchronous operation

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.1.10

R_GRAPHICS_OnInterrupting

Outline

Header

Declaration

Description

Argument

Return value

Receives interrupts of drawing hardware

RGA.h errnum_t R_GRAPHICS_OnInterrupting(void);

See R_DRIVER_OnInterrupting function - OS Porting Layer "OSPL" Sample

Program.

None

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.11

R_GRAPHICS_Save

Outline

Header

Declaration

Saves the set value of context to the specified status structure.

RGA.h errnum_t R_GRAPHICS_Save( graphics_t* self, graphics_status_t* out_status );

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 48 of 127

RZ/A1H RGA

Description

Argument

Return value graphics_t* self graphics_status_t* out_status

Graphics drawing context

(Output) Set value of context

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.12

R_GRAPHICS_Restore

Outline

Header

Declaration

Description

Argument

Returns the status structure content to context.

RGA.h errnum_t R_GRAPHICS_Restore( graphics_t* self, graphics_status_t* status, errnum_t e ); graphics_t* self graphics_status_t* status

Graphics drawing context

Set value of context

Return value errnum_t e Errors that have occurred. No error = 0

Error code or e 0 = successful and e = 0 See section 7.2.

6.9.1.13

R_GRAPHICS_ResetMatrix

Outline

Header

Declaration

Description

Resets the matrix to be a matrix calculation function target to the unit matrix.

RGA.h errnum_t R_GRAPHICS_ResetMatrix( graphics_t* self );

Argument

Return value graphics_t* self Graphics drawing context

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.14

R_GRAPHICS_SetMatrix_2x3

Outline

Header

Declaration

Description

Argument

Sets each element of the current matrix. (2x3)

RGA.h errnum_t R_GRAPHICS_SetMatrix_2x3( graphics_t* self,

graphics_matrix_float_t sx, graphics_matrix_float_t ky,

graphics_matrix_float_t kx, graphics_matrix_float_t sy,

graphics_matrix_float_t tx, graphics_matrix_float_t ty );

When the library was ported, take care computing error. graphics_t* self Graphics drawing context graphics_matrix_float_t sx, graphics_matrix_float_t ky, graphics_matrix_float_t kx,

2x3 matrix sx

( ky

0 kx tx sy ty

) graphics_matrix_float_t sy, graphics_matrix_float_t tx,

0 1 graphics_matrix_float_t ty

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.1.15

R_GRAPHICS_SetMatrix_3x3

Outline

Header

Declaration

Description

Argument

Sets each element of the current matrix (Matrix[]) (3x3).

RGA.h errnum_t R_GRAPHICS_SetMatrix_3x3( graphics_t* self, graphics_matrix_float_t

* matrix );

When the library was ported, take care computing error. graphics_t* self Graphics drawing context graphics_matrix_float_t * matrix

3x3 matrix (array)

(

Matrix[0]

Matrix[1]

Matrix[2]

Matrix[3]

Matrix[4]

Matrix[5]

Matrix[6]

Matrix[7]

)

Matrix[8]

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 49 of 127

RZ/A1H RGA

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.16

R_GRAPHICS_GetMatrix_3x3

Outline

Header

Declaration

Description

Argument

Acquires each element of the current matrix (Matrix[]).

RGA.h errnum_t R_GRAPHICS_GetMatrix_3x3( graphics_t* self, graphics_matrix_float_t

* out_matrix ); graphics_t* self graphics_matrix_float_t * out_matrix

Graphics drawing context

(Output) 3x3 matrix (array)

(

Matrix[0]

Matrix[1]

Matrix[2]

Matrix[3]

Matrix[4]

Matrix[5]

Matrix[6]

Matrix[7]

Matrix[8]

)

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.17

R_GRAPHICS_TranslateMatrixI

Outline

Header

Declaration

Description

Translates the current matrix (M). (Integer type specified)

RGA.h errnum_t R_GRAPHICS_TranslateMatrixI(graphics_t* self,

int_t tx, int_t ty );

1

M=M

(

0

0

0

1

0 tx ty

1

)

Argument

Return value graphics_t* self int_t tx, int_t ty

Graphics drawing context

Displacement (When the origin is at the upper left, plus of X means right direction and plus of Y means downward direction.)

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.18

R_GRAPHICS_TranslateMatrix

Outline

Header

Declaration

Description

Translates the current matrix (M). (Floating-point type specified)

RGA.h errnum_t R_GRAPHICS_TranslateMatrix( graphics_t* self,

graphics_matrix_float_t tx, graphics_matrix_float_t ty );

1 0 tx

M=M

(

0 1 ty

)

0 0 1

Argument

Return value graphics_t* self graphics_matrix_float_t tx graphics_matrix_float_t ty

Graphics drawing context

Displacement (When the origin is at the upper left, plus of X means right direction and plus of Y means downward direction.)

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.19

R_GRAPHICS_ScaleMatrix

Outline

Header

Declaration

Description

Enlarges or reduces the current matrix (M).

RGA.h errnum_t R_GRAPHICS_ScaleMatrix( graphics_t* self, graphics_matrix_float_t sx, graphics_matrix_float_t sy ); sx 0 0

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 50 of 127

RZ/A1H RGA

M=M

(

0

0 sy

0

0

1

)

Argument

Return value

When the library was ported, take care computing error. graphics_t* self Graphics drawing context graphics_matrix_float_t tx graphics_matrix_float_t ty

Magnification (Enlargement/reduction center: Origin)

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.20

R_GRAPHICS_RotateMatrixDegree

Outline

Header

Declaration

Description

Rotates the current matrix (M). The center coordinates of rotation are (0,0).

RGA.h errnum_t R_GRAPHICS_RotateMatrixDegree( graphics_t* self, graphics_matrix_float_t angle ); cos(angle) -sin(angle) 0

M=M

( sin(angle) cos(angle) 0

)

0 0 1

Argument

When the library was ported, take care computing error. graphics_t* self Graphics drawing context

Return value graphics_matrix_float_t angle Rotation angle (degrees) (When the origin is at the upper left, plus means clockwise direction.)

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.21

R_GRAPHICS_ShearMatrix

Outline

Header

Declaration

Description

Makes shear deformation of the current matrix (M).

RGA.h errnum_t R_GRAPHICS_ShearMatrix( graphics_t* self, graphics_matrix_float_t shx, graphics_matrix_float_t shy );

1 shx 0

M=M

( shy 1 0

)

0 0 1

When (shx, shy) = (1.0, 0.0), a parallelogram is generated with perpendicular sides tilted 45 degrees.

Note, however, that the matrix is shifted unless the origin is at the upper left of the rectangle.

When (shx, shy) = (-0.5, 0.0), a parallelogram is generated with hypotenuses of a triangle

(base : height = 1 : 2).

2

1

When (shx, shy) = (0.0, 1.0), a parallelogram is generated with horizontal sides tilted 45 degrees.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 51 of 127

RZ/A1H RGA

Argument

Return value

When the library was ported, take care computing error. graphics_t* self graphics_matrix_float_t shx

Graphics drawing context

Rate of shear (Shear center: Origin) graphics_matrix_float_t shy

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.22

R_GRAPHICS_TransformMatrix

Outline

Header

Declaration

Description

Multiplies the current matrix (M) by the specified 2x3 matrix.

RGA.h errnum_t R_GRAPHICS_TransformMatrix( graphics_t* self,

graphics_matrix_float_t sx, graphics_matrix_float_t ky,

graphics_matrix_float_t kx, graphics_matrix_float_t sy,

graphics_matrix_float_t tx, graphics_matrix_float_t ty ); sx kx tx

M=M

( ky sy ty

)

0 0 1

Argument

When the library was ported, take care computing error. graphics_t* self Graphics drawing context graphics_matrix_float_t sx graphics_matrix_float_t ky

2x3 matrix to be multiplied graphics_matrix_float_t kx graphics_matrix_float_t sy graphics_matrix_float_t tx graphics_matrix_float_t ty

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.1.23

R_GRAPHICS_MultiplyMatrix

Outline

Header

Declaration

Description

Multiplies the current matrix (M) by the specified 3x3 matrix (Matrix[]).

RGA.h errnum_t R_GRAPHICS_MultiplyMatrix( graphics_t* self, graphics_matrix_float_t

* matrix );

Matrix[0] Matrix[3] Matrix[6]

M=M

(

Matrix[1] Matrix[4] Matrix[7]

)

Matrix[2] Matrix[5] Matrix[8]

Argument

When the library was ported, take care computing error. graphics_t* self Graphics drawing context graphics_matrix_float_t * matrix

2x3 matrix to be multiplied (array with nine elements)

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.1.24

R_GRAPHICS_GetProjectiveMatrix

Outline

Header

Acquires a matrix that deforms a random profile quadrangle to a random profile quadrangle.

RGA.h

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 52 of 127

RZ/A1H RGA

Declaration

Description

Argument errnum_t R_GRAPHICS_GetProjectiveMatrix(

graphics_matrix_float_t source_top_left_x, graphics_matrix_float_t source_top_left_y,

graphics_matrix_float_t source_top_right_x, graphics_matrix_float_t source_top_right_y,

graphics_matrix_float_t source_bottom_left_x, graphics_matrix_float_t source_bottom_left_y ,

graphics_matrix_float_t source_bottom_right_x, graphics_matrix_float_t source_bottom_right_y,

graphics_matrix_float_t destination_top_left_x, graphics_matrix_float_t destination_top_lLeft_y,

graphics_matrix_float_t destination_top_right_x, graphics_matrix_float_t destination_top_right_y,

graphics_matrix_float_t destination_bottom_left_x, graphics_matrix_float_t destination_bottom_left_y,

graphics_matrix_float_t destination_bottom_right_x, graphics_matrix_float_t destination_bottom_right_y,

graphics_matrix_float_t * out_matrix );

When the library was ported, take care computing error. graphics_matrix_float_t source* Four-point coordinates before conversion graphics_matrix_float_t destination*

Four-point coordinates after conversion graphics_matrix_float_t * out_matrix

(Output) 3x3 matrix (array with nine elements)

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.25

R_GRAPHICS_SetBackgroundColor

Outline

Header

Declaration

Description

Sets the background color.

RGA.h errnum_t R_GRAPHICS_SetBackgroundColor( graphics_t* self, r8g8b8a8_t color );

When a frame buffer without alpha is to be drawn, the background color is the same as the clear color. The default background color is white.

When a frame buffer with alpha is to be drawn, the background color is specified color and the clear color drawing to the target is transparent black even if any color specified. Set the background color for the back layer for correct look.

. graphics_t* self Graphics drawing context Argument

Return value r8g8b8a8_t color Use R_RGA_Get_R8G8B8A8() to acquire the background color.

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.26

R_GRAPHICS_GetBackgroundColor

Outline

Header

Declaration

Description

Acquires the background color.

RGA.h errnum_t R_GRAPHICS_GetBackgroundColor(graphics_t* self, r8g8b8a8_t* out_color );

Argument

Return value graphics_t* self r8g8b8a8_t* out_color

Graphics drawing context

(Output) Background color

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.27

R_GRAPHICS_GetClearColor

Outline

Header

Acquires the color used for R_GRAPHICS_Clear.

RGA.h

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 53 of 127

RZ/A1H RGA

Declaration

Description

Argument errnum_t R_GRAPHICS_GetClearColor(graphics_t* self, r8g8b8a8_t* out_color );

Use R_GRAPHICS_SetBackgroundColor() to set the clear color. graphics_t* self r8g8b8a8_t* out_color

Graphics drawing context

(Output) Clear color

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.28

R_GRAPHICS_Clear

Outline

Header

Declaration

Description

Argument

Clears the rectangle area.

RGA.h errnum_t R_GRAPHICS_Clear( graphics_t* self,

int_fast32_t min_x, int_fast32_t min_y, int_fast32_t width, int_fast32_t height );

Use R_GRAPHICS_SetBackgroundColor() to set the clear color.

When a double-buffer is used, the drawing buffer is cleared. Therefore, the cleared content is not displayed only by calling this function. Use

R_WINDOW_SURFACES_SwapBuffers() to apply display.

This function is affected by clipping. graphics_t* self Graphics drawing context int_fast32_t min_x, int_fast32_t min_y, int_fast32_t width, int_fast32_t height

Rectangle area

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.29

R_GRAPHICS_DrawImage

Outline

Header

Declaration

Description

Draws an image at coordinates (min_x, min_y) with the same size.

RGA.h errnum_t R_GRAPHICS_DrawImage( graphics_t* self, graphics_image_t* image, int_fast32_t min_x, int_fast32_t min_y );

Image data to be specified for the image argument can be created by using section

7.1, Image Format Conversion by ImagePackager.

JPEG data can be directly specified for arguments. See section 6.11.3, Identifying

Image Format.

This function is affected by R_GRAPHICS_SetGlobalAlpha.

This function is also affected by the current matrix and clipping.

When drawing an image in the YUV422 format, if the value converted from min_x or min_y by the matrix is not an even number, an error occurs.

When the alpha component is included in the image and is not included in the drawing target frame buffer, RGB components to be drawn in the frame buffer are blended to values that have been multiplied by the alpha component. When the alpha component is included in the drawing target frame buffer, RGB components are blended to values that have not been multiplied by the alpha component.

An example of pixel format including the alpha component:

ARGB8888, ARGB4444, ARGB1555

An example of pixel format without alpha component:

XRGB8888, RGB565, YUV422

When drawing characters of raster font, specify the image of A8, A4 and A1 (Alpha only) format to "image" argument. But, width of the image must be same as width of drawing target frame buffer for RZ/A1H. Also, the image of A8, A4 and A1 format can not be zoomed.

Specify a CLUT-format image as same bit count as the frame buffer for drawing in the CLUT format frame buffer. Only min_x = 0 and min_y = 0 can be specified as a

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 54 of 127

RZ/A1H RGA

Argument drawing position. If source image's width was not byte unit, an error is raised. If

CLUT color in the video controller was fit with drawing image, set CLUT of graphics_image_properties_t (6.6.5.14) to the video controller.

In fast manual flush mode (see section 6.11.5), when the image data specified for

the image argument exists in the array variables prepared by the application, flushing is required. However, flushing is not required when ROM data is used.

When performing flush, directly flush the CPU cache or enclose the image data read/write processing by R_GRAPHICS_BeginSoftwareRendering to

R_GRAPHICS_EndSoftwareRendering.

If the frame buffer which has source image was same as target frame buffer and there was overlap between the specified source and destination area, this function returns an error. graphics_t* self graphics_image_t* image int_fast32_t min_x, int_fast32_t min_y

Graphics drawing context

Image

Minimum X and Y coordinates

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.30

R_GRAPHICS_DrawImageResized

Outline

Header

Declaration

Description

Enlarges or reduces an image and draws it in the specified rectangle.

RGA.h errnum_t R_GRAPHICS_DrawImageResized( graphics_t* self, graphics_image_t* image, int_fast32_t min_x, int_fast32_t min_y, int_fast32_t width, int_fast32_t height );

See the description on the R_GRAPHICS_DrawImage function. See 6.9.1.29.

JPEG data cannot be specified to image argument.

Argument graphics_t* self Graphics drawing context graphics_image_t* image int_fast32_t min_x, int_fast32_t min_y

Image

Minimum X and Y coordinates int_fast32_t width, int_fast32_t height

Width and height of the drawing target

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.1.31

R_GRAPHICS_DrawImageChild

Outline

Header

Declaration

Draws a part of an image.

RGA.h errnum_t R_GRAPHICS_DrawImageChild( graphics_t* self, graphics_image_t* image,

int_fast32_t source_min_x, int_fast32_t source_min_y,

int_fast32_t source_width, int_fast32_t source_height,

int_fast32_t destination_min_x, int_fast32_t destination_min_y,

int_fast32_t destination_width, int_fast32_t destination_height );

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 55 of 127

RZ/A1H

Description

RGA

Image

SourceMinY

Source

MinX

SourceHeight

SourceWidth

Frame buffer

DestinationMinY

DestinationMinX

DestinationHeight

DestinationWidth

When source_width ≠ destination_width or source_height ≠ destination_height, images are enlarged or reduced.

See the description on the R_GRAPHICS_DrawImage function. See 6.9.1.29.

Argument

Return value graphics_t* self graphics_image_t* image int_fast32_t source_min_x int_fast32_t source_min_y int_fast32_t source_width int_fast32_t source_height int_fast32_t destination_min_x int_fast32_t destination_min_y

Graphics drawing context

Image

Minimum X and Y coordinates in the image

Width and height in the image

Minimum X and Y coordinates of the drawing target int_fast32_t destination_width int_fast32_t destination_height

Width and height of the drawing target

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.32

R_GRAPHICS_FillRect

Outline

Header

Declaration

Description

Argument

Fills the rectangle area specified by the argument.

RGA.h errnum_t R_GRAPHICS_FillRect( graphics_t* self, int_fast32_t min_x, int_fast32_t min_y, int_fast32_t width, int_fast32_t height );

This function is affected by the current matrix, the current fill, and clipping.

No border is drawn.

This function is affected by R_GRAPHICS_SetGlobalAlpha. graphics_t* self Graphics drawing context int_fast32_t min_x, int_fast32_t min_y

Minimum X and Y coordinates of rectangle

Return value int_fast32_t width, int_fast32_t height

Width and height of rectangle

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.33

R_GRAPHICS_SetFillColor

Outline

Header

Declaration

Changes the paint object of the current fill to single-color fill and sets the fill color.

RGA.h errnum_t R_GRAPHICS_SetFillColor( graphics_t* self, r8g8b8a8_t Color );

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 56 of 127

RZ/A1H RGA

Description

Argument

The initial value is opaque black. graphics_t* self r8g8b8a8_t color

Graphics drawing context

Fill color. Use R_RGA_Get_R8G8B8A8() for the fill color setting.

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.1.34

R_GRAPHICS_SetFillPattern

Outline

Header

Declaration

Description

Argument

Sets the pattern for the current fill paint object.

RGA.h errnum_t R_GRAPHICS_SetFillPattern( graphics_t* self, graphics_pattern_t* pattern );

Use R_GRAPHICS_FillRect for drawing. graphics_t* self Graphics drawing context graphics_pattern_t* pattern Use R_GRAPHICS_PATTERN_Initialize() to initialize the pattern object.

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.35

R_GRAPHICS_BeginPath

Outline

Header

Declaration

Description

Argument

Resets the default path content to null.

RGA.h errnum_t R_GRAPHICS_BeginPath( graphics_t* self ); graphics_t* self Graphics drawing context

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.36

R_GRAPHICS_Rect

Outline

Header

Declaration

Description

Argument

Adds a rectangle to the default path.

RGA.h errnum_t R_GRAPHICS_Rect( graphics_t* self, int_fast32_t min_x, int_fast32_t min_y, int_fast32_t width, int_fast32_t height );

This function is used to set the clipping area. graphics_t* self Graphics drawing context

Return value int_fast32_t min_x, int_fast32_t min_y int_fast32_t width, int_fast32_t height

Minimum X and Y coordinates of rectangle

Width and height of rectangle

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.37

R_GRAPHICS_Clip

Outline

Header

Declaration

Description

Argument

Sets the shape of the current default path to a clipping area.

RGA.h errnum_t R_GRAPHICS_Clip( graphics_t* self );

When the current default path is empty or is not a rectangle, an error occurs.

When the current default path is empty, drawing is disabled in any area.

If this function is called when the current clipping area is a part of the frame buffer, the area common to the previous clipping area and the default path becomes a new clipping area.

To restore entire drawing, call R_GRAPHICS_Restore. graphics_t* self Graphics drawing context

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.38

R_GRAPHICS_SetGlobalAlpha

Outline Sets an alpha value (opacity) to be multiplied by all drawings.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 57 of 127

RZ/A1H RGA

Header

Declaration

Description

RGA.h errnum_t R_GRAPHICS_SetGlobalAlpha( graphics_t* self, uint8_t alpha_value );

The default value is 255.

This function affects the following drawing functions.

Figure fill functions such as R_GRAPHICS_FillRect

Pattern drawing function R_GRAPHICS_FillRect

Border drawing functions such as R_GRAPHICS_StrokeRect

Image drawing functions such as R_GRAPHICS_DrawImage

This function does not affect the following drawing function.

R_GRAPHICS_Clear graphics_t* self Graphics drawing context Argument

Return value uint8_t alpha_value Alpha value (0 to 255). A smaller value makes drawing light.

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.39

R_GRAPHICS_GetGlobalAlpha

Outline

Header

Declaration

Acquires an alpha value (opacity) to be multiplied by all drawings.

RGA.h errnum_t R_GRAPHICS_GetGlobalAlpha( graphics_t* self, uint8_t* out_alpha_value );

Description

Argument

Return value graphics_t* self Graphics drawing context uint8_t* out_alpha_value (Output) Alpha value (0 to 255). A smaller value makes drawing light.

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.40

R_GRAPHICS_SetGlobalCompositeOperation

Outline

Header

Declaration

Description

Sets the calculation method for alpha blend.

RGA.h errnum_t R_GRAPHICS_SetGlobalCompositeOperation( graphics_t* self,

graphics_composite_operation_t composite_operation );

The following case other than GRAPHICS_SOURCE_OVER can be set.

Image drawing such as R_GRAPHICS_DrawImage

Argument

Return value graphics_t* self graphics_composite_operation_t composite_operation

Graphics drawing context

Calculation method

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.41

R_GRAPHICS_GetGlobalCompositeOperation

Outline

Header

Declaration

Description

Argument

Return value

Acquires the calculation method for alpha blend.

RGA.h errnum_t R_GRAPHICS_GetGlobalCompositeOperation( graphics_t* self,

graphics_composite_operation_t* out_composite_operation ); graphics_t* self graphics_composite_operation_t* out_composite_operation

Graphics drawing context

(Output) Calculation method

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.42

R_GRAPHICS_STATIC_SetOnInitialize

Outline

Header

Declaration

Registers a callback function that sets the default graphics_config_t value.

RGA.h errnum_t R_GRAPHICS_STATIC_SetOnInitialize(

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 58 of 127

RZ/A1H RGA

Description

Argument

R_GRAPHICS_OnInitialize_FuncType callback_function );

The R_GRAPHICS_STATIC_OnInitializeDefault function is called back when this function is not called.

R_GRAPHICS_OnInitialize_FuncT ype callback_function

Callback function or NULL

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.1.43

R_GRAPHICS_STATIC_SetOnFinalize

Outline

Header

Declaration

Description

Registers a function that releases the memory allocated in the

R_GRAPHICS_OnInitialize_FuncType function.

RGA.h errnum_t R_GRAPHICS_STATIC_SetOnFinalize(

R_GRAPHICS_OnFinalize_FuncType callback_function );

The R_GRAPHICS_STATIC_OnInitializeDefault function is called back when this function is not called.

Argument

Return value

R_GRAPHICS_OnFinalize_FuncT ype callback_function

Callback function or NULL

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.44

R_GRAPHICS_SetQualityFlags

Outline

Header

Declaration

Description

Argument

Return value

Sets the drawing quality.

RGA.h errnum_t R_GRAPHICS_SetQualityFlags( graphics_t* self,

graphics_quality_flags_t qualities ); graphics_t* self, Graphics drawing context graphics_quality_flags_t qualities

See section 6.6.5.4.

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.45

R_GRAPHICS_GetQualityFlags

Outline

Header

Declaration

Description

Argument

Acquires the current drawing quality.

RGA.h errnum_t R_GRAPHICS_GetQualityFlags( graphics_t* self,

graphics_quality_flags_t* out_qualities ); graphics_t* self, Graphics drawing context graphics_quality_flags_t* out_qualities

(Output) See section 6.6.5.4.

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.46

R_GRAPHICS_SetStrokeColor

Outline

Header

Declaration

Description

Argument

Sets the color used for single-color fill for the paint object of the current border.

RGA.h errnum_t R_GRAPHICS_SetStrokeColor( graphics_t* self, r8g8b8a8_t color ); graphics_t* self, Graphics drawing context

Return value r8g8b8a8_t color Border color

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.47

R_GRAPHICS_StrokeRect

Outline

Header

Declaration

Draws sides of rectangle.

RGA.h errnum_t R_GRAPHICS_StrokeRect( graphics_t* self,

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 59 of 127

RZ/A1H RGA

Description

int_fast32_t min_x, int_fast32_t min_y, int_fast32_t width, int_fast32_t height );

This function is affected by line width, border color, and clipping.

Fill is not made.

When the current matrix is not the unit matrix, an error occurs.

This function is affected by R_GRAPHICS_SetGlobalAlpha.

Argument graphics_t* self, int_fast32_t min_x, int_fast32_t min_y

Graphics drawing context

Minimum X and Y coordinates of rectangle int_fast32_t width, int_fast32_t height

Width and height of rectangle

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.1.48

R_GRAPHICS_BeginSoftwareRendering

Outline

Header

Declaration

Description

Argument

Notifies the graphics library of the start of software rendering.

RGA.h errnum_t R_GRAPHICS_BeginSoftwareRendering( graphics_t* self );

This function must be called in fast manual flush mode (see section 6.11.5).

For RZ/A1H, this function is used before software rendering to the frame bufffer in

On-Chip RAM. See (6.9.1.52) R_GRAPHICS_BeginSoftwareRenderingA

Depending on a condition, this function waits for finishing drawing like

"R_GRAPHICS_Finish" function. graphics_t* self, Graphics drawing context

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.49

R_GRAPHICS_EndSoftwareRendering

Outline

Header

Declaration

Description

Argument

Return value

Notifies the graphics library of the end of software rendering.

RGA.h errnum_t R_GRAPHICS_EndSoftwareRendering( graphics_t* self );

This function must be called in fast manual flush mode (see section 6.11.5).

To call this function from functions that support error processing, also call

R_GRAPHICS_EndRenderingInFin at the end of the function. graphics_t* self, Graphics drawing context

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.50

R_GRAPHICS_EndRenderingInFin

Outline

Header

Declaration

Description

Call this function from the end of the function that performs software rendering.

RGA.h errnum_t R_GRAPHICS_EndRenderingInFin( graphics_t* self, errnum_t e );

This function must be called in fast manual flush mode (see section 6.11.5).

To call this function from functions that support error processing, also call

R_GRAPHICS_EndRenderingInFin at the end of the function. graphics_t* self, Graphics drawing context Argument

Return value errnum_t e Errors that have occurred. No error = 0

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.51

R_GRAPHICS_BeginSoftwareRendering2

Outline

Header

Declaration

Description

R_GRAPHICS_BeginSoftwareRendering for the memory on L2 cache.

RGA.h errnum_t R_GRAPHICS_BeginSoftwareRendering2( graphics_t* self );

This function is usually not called.

This function is called in the case of RGA using RGAH, defined

"R_OSPL_AXI_Get2ndCacheAttribute" function as accessing not used L2 cache

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 60 of 127

RZ/A1H RGA

Argument

Return value from OpenVG

™ hardware in RZ/A1H and fast manual flush mode (see section

6.11.5).

For RZ/A1H, this function is used before software rendering to the frame bufffer in

SDRAM.

Depending on a condition, this function waits for finishing drawing like

"R_GRAPHICS_Finish" function. graphics_t* self, Graphics drawing context

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.1.52

R_GRAPHICS_BeginSoftwareRenderingA

Outline

Header

Declaration

Description

Argument

Return value

Calls R_GRAPHICS_BeginSoftwareRendering2 depending on the address.

RGA.h errnum_t R_GRAPHICS_BeginSoftwareRenderingA( graphics_t* self, void*

Address );

This function is usually not called.

This function is called in the case of RGA using RGAH, defined

"R_OSPL_AXI_Get2ndCacheAttribute" function as accessing not used L2 cache from OpenVG

™ hardware in RZ/A1H and fast manual flush mode (see section

6.11.5).

This function calls "R_OSPL_MEMORY_GetLevelOfFlush" function with specified address and calls "R_GRAPHICS_BeginSoftwareRendering" or

"R_GRAPHICS_BeginSoftwareRendering2" depending on the level of flush. graphics_t* self, void* Address

Graphics drawing context

Buffer address to render by software

Error code. If there is no error, the return value is 0. See section 7.2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 61 of 127

RZ/A1H

6.9.2

6.9.2.1

Functions Equivalent to graphics_image_t Class Member Function

List of Functions

RGA

Section Function Name Description

6.9.2.2

R_GRAPHICS_IMAGE_InitR8G8B8A8 Initializes the r8g8b8a8_t image object.

6.9.2.3

R_GRAPHICS_IMAGE_InitSameSizeR

8G8B8A8

Initializes the image object to the same width and height.

6.9.2.4

R_GRAPHICS_IMAGE_InitCopyFrame

BufferR8G8B8A8

Initializes the image object to which a part of frame buffer being displayed is copied.

6.9.2.5

R_GRAPHICS_IMAGE_InitByShareFra meBuffer

Initializes the frame buffer data as an image.

6.9.2.6

R_GRAPHICS_IMAGE_GetProperties Get properties of the image.

6.9.2.2

R_GRAPHICS_IMAGE_InitR8G8B8A8

Outline

Header

Declaration

Description

Argument

Initializes the r8g8b8a8_t image object.

RGA.h errnum_t R_GRAPHICS_IMAGE_InitR8G8B8A8(

graphics_image_t* self, void* image_data_array, size_t image_data_array_size,

int_fast32_t width, int_fast32_t height );

Initializes internal variables.

Acquirable image data is arranged in a uint8_t-type array in the order of Red, Green,

Blue, and Alpha from the upper-left pixel to the lower-right pixel. graphics_image_t* self Image void* image_data_array Starting address of an array to be a memory area that stores images size_t image_data_array_size

Size (bytes) of the memory area indicated by image_data_array int_fast32_t width, int_fast32_t height

Width and height of image

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.2.3

R_GRAPHICS_IMAGE_InitSameSizeR8G8B8A8

Outline

Header

Declaration

Description

Argument

Initializes the image object to the same width and height.

RGA.h errnum_t R_GRAPHICS_IMAGE_InitSameSizeR8G8B8A8(

graphics_image_t* self, void* image_data_array, size_t image_data_array_size,

graphics_image_t* same_size_image );

Initializes internal variables. graphics_image_t* self Image void* image_data_array Starting address of an array to be a memory area that stores images size_t image_data_array_size

Size (bytes) of the memory area indicated by image_data_array graphics_image_t* same_size_image

Image object that references width and height

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.2.4

R_GRAPHICS_IMAGE_InitCopyFrameBufferR8G8B8A8

Outline

Header

Declaration

Initializes the image object to which a part of frame buffer being displayed is copied.

RGA.h errnum_t R_GRAPHICS_IMAGE_InitCopyFrameBufferR8G8B8A8(

graphics_image_t* self, void* image_data_array, size_t image_data_array_size,

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 62 of 127

RZ/A1H RGA

Description

Argument

graphics_t* context, int_fast32_t min_x, int_fast32_t min_y, int_fast32_t width, int_fast32_t height );

Initializes internal variables.

Acquirable image data is arranged in a uint8_t-type array in the order of Red, Green,

Blue, and Alpha from the upper-left pixel to the lower-right pixel. graphics_image _t* self Image void* image_data_array Starting address of an array to be a memory area that stores images size_t image_data_array_size graphics_t* context

Size (bytes) of the memory area indicated by

"image_data_array" argument

Context with copy source frame buffer to be drawn int_fast32_t min_x, int_fast32_t min_y int_fast32_t width, int_fast32_t height

Minimum X and Y coordinates (frame buffer coordinates) of the range to be acquired

Width and height of the range to be acquired

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.2.5

R_GRAPHICS_IMAGE_InitByShareFrameBuffer

Outline

Header

Declaration

Description

Argument

Initializes the frame buffer data as an image.

RGA.h errnum_t R_GRAPHICS_IMAGE_InitByShareFrameBuffer( graphics_image _t* self, frame_buffer_t* frame_buffer );

Initializes internal variables.

The VRAM area indicated by frame_buffer->buffer_address [frame_buffer->show_buffer_index] at the time when this function is called is shared with image (self).

[Condition] This function can not initialize CLUT format image. RGA supports static

CLUT format image made from ImagePackager.

[Condition] When wrong stride alignment error was raised, change width of the buffer witch becomes to fit stride alignment and copy the image to the buffer. RGA can not copy at this condition. Also, draw the source image (a part of the buffer) by calling

"R_GRAPHICS_DrawImageChild" function. graphics_image _t* self frame_buffer_t* frame_buffer

Image

Frame buffer that contains the image

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.2.6

R_GRAPHICS_IMAGE_GetProperties

Outline

Header

Declaration

Description

Get image properties.

RGA.h errnum_t R_GRAPHICS_IMAGE_GetProperties( graphics_image _t* self, graphics_image_properties_t* out_properties );

In the case of fast manual flush mode (6.11.5):

Flush operation must be done before the array pointed by "out_properties->address" is read or written.

The data in the ROM does not have to be flushed.

Argument

Return value

When you want to flush, flush CPU cache directly, call "R_GRAPHICS_Finish" or sandwich reading or writing the image data between

"R_GRAPHICS_BeginSoftwareRendering" and "R_GRAPHICS_EndSoftwareRendering". graphics_image _t* self Image graphics_image_properties

_t* out_properties

(Output) Image properties (6.6.5.14)

Error code. If there is no error, the return value is 0. See section 7.2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 63 of 127

RZ/A1H RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 64 of 127

RZ/A1H

6.9.3

6.9.3.1

Functions Equivalent to graphics_pattern_t Class Member Function

List of Functions

RGA

Section Function Name Description

6.9.3.2

R_GRAPHICS_PATTERN_Initi alize

Initializes the pattern object.

6.9.3.2

R_GRAPHICS_PATTERN_Initialize

Outline

Header

Declaration

Description

Argument

Return value

Initializes the pattern object.

RGA.h errnum_t R_GRAPHICS_PATTERN_Initialize( graphics_pattern_t* self,

graphics_image_t* image, repetition_t repetition, graphics_t* context );

Initializes internal variables.

Set the object of GraphicsPatternClass to R_GRAPHICS_SetFillPattern. graphics_pattern_t* self Pattern object graphics_image_t* image repetition_t repetition

Pattern component image

Repetition setting (normally GRAPHICS_REPEAT) graphics_t* context Belonging context

Error code. If there is no error, the return value is 0. See section 7.2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 65 of 127

RZ/A1H

6.9.4

6.9.4.1

Functions Related to Creating C++ Object

List of Functions

RGA

Section Function Name Description

6.9.4.2

R_RGA_New_Canvas2D_ContextClass Creates an object of Canvas2D_ContextClass.

6.9.4.3

R_RGA_New_Canvas2D_ImageClass Creates an object of Canvas2D_ImageClass

6.9.4.2

R_RGA_New_Canvas2D_ContextClass

Outline

Header

Declaration

Description

Argument

Return value

6.9.4.3

Creates an object of Canvas2D_ContextClass.

RGA.h

Canvas2D_ContextClass

R_RGA_New_Canvas2D_ContextClass( Canvas2D_ContextConfigClass& in_out_Config );

Canvas2D_ContextClass R_RGA_New_Canvas2D_ContextClass( frame_buffer_t* in_out_config );

Initializes internal variables.

When the object is not used, call the destroy method.

See section 6.6.4.3

Canvas2D_ContextConfigClass& in_out_Config frame_buffer_t* in_out_config

See section 6.6.5.2.

Canvas2D context object. Error = undefined

R_RGA_New_Canvas2D_ImageClass

Outline

Header

Declaration

Description

Argument

Return value

Creates an object of Canvas2D_ImageClass

RGA.h

Canvas2D_ImageClass R_RGA_New_Canvas2D_ImageClass();

This function is corresponding to new Image() of Canvas2D.

None

Created an object as Canvas2D_ImageClass. Error = undefined

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 66 of 127

RZ/A1H

6.9.5 Canvas2D_ContextClass Member Functions

6.9.5.1

List of Functions

RGA

Section Function Name Description

6.9.5.2

destroy

6.9.5.3

clearRect

6.9.5.4

save

6.9.5.5

restore

6.9.5.6

drawImage

6.9.5.7

createImageData

6.9.5.8

getImageData

6.9.5.9

putImageData

6.9.5.10 fillRect

6.9.5.11 createPattern

6.9.5.12 beginPath

6.9.5.13 rect

6.9.5.14 clip

6.9.5.15 setTransform

6.9.5.16 translate

6.9.5.17 scale

6.9.5.18 rotate

6.9.5.19 transform

6.9.5.2 destroy (Canvas2D_ContextClass)

Deletes the object of Canvas2D_ContextClass.

Clears the rectangle area.

Saves the set value of context in the internal stack.

Returns the set value of context to the context from the internal stack.

Draws an image.

Creates an image object of r8g8b8a8_t.

Creates an image to which a part of frame buffer being displayed is copied.

Draws an image.

Fill the rectangle area.

Creates a pattern object.

Resets the default path content to null.

Adds a rectangle to the default path.

Sets the shape of the current default path to a clipping area.

Sets each element of the matrix.

Translates the current matrix.

Enlarges or reduces the current matrix.

Rotates the current matrix. Rotation center: (0,0)

Multiplies the specified 2x3 matrix by the current matrix.

Outline

Header

Declaration

Description

Argument

Return value

6.9.5.3

Deletes the object of Canvas2D_ContextClass.

RGA.h void Canvas2D_ContextClass::destroy();

None

None clearRect (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Argument

Return value

6.9.5.4

Clears the rectangle area.

RGA.h void Canvas2D_ContextClass::clearRect(

int_t MinX, int_t MinY, int_t Width, int_t Height );

Use R_GRAPHICS_SetBackgroundColor() for setting the clear color. Specify the c_LanguageContext (Canvas2D_ContextClass) property for the first argument.

Clear color can be gotten by "R_GRAPHICS_GetClearColor" function.

Since the drawing buffer content is cleared, cleared content is not displayed only by calling this function. To apply the displayed content, use

R_WINDOW_SURFACES_SwapBuffers().

This function is affected by clipping. int_t MinX, int_t MinY Minimum X and Y coordinates of rectangle int_t Width, int_t Height

None save (Canvas2D_ContextClass)

Width and height of rectangle

Outline

Header

Declaration

Description

Saves the set value of context in the internal stack.

RGA.h void Canvas2D_ContextClass::save();

A heap area is secured internally for the internal stack.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 67 of 127

RZ/A1H RGA

Argument

Return value

6.9.5.5

None

None restore (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Argument

Return value

6.9.5.6

Returns the set value of context to the context from the internal stack.

RGA.h void Canvas2D_ContextClass::restore();

Releases the heap area used internally as an internal stack.

None

Error code. If there is no error, the return value is 0. drawImage (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Draws an image.

RGA.h void Canvas2D_ContextClass::drawImage(

graphics_image_t* Image, int_t MinX, int_t MinY ); void Canvas2D_ContextClass::drawImage(

graphics_image_t* Image,

int_t MinX, int_t MinY, int_t Width, int_t Height ); void Canvas2D_ContextClass::drawImage(

graphics_image_t* Image,

int_t SourceMinX, int_t SourceMinY,

int_t SourceWidth, int_t SourceHeight,

int_t DestinationMinX, int_t DestinationMinY,

int_t DestinationWidth, int_t DestinationHeight );

JPEG data can be directly specified for arguments. See section 6.11.3, Identifying

Image Format.

When neither width nor height is specified, the width and height of the drawing destination are the same as the image width and height.

When SourceMinX to DestinationHeight are specified, a part of an image is drawn.

Image

SourceMinY

Frame buffer

Source

MinX

SourceHeight

SourceWidth

DestinationMinY

DestinationMinX

DestinationHeight

DestinationWidth

When SourceWidth ≠ DestinationWidth or SourceHeight ≠ DestinationHeight, images are enlarged or reduced.

JPEG data cannot be specified to "image" argument of "drawImage" function that have arguments Image, MinX, MinY, Width and Height.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 68 of 127

RZ/A1H RGA

Argument

This function is affected by Canvas2D_ContextClass::GlobalAlpha and the current matrix.

When drawing an image in the YUV422 format, if the value converted from MinX or

MinY by the matrix is not an even number, an error occurs.

When the alpha component is included in the image and is not included in the drawing target frame buffer, RGB components to be drawn in the frame buffer are blended to values that have been multiplied by the alpha component. When the alpha component is included in the drawing target frame buffer, RGB components are blended to values that have not been multiplied by the alpha component.

An example of pixel format including the alpha component:

ARGB8888, ARGB4444, ARGB1555

An example of pixel format without alpha component:

XRGB8888, RGB565, YUV422 graphics_image_t* Image Image int_t MinX, int_t MinY Minimum X and Y coordinates of drawing destination int_t Width, int_t Height Width and height of drawing destination

Minimum X and Y coordinates in the image int_t SourceMinX, int_t SourceMinY int_t SourceWidth, int_t SourceHeight

Width and height in the image int_t DestinationMinX, int_t DestinationMinY int_t DestinationWidth, int_t DestinationHeight

None

Minimum X and Y coordinates of drawing destination

Width and height of drawing destination

Return value

6.9.5.7 createImageData (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Argument

Creates an image object of r8g8b8a8_t.

RGA.h

Canvas2D_ImageClass Canvas2D_ContextClass::createImageData(

int_t Width, int_t Height );

Canvas2D_ImageClass Canvas2D_ContextClass::createImageData(

Canvas2D_ImageClass ImageReferencedWidthHeight );

Secures a memory area internally from the heap area.

This function raises "std::bad_alloc" exception or returns "undefined", if memory allocation was failed. This function returns "undefined", if "new" operator returned

"NULL" inside. int_t Width, int_t Height

Canvas2D_ImageClass

ImageReferencedWidthHeight

Width and height of image

Image object that references width and height

Created Image object. undefined = Error Return value

6.9.5.8 getImageData (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Argument

Return value

Creates an image object to which a part of the frame buffer being displayed is copied.

RGA.h

Canvas2D_ImageClass Canvas2D_ContextClass::getImageData(

int_t MinX, int_t MinY, int_t Width, int_t Height ); int_t MinX, int_t MinY Minimum X and Y coordinates of range to be acquired

(frame buffer coordinates) int_t Width, int_t Height Width and height of range to be acquired

Created Image object. undefined = Error

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 69 of 127

RZ/A1H RGA

6.9.5.9 putImageData (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Argument

Draws an image.

RGA.h void Canvas2D_ContextClass::putImageData(

Canvas2D_ImageClass ImageData, int_t MinX, int_t MinY ); void Canvas2D_ContextClass::putImageData(

Canvas2D_ImageClass ImageData, int_t MinX, int_t MinY,

int_t DirtyX, int_t DirtyY, int_t DirtyWidth, int_t DirtyHeight );

When DirtyX, DirtyY, DirtyWidth, or DirtyHeight is specified, a part of the Image object image is drawn, but the image is not enlarged or reduced.

Canvas2D_ImageClass

ImageData

Image object containing the image to be drawn int_t MinX, int_t MinY Minimum X and Y coordinates of drawing destination

(canvas coordinates) int_t DirtyX, int_t DirtyY Minimum X and Y coordinates in Image (Image coordinates)

Size in Image = Size to be drawn

Return value int_t DirtyWidth, int_t DirtyHeight

None

6.9.5.10 fillRect (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Fill the rectangle area.

RGA.h void Canvas2D_ContextClass::fillRect(

int_t MinX, int_t MinY, int_t Width, int_t Height );

This function is affected by the current matrix and paint of the current fill.

No border is drawn.

This function is affected by the globalAlpha property. int_t MinX, int_t MinY Minimum X and Y coordinates of rectangle Argument

Return value int_t Width, int_t Height

None

6.9.5.11 createPattern (Canvas2D_ContextClass)

Width and height of rectangle

Outline

Header

Declaration

Description

Creates a pattern object.

RGA.h

Canvas2D_PatternClass

Canvas2D_ContextClass::createPattern( graphics_image_t* Image, char*

Repetition );

Set the pattern object for the fillStyle property.

Argument

Return value graphics_image_t* Image Image as a pattern component char* Repetition Repetition setting. Specify "repeat."

Created pattern object

6.9.5.12 beginPath (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Argument

Return value

Resets the default path content to null.

RGA.h void Canvas2D_ContextClass::beginPath();

None

None

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 70 of 127

RZ/A1H RGA

6.9.5.13 rect (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Argument

Return value

Adds a rectangle to the default path.

RGA.h void Canvas2D_ContextClass::rect(

int_t MinX, int_t MinY, int_t Width, int_t Height ); int_t MinX, int_t MinY int_t Width, int_t Height

None

6.9.5.14 clip (Canvas2D_ContextClass)

Minimum X and Y coordinates of rectangle

Width and height of rectangle

Outline

Header

Declaration

Description

Argument

Return value

Sets the shape of the current default path to a clipping area.

RGA.h void Canvas2D_ContextClass::clip();

When the current default path is empty or is not a single rectangle, an error occurs.

When the current default path is empty, drawing is disabled in any area.

If this function is called when the current clipping area is a part of the frame buffer, the area common to the clipping area and the default path is a new clipping area.

To restore entire drawing, call "restore."

None

None

6.9.5.15 setTransform (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Argument

Sets each element of the current matrix.

RGA.h void Canvas2D_ContextClass::setTransform(

graphics_matrix_float_t sx, graphics_matrix_float_t ky,

graphics_matrix_float_t kx, graphics_matrix_float_t sy,

graphics_matrix_float_t tx, graphics_matrix_float_t ty ); graphics_matrix_float_t sx, graphics_matrix_float_t ky, graphics_matrix_float_t kx, graphics_matrix_float_t sy, graphics_matrix_float_t tx, graphics_matrix_float_t ty

2x3 matrix

( sx ky

0 kx sy

0 tx ty

1

)

Return value None

6.9.5.16 translate (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Translates the current matrix (M).

RGA.h void Canvas2D_ContextClass::translate(

graphics_matrix_float_t tx, graphics_matrix_float_t ty );

1 0 tx

M=M⋅

(

0 1 ty

)

0 0 1

Argument graphics_matrix_float_t tx, graphics_matrix_float_t ty

Displacement (When the origin is at the upper left, plus of X means right direction and plus of Y means downward direction.)

None Return value

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 71 of 127

RZ/A1H RGA

6.9.5.17 scale (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Enlarges or reduces the current matrix (M).

RGA.h void Canvas2D_ContextClass::translate(

graphics_matrix_float_t sx, graphics_matrix_float_t sy ); sx 0 0

M=M⋅

(

0 sy 0

)

0 0 1

Magnification. Center of enlargement/reduction: Origin Argument

Return value graphics_matrix_float_t tx, graphics_matrix_float_t ty

None

6.9.5.18 rotate (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Rotates the current matrix (M). Center coordinates of rotation: (0,0)

RGA.h void Canvas2D_ContextClass::rotate(graphics_matrix_float_t angle ); cos(angle) -sin(angle) 0

M=M⋅

( sin(angle) cos(angle) 0

)

0 0 1

Argument graphics_matrix_float_t angle

None

Rotation angle (unit: degree). When the origin is at the upper left, plus means clockwise direction.

Return value

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 72 of 127

RZ/A1H

6.9.5.19 transform (Canvas2D_ContextClass)

Outline

Header

Declaration

Description

Multiplies the specified 2x3 matrix by the current matrix (M).

RGA.h void Canvas2D_ContextClass::transform(

graphics_matrix_float_t sx, graphics_matrix_float_t ky,

graphics_matrix_float_t kx, graphics_matrix_float_t sy,

graphics_matrix_float_t tx, graphics_matrix_float_t ty ); sx kx tx

M=M⋅

( ky sy ty

)

0 0 1

Argument graphics_matrix_float_t sx graphics_matrix_float_t ky graphics_matrix_float_t kx graphics_matrix_float_t sy graphics_matrix_float_t tx graphics_matrix_float_t ty

None

A 2x3 matrix to be multiplied

Return value

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 73 of 127

RZ/A1H

6.9.6

6.9.6.1

Functions Related to Canvas2D_ImageClass

List of Functions

Section Function Name Description

6.9.6.2

destroy Deletes the Canvas2D_ImageClass object.

6.9.6.2 destroy (Canvas2D_ImageClass)

Outline

Header

Declaration

Description

Argument

Return value

Deletes the Canvas2D_ImageClass object.

RGA.h void Canvas2D_ImageClass::destroy();

None

None

6.9.7 Functions Related to Canvas2D_PatternClass

6.9.7.1

List of Functions

Section Function Name Description

6.9.7.2

destroy Deletes the Canvas2D_PatternClass object.

6.9.7.2 destroy (Canvas2D_PatternClass)

Outline

Header

Declaration

Description

Argument

Return value

Deletes the Canvas2D_PatternClass object.

RGA.h void Canvas2D_PatternClass::destroy();

None

None

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 74 of 127

RZ/A1H

6.9.8

6.9.8.1

Functions Related to WindowSurfacesClass

List of Functions

RGA

Section Function Name Description

6.9.8.2

6.9.8.3

6.9.8.4

6.9.8.5

initialize destroy get_layer_frame_buffer swap_buffers

6.9.8.6

alloc_offscreen_stack

6.9.8.7

free_offscreen_stack

6.9.8.8

do_message_loop

6.9.8.9

access_layer_attributes

Initialize an object as WindowSurfacesClass

Destroy an object as WindowSurfacesClass

Acquires the pointer to the frame buffer structure of the specified layer.

Swaps the buffer of the specified layer and displays the drawn content.

Allocates the off-screen buffer from VRAM stack.

Frees the off-screen buffer to VRAM stack.

Enters the message loop.

Accesses attributes of the specified display layer.

6.9.8.2 initialize (WindowSurfacesClass)

Outline

Header

Declaration

Description

Argument

Return value

Initialize an object as WindowSurfacesClass

RGA.h errnum_t WindowSurfacesClass::initialize( WindowSurfacesConfigClass& in_out_config );

See 6.9.9.3 R_WINDOW_SURFACES_Initialize

WindowSurfacesConfigCla ss& in_out_config

Parameters. See 6.6.4.7.

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.8.3 destroy (WindowSurfacesClass)

Outline

Header

Declaration

Description

Argument

Return value

Destroy an object as WindowSurfacesClass

RGA.h void WindowSurfacesClass::destroy();

See 6.9.9.4 R_WINDOW_SURFACES_Finalize

None

None

6.9.8.4 get_layer_frame_buffer (WindowSurfacesClass)

Outline

Header

Declaration

Description

Argument

Outline

Return value

Acquires the pointer to the frame buffer structure of the specified layer.

RGA.h errnum_t WindowSurfacesClass::get_layer_frame_buffer( int_fast32_t layer_num, frame_buffer_t** out_frame_buffer );

See 6.9.9.5 R_WINDOW_SURFACES_GetLayerFrameBuffer

int_fast32_t layer_num Layer number 0: Innermost, +1: Next to the innermost layer frame_buffer_t** out_frame_buffer

(Output) Frame buffer structure

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.8.5 swap_buffers (WindowSurfacesClass)

Outline

Header

Declaration

Description

Swaps the buffer of the specified layer and displays the drawn content.

RGA.h errnum_t WindowSurfacesClass::swap_buffers( int_fast32_t layer_num,

Canvas2D_ContextClass& context );

See 6.9.9.7 R_WINDOW_SURFACES_SwapBuffers

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 75 of 127

RZ/A1H RGA

Argument

Outline int_fast32_t layer_num Layer number 0: Innermost, +1: Next to the innermost layer

Canvas2D_ContextClass& context

Drawn graphics context

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.8.6 alloc_offscreen_stack (WindowSurfacesClass)

Outline

Header

Declaration

Description

Argument

Return value

Allocates the off-screen buffer from VRAM stack.

RGA.h errnum_t WindowSurfacesClass::alloc_offscreen_stack( frame_buffer_t* in_out_frame_buffer );

See 6.9.9.12 R_WINDOW_SURFACES_AllocOffscreenStack

frame_buffer_t* in_out_frame_buffer

(Input/output) The off-screen buffer

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.8.7 free_offscreen_stack (WindowSurfacesClass)

Outline

Header

Declaration

Description

Argument

Return value

Frees the off-screen buffer to VRAM stack.

RGA.h errnum_t WindowSurfacesClass::free_offscreen_stack( const frame_buffer_t* frame_buffer );

See 6.9.9.13 R_WINDOW_SURFACES_FreeOffscreenStack

frame_buffer_t** out_frame_buffer

(Input/output) The freeing off-screen buffer

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.8.8 do_message_loop (WindowSurfacesClass)

Outline

Header

Declaration

Description

Argument

Return value

Enters the message loop.

RGA.h errnum_t WindowSurfacesClass::do_message_loop();

See 6.9.9.8 R_WINDOW_SURFACES_DoMessageLoop

None

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.8.9 access_layer_attributes (WindowSurfacesClass)

Outline

Header

Declaration

Description

Argument

Return value

Accesses attributes of the specified display layer.

RGA.h errnum_t WindowSurfacesClass::access_layer_attributes( LayerAttributesClass& in_out_Attributes );

See 6.9.9.11 R_WINDOW_SURFACES_AccessLayerAttributes

LayerAttributesClass& in_out_Attributes

(Input/output) Attributes of layer. See 6.6.4.8.

Set read or write to "access" member variable.

Error code. If there is no error, the return value is 0. See section 7.2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 76 of 127

RZ/A1H

6.9.9

6.9.9.1

Functions Equivalent to window_surfaces_t Class Member Functions

List of Functions

RGA

Section Function Name Description

6.9.9.2

R_WINDOW_SURFACES_InitConst Initializes internal variables with constants.

6.9.9.3

R_WINDOW_SURFACES_Initialize Initializes the display device or window and starts displaying graphics.

6.9.9.4

R_WINDOW_SURFACES_Finalize Finalizes the display device.

6.9.9.5

6.9.9.6

R_WINDOW_SURFACES_GetLayerF rameBuffer

R_WINDOW_SURFACES_GetLayer

Count

6.9.9.7

R_WINDOW_SURFACES_SwapBuff ers

Acquires the pointer to the frame buffer structure of the specified layer.

Acquires the number of layers.

Swaps the buffer of the specified layer and displays the drawn content.

Starts to swap for displaying the drawn content.

6.9.9.8

R_WINDOW_SURFACES_SwapBuff ersStart

6.9.9.9

R_WINDOW_SURFACES_WaitForV

Sync

6.9.9.10 R_WINDOW_SURFACES_DoMessag

eLoop

6.9.9.11 R_WINDOW_SURFACES_AccessLa

yerAttributes

Waits for V-Sync signal of the screen.

Enters the message loop.

Accesses attributes of the specified display layer.

6.9.9.12 R_WINDOW_SURFACES_AllocOffsc

reenStack

6.9.9.13 R_WINDOW_SURFACES_FreeOffscr

eenStack

Allocates the off-screen buffer from VRAM stack.

Frees the off-screen buffer to VRAM stack.

6.9.9.2

R_WINDOW_SURFACES_InitConst

Outline

Header

Declaration

Description

Argument

Return value

Initializes internal variables with constants.

RGA.h, window_surfaces.h void R_WINDOW_SURFACES_InitConst( window_surfaces_t* self ); window_surfaces_t* self

None

Frame buffers and screen display

6.9.9.3

R_WINDOW_SURFACES_Initialize

Outline

Header

Declaration

Description

Argument

Initializes the display device or window.

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_Initialize(window_surfaces_t* self,

window_surfaces_config_t* in_out_config );

To control display independently, directly use the frame_buffer_t structure instead of the window_surfaces_t class.

Initializes internal variables.

The entire screen becomes black after initialization.

After calling "R_WINDOW_SURFACES_SwapBuffers" function, to show is started. window_surfaces_t* self Frame buffers and screen display window_surfaces_config_t* in_out_config

See 6.6.5.6.

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.9.4

R_WINDOW_SURFACES_Finalize

Outline Finalizes the display device.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 77 of 127

RZ/A1H RGA

Header

Declaration

Description

Argument

Return value

6.9.9.5

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_Finalize (window_surfaces_t* self, errnum_t e ); window_surfaces_t* self errnum_t e

Frame buffers and screen display

Errors that have occurred. No error = 0

Error code or e, 0 = successful and e = 0 See section 7.2.

R_WINDOW_SURFACES_GetLayerFrameBuffer

Outline

Header

Declaration

Description

Argument

Acquires the pointer to the frame buffer structure of the specified layer.

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_GetLayerFrameBuffer( window_surfaces_t* self, int_t layer_num, frame_buffer_t** out_frame_buffer );

See 6.11.7 Layer structure of sample screen controller.

When the attribute of frame buffer is changed, call

"R_WINDOW_SURFACES_AccessLayerAttributes" function. window_surfaces_t* self int_t layer_num

Frame buffers and screen display

The layer number 0: Innermost, +1: Next to the innermost layer

(Output) Frame buffer structure frame_buffer_t** out_frame_buffer

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.9.6

R_WINDOW_SURFACES_GetLayerCount

Outline

Header

Declaration

Description

Argument

Return value

6.9.9.7

Acquires the number of layers.

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_GetLayerCount( window_surfaces_t* self, int_t* out_layer_count ); window_surfaces_t* self int_t* out_layer_count

Frame buffers and screen display

(Output) Number of layers

Error code. If there is no error, the return value is 0. See section 7.2.

R_WINDOW_SURFACES_SwapBuffers

Outline

Header

Declaration

Description

Argument

Return value

6.9.9.8

Swaps the buffer of the specified layer and displays the drawn content.

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_SwapBuffers( window_surfaces_t* self, int_t layer_num, graphics_t graphics );

If buffer was single buffer, buffer is not swapped. The drawn content is displayed without calling this function, but the progress of the drawing is displayed instead.

If buffer was double buffer, the content after swapping is front of 2 frames. Call

"R_GRAPHICS_Clear" function or call

"R_GRAPHICS_IMAGE_InitByShareFrameBuffer" function with showing frame buffer and copy front of 1 frame by calling "R_GRAPHICS_DrawImage" function.

When Graphics = NULL is specified, completion of drawing is not waited before the buffer is swapped. window_surfaces_t* self int_t layer_num

Frame buffers and screen display

The layer number 0: Innermost, +1: Next to the innermost layer graphics_t graphics The drawn graphics context, NULL enabled

Error code. If there is no error, the return value is 0. See section 7.2.

R_WINDOW_SURFACES_SwapBuffersStart

Outline Starts to swap for displaying the drawn content.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 78 of 127

RZ/A1H RGA

Header

Declaration

Description

Argument

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_SwapBuffersStart( window_surfaces_t* self, int_t layer_num, graphics_t graphics, r_ospl_async_t* async );

Wait for finish drawing by calling "R_GRAPHICS_FinishStart" function before calling this function.

See R_DRIVER_TransferStart function - OS Porting Layer "OSPL" Sample Program. window_surfaces_t* self Frame buffers and screen display int_t layer_num

Return value

6.9.9.9

R_WINDOW_SURFACES_WaitForVSync

The layer number 0: Innermost, +1: Next to the innermost layer graphics_t graphics r_ospl_async_t* async

The drawn graphics context, NULL enabled

(Input/Output) Notify setting. NULL is not permitted

Error code. If there is no error, the return value is 0. See section 7.2.

Outline

Header

Declaration

Description

Waits for V-Sync signal of the screen.

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_WaitForVSync( window_surfaces_t* self, int_fast32_t swap_interval, bool_t is_1_v_sync_at_minimum );

Waits until the V-Sync interrupt enters for the number of times specified by

"swap_interval" from the previous swap.

In the case of "is_1_v_sync_at_minimum = false", when the V-Sync interrupt has already entered for the number of times specified by SwapInterval, the processing immediately returns from this function.

Argument window_surfaces_t* self int_fast32_t swap_interval

Frame buffers and screen display

Number of V-Sync interrupts until the frame buffer is swapped. 0 or more than 0. bool_t is_1_v_sync_at_minimum

Information on whether at least one V-Sync is waited. false=never wait. true=wait 1 times or more than 1.

Error code. If there is no error, the return value is 0. See section 7.2.

Return value

6.9.9.10

R_WINDOW_SURFACES_DoMessageLoop

Outline

Header

Declaration

Description

Enters the message loop.

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_DoMessageLoop( window_surfaces_t* self );

Upon completion of the application, the processing returns from this function.

For the terminating method, see the sub-class specifications. window_surfaces_t* self Frame buffers and screen display Argument

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.9.11

R_WINDOW_SURFACES_AccessLayerAttributes

Outline

Header

Declaration

Accesses attributes of the specified display layer.

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_AccessLayerAttributes( window_surfaces_t* self, layer_attributes_t* in_out_attributes );

Not all attributes are available. It depends on the device and support status. Description

Argument

Return value window_surfaces_t* self layer_attributes_t* in_out_attributes

Frame buffers and screen display

(Input/output) Attributes of layer (6.6.5.7)

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.9.12

R_WINDOW_SURFACES_AllocOffscreenStack

Outline

Header

Allocates the off-screen buffer from VRAM stack.

RGA.h, window_surfaces.h

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 79 of 127

RZ/A1H RGA

Declaration

Description errnum_t R_WINDOW_SURFACES_AllocOffscreenStack( window_surfaces_t* self, frame_bufer_t* in_out_frame_buffer );

Input member variable in "frame_buffer_t" is "stride", "height", "buffer_count".

Output member variable in "frame_buffer_t" is all element of "buffer_address" array.

If the memory was few, E_FEW_ARRAY error is returned.

Allocated off-screen buffer is freed by calling "R_WINDOW_SURFACES_Finalize" function.

Argument

Return value window_surfaces_t* self frame_bufer_t* in_out_frame_buffer

Frame buffers and screen display

(Input/output) The off-screen buffer

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.9.13

R_WINDOW_SURFACES_FreeOffscreenStack

Outline

Header

Declaration

Description

Argument

Return value

Frees the off-screen buffer to VRAM stack.

RGA.h, window_surfaces.h errnum_t R_WINDOW_SURFACES_FreeOffscreenStack( window_surfaces_t* self, frame_bufer_t* frame_buffer );

Input member variable in "frame_buffer_t" is "buffer_count", "buffer_address".

If freeing order is not reverse of allocating order, E_ACCESS_DENIED error is returned. window_surfaces_t* self Frame buffers and screen display frame_bufer_t* in_out_frame_buffer

(Input/output) The freeing off-screen buffer

Error code. If there is no error, the return value is 0. See section 7.2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 80 of 127

RZ/A1H

6.9.10 Functions Related to byte_per_pixel_t Class

6.9.10.1

List of Functions

RGA

Section Function Name Description

6.9.10.2 R_RGA_BitPerPixelType_To_Byte

PerPixelType

6.9.10.3 R_RGA_BytePerPixelType_To_Bit

PerPixelType

6.9.10.4 R_BYTE_PER_PIXEL_IsInteger

Converts the number of bits per pixel to the number of bytes per pixel (with decimal part).

Converts the number of bytes per pixel (with decimal part) to the number of bits per pixel.

Returns information on whether the number of bytes per pixel is an integer.

6.9.10.2

R_RGA_BitPerPixelType_To_BytePerPixelType

Outline

Header

Declaration

Description

Argument

Converts the number of bits per pixel to the number of bytes per pixel (with decimal part).

RGA.h byte_per_pixel_t R_RGA_BitPerPixelType_To_BytePerPixelType( int_t bit_per_pixel ); int_t bit_per_pixel Number of bits per pixel

Return value Number of bytes per pixel (with decimal part)

6.9.10.3

R_RGA_BytePerPixelType_To_BitPerPixelType

Outline

Header

Declaration

Description

Argument

Converts the number of bytes per pixel (with decimal part) to the number of bits per pixel.

RGA.h int_t R_RGA_BytePerPixelType_To_BitPerPixelType(byte_per_pixel_t byte_per_pixel ); byte_per_pixel_t byte_per_pixel Number of bytes per pixel (with decimal part)

Return value Number of bits per pixel

6.9.10.4

R_BYTE_PER_PIXEL_IsInteger

Outline

Header

Declaration

Description

Argument

Return value

Returns information on whether the number of bytes per pixel is an integer.

RGA.h bool_t R_BYTE_PER_PIXEL_isInteger( byte_per_pixel_t byte_per_pixel ); byte_per_pixel_t byte_per_pixel Number of bytes per pixel (with decimal part)

Information on whether the number of bits per pixel is an integer

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 81 of 127

RZ/A1H

6.9.11 Functions Related to v_sync_t Class

6.9.11.1

List of Functions

RGA

Section Function Name Description

6.9.11.2

R_V_SYNC_Initialize

6.9.11.3

R_V_SYNC_Finalize

6.9.11.4

R_V_SYNC_Wait

Attaches to the V-Sync interrupt.

Detaches from the V-Sync interrupt.

Waits until the V-Sync interrupt enters.

6.9.11.5

R_V_SYNC_WaitStart

6.9.11.6

R_V_SYNC_OnInterrupting

Starts to wait for V-Sync interrupt.

Receives V-Sync interrupt.

6.9.11.7

R_V_SYNC_GetAsyncStatus Gets the status of asynchronous operation and interrupt.

6.9.11.2

R_V_SYNC_Initialize

Outline

Header

Declaration

Description

Argument

Return value

Attaches to the V-Sync interrupt.

RGA.h.h, vsync.h errnum_t R_V_SYNC_Initialize( int_fast32_t ChannelNum );

Calls back the porting layer function of the interrupt from inside of this function.

When the V-Sync interrupt has already been attached, an error occurs.

When the V-Sync interrupt is controlled by the application, this function cannot be used.

This function is used in the window_surfaces_t class. The v_sync_t class cannot be used when the window_surfaces_t class is used. int_fast32_t ChannelNum Channel number of the screen

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.11.3

R_V_SYNC_Finalize

Outline

Header

Declaration

Description

Argument

Return value

Detaches from the V-Sync interrupt.

RGA.h.h, vsync.h errnum_t R_V_SYNC_Finalize( int_fast32_t ChannelNum, errnum_t e ); int_fast32_t ChannelNum Channel number of the screen

Error code or e, 0 = successful and e = 0 See section 7.2.

6.9.11.4

R_V_SYNC_Wait

Outline

Header

Declaration

Description

Argument

Return value

Waits until the V-Sync interrupt enters.

RGA.h.h, vsync.h errnum_t R_V_SYNC_WaitForInterrupt( int_fast32_t ChannelNum, int_fast32_t

SwapInterval, bool_t Is1VSyncAtMinimum );

Waits until the V-Sync interrupt enters for the number of times specified by

SwapInterval from the previous swap.

In the case of Is1VSyncAtMinimum = false, when the V-Sync interrupt has already entered for the number of times specified by SwapInterval, the processing immediately returns from this function. int_fast32_t ChannelNum int_fast32_t SwapInterval

Channel number of the screen

Number of V-Sync interrupts until the frame buffer is swapped. 0 or more than 0. bool_t Is1VSyncAtMinimum Information on whether at least one V-Sync is waited. false=never wait. true=wait 1 times or more than 1.

Error code. If there is no error, the return value is 0. See section 7.2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 82 of 127

RZ/A1H RGA

6.9.11.5

R_V_SYNC_WaitStart

Outline

Header

Declaration

Description

Argument

Return value

Starts to wait for V-Sync interrupt.

RGA.h, vsync.h errnum_t R_V_SYNC_WaitStart( int_fast32_t ChannelNum, int_fast32_t

SwapInterval, bool_t Is1VSyncAtMinimum, r_ospl_async_t* Async );

This is the asynchronous function of R_V_SYNC_Wait function.

See R_DRIVER_TransferStart function - OS Porting Layer "OSPL" Sample Program. int_fast32_t ChannelNum Channel number of the screen int_fast32_t SwapInterval Number of V-Sync interrupts until the frame buffer is swapped. 0 or more than 0. bool_t Is1VSyncAtMinimum Information on whether at least one V-Sync is waited. false=never wait. true=wait 1 times or more than 1. r_ospl_async_t* Async (Input/Output) Notify setting. NULL is not permitted

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.11.6

R_V_SYNC_OnInterrupting

Outline

Header

Declaration

Description

Argument

Return value

Receives V-Sync interrupt.

RGA.h, vsync.h errnum_t R_V_SYNC_OnInterrupting( r_ospl_interrupt_t* InterruptSource );

See R_DRIVER_OnInterrupting function - OS Porting Layer "OSPL" Sample

Program. r_ospl_interrupt_t*

InterruptSource

Interrupt source

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.11.7

R_V_SYNC_GetAsyncStatus

Outline

Header

Declaration

Description

Argument

Return value

Gets the status of asynchronous operation and interrupt.

RGA.h, vsync.h errnum_t R_V_SYNC_GetAsyncStatus( int_fast32_t ChannelNum, const r_v_sync_async_status_t** out_Status );

See R_DRIVER_GetAsyncStatus function - OS Porting Layer "OSPL" Sample

Program. int_fast32_t ChannelNum Channel number of the screen const r_v_sync_async_status_t** out_Status

(Output) Pointer to the structure of interrupt and asynchronous operation

Error code. If there is no error, the return value is 0. See section 7.2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 83 of 127

RZ/A1H

6.9.12 Functions Related to vram_ex_stack_t class

6.9.12.1

List of Functions

RGA

Section Function Name Description

6.9.12.2

R_VRAM_EX_STACK_Initialize

6.9.12.3

R_VRAM_EX_STACK_Alloc

6.9.12.4

R_VRAM_EX_STACK_Free

Initialize the stack in the external RAM.

Allocates the off-screen buffer from the external RAM.

Frees the off-screen buffer to the external RAM.

6.9.12.2

R_VRAM_EX_STACK_Initialize

Outline

Header

Declaration

Description

Argument

Return value

Initialize the stack in the external RAM.

RGA.h, RGA_SampleLib_Port.h errnum_t R_VRAM_EX_STACK_Initialize( vram_ex_stack_t* self, void* null_config );

If to re-initialize was done, all allocated off-screen buffer is freed. vram_ex_stack_t* self The stack in the external RAM void* null_config The reserved variable. Pass NULL

Error code. If there is no error, the return value is 0.

6.9.12.3

R_VRAM_EX_STACK_Alloc

Outline

Header

Declaration

Description

Argument

Allocates the off-screen buffer from the external RAM.

RGA.h, RGA_SampleLib_Port.h errnum_t R_VRAM_EX_STACK_Alloc( vram_ex_stack_t* self, frame_bufer_t* in_out_frame_buffer );

Input member variable in "frame_buffer_t" is "stride", "height", "buffer_count".

Output member variable in "frame_buffer_t" is all element of "buffer_address" array.

If the memory was few, E_FEW_ARRAY error is returned.

Allocated off-screen buffer is freed by calling "R_VRAM_EX_STACK_Initialize" function. vram_ex_stack_t* self frame_bufer_t* in_out_frame_buffer

The stack in the external RAM

(Input/output) The off-screen buffer

Return value

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.12.4

R_VRAM_EX_STACK_Free

Outline

Header

Declaration

Description

Argument

Return value

Frees the off-screen buffer to the external RAM.

RGA.h, RGA_SampleLib_Port.h errnum_t R_VRAM_EX_STACK_Free( vram_ex_stack_t* self, frame_bufer_t* frame_buffer );

Input member variable in "frame_buffer_t" is "buffer_count", "buffer_address".

If freeing order is not reverse of allocating order, E_ACCESS_DENIED error is returned. vram_ex_stack_t* self frame_bufer_t* in_out_frame_buffer

The stack in the external RAM

(Input/output) The freeing off-screen buffer

Error code. If there is no error, the return value is 0. See section 7.2.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 84 of 127

RZ/A1H

6.9.13 Functions Related to animation_timing_function_t class

6.9.13.1

List of Functions

RGA

Section Function Name Description

6.9.13.2

R_Get_AnimationTimingFunction Gets defined animation timing.

6.9.13.3

R_ANIMATION_TIMING_FUNCTI

ON_GetValue

Calculates an attribute value at the specified elapsed time from the time starting animation.

6.9.13.2

R_Get_AnimationTimingFunction

Outline

Header

Declaration

Description

Argument

Gets defined animation timing.

RGA.h errnum_t R_Get_AnimationTimingFunction( char* timing_name,

animation_timing_function_t** out_timing ); char* timing_name The name of animation timing. The following name can be passed:

"ease", "linear", "ease_in", "ease_out", "ease_in_out"

Return value animation_timing_functio n_t** out_timing

(Output) The address of animation timing object

Error code. If there is no error, the return value is 0. See section 7.2.

6.9.13.3

R_ANIMATION_TIMING_FUNCTION_GetValue

Outline

Header

Declaration

Description

Calculates an attribute value at the specified elapsed time from the time starting animation.

RGA.h float32_t

R_ANIMATION_TIMING_FUNCTION_GetValue( animation_timing_function_t* self, float32_t clamp_time, float32_t value_of_previous_keyframe, float32_t value_of_next_keyframe );

Attribute value is user defined position value, color value or other value changed by time

Attribute

Time ease linear

Example: ease-in

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016 ease-out ease-in-out

Page 85 of 127

RZ/A1H

Argument

Return value

RGA timing_name="linear", value_of_previous_keyframe=10, value_of_next_keyframe=20, clamp_time=0.5

This case returns 15. animation_timing_function_t* self float32_t clamp_time

The animation timing object

The percentage of time from previous key frame

(clamp_time=0.0) to next key frame

(clamp_time=1.0). (decimal from 0.0 to 1.0) float32_t value_of_previous_keyframe float32_t value_of_next_keyframe

The value of attribute at the previous key frame

The value of attribute at the next key frame

The value of attribute at the time of "clamp_time" argument

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 86 of 127

RZ/A1H

6.9.14 Other Functions

6.9.14.1

List of Functions

RGA

Section Function Name Description

6.9.14.2

R_RGA_Get_R8G8B8A8

6.9.14.3

R_RGA_CalcWorkBufferSize

6.9.14.4

R_RGA_CalcWorkBufferB_Size

Returns the R8G8B8A8 color value.

Calculates the size required for the work buffer.

Calculates the size required for the work buffer B.

6.9.14.2

R_RGA_Get_R8G8B8A8

Outline

Header

Declaration

Description

Argument

Returns the R8G8B8A8 color value.

RGA.h r8g8b8a8_t R_RGA_Get_R8G8B8A8( int_t red, int_t green, int_t blue, int_t alpha ); int_t red, int_t green, int_t blue, int_t alpha

Each color component 0 to 255

Return value R8G8B8A8 color value

6.9.14.3

R_RGA_CalcWorkBufferSize

Outline

Header

Declaration

Description

Calculates the size required for the work buffer.

RGA.h size_t R_RGA_CalcWorkBufferSize( int_t MaxHeightOfFrameBuffer );

Parameters may change in the future.

R_RGA_CalcWorkBufferSize is the #define macro.

Requested size for work buffer:

Maximum length of display list + 64 * (Maximum height of the frame buffer (multiple of

8)) *4*2 [Bytes]

Maximum length of display list = 184

See: 6.6.5.3 graphics_config_t

Argument

Return value int_t

MaxHeightOfFrameBuffer

Maximum height of the frame buffer to be a drawing destination

Size (bytes) required for the work buffer

6.9.14.4

R_RGA_CalcWorkBufferB_Size

Outline

Header

Declaration

Description

Calculates the size required for the work buffer B.

RGA.h size_t R_RGA_CalcWorkBufferB_Size( int_t MaxWidthOfJPEG, int_t

MaxHeightOfJPEG, int_t MaxBytePerPixelOfFrameBuffer );

Parameters may change in the future.

R_RGA_CalcWorkBufferB_Size is the #define macro.

Requested size for work buffer B: ceil_16( MaxWidthOfJPEG ) * ceil_16( MaxHeightOfJPEG ) *

MaxBytePerPixelOfFrameBuffer [Bytes] ceil_16: round up to multiples of 16

When PNG image was decoded, the work area (size is set to work_size_for_libPNG member variable) of LibPNG is allocated in work buffer B. But

R_RGA_CalcWorkBufferB_Size macro is not added this size.

The work buffer B is not requested, if all following condition were fulfilled (JPEG

Codec Unit (JCU) in RZ/A1H, M can draw directly) or any JPEG images are not drawn.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 87 of 127

RZ/A1H

Argument

Return value

RGA

 The drawing target address of left up of JPEG image can be divided by 8.

 The size of JPEG image is multiples of MCU (Minimum Coded Unit). The size is depend on the pixel format of the JPEG data.

 16pixels x 8lines (JPEG image is YCbCr422 format)

 16pixels x 16lines (JPEG image is YCbCr420 format)

 8pixels x 8lines (JPEG image is YCbCr444 format)

 32pixels x 8lines (JPEG image is YCbCr411 format)

 The matrix is unit matrix or translation only.

The return value is set in "graphics_config_t" type. See 6.6.5.3 graphics_config_t

int_t MaxWidthOfJPEG The maximum width of JPEG image int_t MaxHeightOfJPEG int_t

MaxBytePerPixelOfFrameB uffer

The maximum height of JPEG image

The maximum bytes of the drawing target frame buffer.

If the matrix is not unit matrix and not translation only, this argument is 4

Size (bytes) required for the work buffer

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 88 of 127

RZ/A1H

6.9.15 Functions in strings

6.9.15.1

List of Functions

RGA

Section

6.9.15.2

rgb

6.9.15.3

rgba

6.9.15.2 rgb

Outline

Header

Declaration

Description

Argument

Return value

6.9.15.3 rgba

Outline

Header

Declaration

Description

Function Name

RGA.h

Description

Returns the value of color from CSS Color format

Returns the value of color from CSS Color format with alpha

Returns the value of color from CSS Color format r8g8b8a8_t rgb( int_t red_max255, int_t green_max255, int_t blue_max255 );

Example: "rgb( 255, 255, 0 )"

Target: fillStyle (6.8.1.3)

The value of alpha component is maximum value (=1.0). int_t red_max255 The value of red component (0-255) int_t green_max255 The value of green component (0-255) int_t blue_max255 The value of blue component (0-255)

The value of R8G8B8A8 color.

Returns the value of color from CSS Color format with alpha

RGA.h r8g8b8a8_t rgba( int_t red_max255, int_t green_max255, int_t blue_max255, float32_t alpha_max1 );

Example: "rgba( 255, 255, 0, 0.5 )"

Target: fillStyle (6.8.1.3) int_t red_max255 int_t green_max255

The value of red component (0-255)

The value of green component (0-255) int_t blue_max255 float32_t alpha_max1

The value of blue component (0-255)

The value of alpha component (0.0-1.0)

The value of R8G8B8A8 color.

Argument

Return value

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 89 of 127

RZ/A1H RGA

6.10 Porting layer Functions

This section describes porting layer functions called back from RGA. The package contains a sample which can be modified by the user.

For functions with names that end with _FuncType, a function to be registered must be called at the beginning of the main function, but the function can be modified dynamically.

Other functions must be solved at the time of linkage and cannot be modified dynamically.

6.10.1 Functions on Default Settings of RGA

6.10.1.1

List of Functions

Section Function Name Description

6.10.1.2

R_GRAPHICS_STATIC_O nInitializeDefault

6.10.1.3

R_GRAPHICS_OnInitialize

_FuncType

6.10.1.4

R_GRAPHICS_STATIC_O nFinalizeDefault

6.10.1.5

R_GRAPHICS_OnFinalize

_FuncType

Default of the callback function that sets the default graphics_config_t value

Type of the callback function that sets the default graphics_config_t value

Default of the function that releases memory allocated in the

R_GRAPHICS_OnInitialize_FuncType function

Type of the function that releases memory allocated in the

R_GRAPHICS_OnInitialize_FuncType function

6.10.1.2

R_GRAPHICS_STATIC_OnInitializeDefault

Outline

Header

Declaration

Description

Argument

Return value

Default of the callback function that sets the default graphics_config_t value

RGA.h errnum_t R_GRAPHICS_STATIC_OnInitializeDefault( graphics_t* self,

graphics_config_t* in_out_config, void** out_default_object );

Default of the R_GRAPHICS_OnInitialize_FuncType function type graphics_t* self Address of the object (non-initialized) at which initialization starts graphics_config_t* in_out_config void** out_default_object

See section 6.6.5.3.

(Output) Memory allocated in this function

Error code. If there is no error, the return value is 0.

6.10.1.3

R_GRAPHICS_OnInitialize_FuncType

Outline

Header

Declaration

Description

Argument

Return value

Type of the callback function that sets the default graphics_config_t value

RGA.h errnum_t R_GRAPHICS_OnInitialize_FuncType( graphics_t* self,

graphics_config_t* in_out_config, void** out_default_object );

Use R_GRAPHICS_STATIC_SetOnInitialize() to register callback functions of this function type.

Callback functions of this function type are called back immediately after

R_GRAPHICS_Initialize() is called.

*out_default_object is used only to be released in inter

R_GRAPHICS_OnInitialize_FuncType(). When

R_GRAPHICS_OnInitialize_FuncType() is not called back, it is not necessary to set

*out_default_object. graphics_t* self Address of the object (non-initialized) at which initialization starts graphics_config_t* in_out_config void** out_default_object

See section 6.6.5.3.

(Output) Memory allocated in this function

Error code. If there is no error, the return value is 0.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 90 of 127

RZ/A1H

6.10.1.4

R_GRAPHICS_STATIC_OnFinalizeDefault

Outline

Header

Declaration

Description

Argument

Return value

Default of the function that releases memory allocated in the

R_GRAPHICS_OnInitialize_FuncType function

RGA.h errnum_t R_GRAPHICS_STATIC_OnFinalizeDefault( graphics_t* self,

void* default_object, errnum_t e );

Default of the R_GRAPHICS_OnFinalize_FuncType function type graphics_t* self Address of the object that has been finalized void* default_object errnum_t e

(Output) Memory allocated in this function

Errors that have occurred. No error = 0

Error code or e, 0 = successful and e = 0

6.10.1.5

R_GRAPHICS_OnFinalize_FuncType

Outline

Header

Declaration

Description

Argument

Return value

Type of the function that releases memory allocated in the

R_GRAPHICS_OnInitialize_FuncType function

RGA.h errnum_t R_GRAPHICS_OnFinalize_FuncType( graphics_t* self,

void* default_object, errnum_t e );

Use GRAPHICS_STATIC_SetOnFinalize() to register callback functions of this function type.

Callback functions of this function type are called back from the end of the

R_GRAPHICS_Finalize() function.

The output default_object value is contained in *out_default_object of the

R_GRAPHICS_OnInitialize_FuncType() function. graphics_t* self void* default_object errnum_t e

Address of the object that has been finalized

(Output) Memory allocated in this function

Errors that have occurred. No error = 0

Error code or e, 0 = successful and e = 0

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 91 of 127

RZ/A1H RGA

6.10.2 Porting layer functions of OSPL

RGA uses following functions of OSPL API. If the memory map or OS was changed, change define of OSPL API functions or replace to functions already changed. More information is in the document of RZ/A1H group OS Porting

Layer "OSPL" Sample Program (R01AN1887EJ).

 Functions depended on the memory map

 R_OSPL_ToCachedAddress

 R_OSPL_ToUncachedAddress

 R_OSPL_ToPhysicalAddress

 R_OSPL_MEMORY_GetLevelOfFlush

 R_OSPL_AXI_Get2ndCacheAttribute

 Functions depended on OS

 R_OSPL_THREAD_GetCurrentId

 R_OSPL_EVENT_Set

 R_OSPL_EVENT_Clear

 R_OSPL_EVENT_Wait

 R_OSPL_MEMORY_Flush

 R_OSPL_Delay

 Functions depended on the compiler or OS

 INLINE

 STATIC_INLINE

 R_OSPL_SECTION

 R_OSPL_ALIGNMENT

 R_OSPL_EnableAllInterrupt

 R_OSPL_DisableAllInterrupt

 R_OSPL_MEMORY_Barrier

 Functions depended on hardware

 R_OSPL_FTIMER_InitializeIfNot

 R_OSPL_FTIMER_Get

 Functions no depended on

 (some functions)

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 92 of 127

RZ/A1H RGA

6.10.3 Porting layer functions of RGPNCG

RGA uses following functions of RGPNCG. If the OS was changed, change define of RGPNCG functions or replace functions to function already changed

.

If NCGSYS_*State functions use event flags of OSPL, it is necessary to port NCGSYS_*State functions.

 Functions depended on OS

Section Function Name Description

6.10.3.1

6.10.3.2

NCGSYS_CreateState

NCGSYS_DestroyState

6.10.3.3

NCGSYS_SetState

6.10.3.4

NCGSYS_GetState

6.10.3.5

NCGSYS_WaitState

Creates an event flags of RGPNCG.

Destroys the event flags of RGPNCG.

Changes the value of the event flags of RGPNCG.

Gets the value of the event flags of RGPNCG.

Waits for the value of the event flags of RGPNCG until specified value.

Sets using value of OS event flags

6.10.3.6

NCGSYS_SetStateEventV alue

6.10.3.7

NCGSYS_GetLastCreated

State

6.10.3.8

NCGSYS_SetNextStateEv entValue

6.10.3.9

NCGVG_Attach_ISR

6.10.3.10 NCGVG_Detach_ISR

6.10.3.11 NCGVGISRfp

Returns last created event flags

Sets value of next creating event flags

Registers the interrupt callback function for R-GPVG2.

Unregisters the interrupt callback function for R-GPVG2.

Type of the interrupt callback function for R-GPVG2.

 Functions depended on the policy of Power-Down Modes

Section Function Name Description

6.10.3.12 NCGVG_Init

6.10.3.13 NCGVG_DeInit

 Functions no depended on

 NCGSYS_Abort

 NCGSYS_CPUVAddrToSysPAddr

 NCGSYS_ReadReg

 NCGSYS_WriteReg

Starts to use R-GPVG2

Ends to use R-GPVG2

6.10.3.1

NCGSYS_CreateState

Outline

Header

Declaration

Description

Argument

Return value

Creates an event flags of RGPNCG. ncg_state.h

NCGint32 NCGSYS_CreateState( NCGvoid** ppObj, NCGuint32 ui32StateID );

Change define of this function for the target OS.

If thread attached event of OSPL was called, it is not have to change define.

NCGvoid** ppObj (Output) A event flags object

NCGuint32 ui32StateID Not used

Error code. If there is no error, the return value is NCG_no_err.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 93 of 127

RZ/A1H RGA

6.10.3.2

NCGSYS_DestroyState

Outline

Header

Declaration

Description

Argument

Return value

Destroys the event flags of RGPNCG. ncg_state.h

NCGint32 NCGSYS_DestroyState( NCGvoid *pObj );

If thread attached event of OSPL was called, it is not have to change define.

Change define of this function for the target OS.

NCGvoid* pObj The event flags object

Error code. If there is no error, the return value is NCG_no_err.

6.10.3.3

NCGSYS_SetState

Outline

Header

Declaration

Description

Argument

Changes the value of the event flags of RGPNCG. ncg_state.h

NCGint32 NCGSYS_SetState( NCGvoid* pObj, NCGuint32 ui32State, NCGuint32 ui32Flags );

Change define of this function for the target OS.

If thread attached event of OSPL was called, it is not have to change define.

NCGvoid* pObj

NCGuint32 ui32State

The event flags object

See the description of ui32Flags argument

NCGuint32 ui32Flags Case of NCGSYS_STATE_SET_SET:

Changes all bits of the event flags to the value of ui32State argument

Case of NCGSYS_STATE_SET_OR:

Does the OR operation with the event flags. Sets 1 to the event flags' bits of the column set 1 in ui32State argument.

Case of NCGSYS_STATE_SET_AND:

Does the AND operation with the event flags. Sets 0 to the event flags' bits of the column set 0 in ui32State argument.

Return value Error code. If there is no error, the return value is NCG_no_err.

6.10.3.4

NCGSYS_GetState

Outline

Header

Declaration

Description

Argument

Return value

Gets the value of the event flags of RGPNCG. ncg_state.h

NCGuint32 NCGSYS_GetState( NCGvoid* pObj, NCGuint32 ui32Flags );

Change define of this function for the target OS.

If thread attached event of OSPL was called, it is not have to change define.

NCGvoid* pObj

NCGuint32 ui32Flags

The event flags object

Not used

The value of the event flags.

6.10.3.5

NCGSYS_WaitState

Outline

Header

Declaration

Description

Argument

Waits for the value of the event flags of RGPNCG until specified value. ncg_state.h

NCGint32 NCGSYS_WaitState( NCGvoid* pObj, NCGuint32 ui32State, NCGuint32 ui32Flags, NCGuint32 ui32Timeout );

Change define of this function for the target OS.

If thread attached event of OSPL was called, it is not have to change define.

Status are not cleared.

When 2 bits are set, this function can be called to waiting one bit after calling it to waiting other bit.

This function can be called to waiting one bit many times after the bit was set 1 time.

NCGvoid* pObj The event flags object

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 94 of 127

RZ/A1H RGA

NCGuint32 ui32State

NCGuint32 ui32Flags

The value of bits set to 1 waiting for bits that become to 1

Case of NCGSYS_STATE_WAIT_AND:

Waits for all bits are 1 that bits are 1 in the specified ui32State argument.

Case of NCGSYS_STATE_WAIT_OR:

Waits for any bits are 1 that bits are 1 in the specified ui32State argument.

Return value

NCGuint32 ui32Timeout NCG_TIMEOUT_INFINITE is passed.

Error code. If there is no error, the return value is NCG_no_err.

6.10.3.6

NCGSYS_SetStateEventValue

Outline

Header

Declaration

Description

Argument

Return value

Sets using value of thread attached event flags ncg_state.h

NCGvoid NCGSYS_SetStateEventValue ( NCGvoid* pObj, NCGuint32 ui32EventValue );

Define this function, if not defined.

If thread attached event of OSPL was called, it is not have to change define.

Thread attached event flags specified with "NCGSYS_SetState" function is set to variables in NCG.

Thread attached event flags specified with "NCGSYS_SetStateEventValue" function is set to OS objects.

NCGvoid* pObj A event flag of NCG

NCGuint32 ui32EventValue Value setting to thread attached event flags

None

6.10.3.7

NCGSYS_GetLastCreatedState

Outline

Header

Declaration

Description

Argument

Return value

Returns last created event flags ncg_state.h

NCGvoid* NCGSYS_GetLastCreatedState(void);

Define this function, if not defined.

If thread attached event of OSPL was called, it is not have to change define.

This function returns an event flags created by "NCGSYS_CreateState" function.

Thread preemption does not occurred from calling "NCGSYS_CreateState" function to calling "NCGSYS_GetLastCreatedState" function in RGA.

None

Last created event flags

6.10.3.8

NCGSYS_SetNextStateEventValue

Outline

Header

Declaration

Description

Sets value of next creating event flags ncg_state.h

NCGvoid NCGSYS_SetNextStateEventValue ( NCGuint32 ui32EventValue );

Define this function, if not defined.

If thread attached event of OSPL was called, it is not have to change define.

This function registers the value of thread attached event of created thread by

"NCGSYS_CreateState" function after this function called.

R_OSPL_UNUSED_FLAG can be specified. Notification target thread is a thread called "R_GRAPHICS_Initialize". "graphics_config_t::internal_event_value" is specified with this function in RGA. Thread preemption does not occurred from calling "NCGSYS_CreateState" function to calling "NCGSYS_GetLastCreatedState" function in RGA.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 95 of 127

RZ/A1H RGA

Argument

Return value

NCGuint32 ui32EventValue

None

Value setting to thread attached event flags

6.10.3.9

NCGVG_Attach_ISR

Outline

Header

Declaration

Description

Argument

Return value

Registers the interrupt callback function for Renesas Graphics Processor for

OpenVG™ (R-GPVG2). ncg_vg_isr.h

NCGint32 NCGVG_Attach_ISR( NCGVGISRfp pfnInterrupt );

Change define of this function for the target OS.

NCGVGISRfp pfnInterrupt The interrupt callback function

Error code. If there is no error, the return value is NCG_no_err.

6.10.3.10

NCGVG_Detach_ISR

Outline

Header

Declaration

Description

Argument

Return value

Unregisters the interrupt callback function for Renesas Graphics Processor for

OpenVG™ (R-GPVG2). ncg_vg_isr.h

NCGint32 NCGVG_Detach_ISR( NCGVGISRfp pfnInterrupt );

Change define of this function for the target OS.

NCGVGISRfp pfnInterrupt The interrupt callback function

Error code. If there is no error, the return value is NCG_no_err.

6.10.3.11

NCGVGISRfp

Outline

Header

Declaration

Description

Type of the interrupt callback function for Renesas Graphics Processor for

OpenVG™ (R-GPVG2). ncg_defs.h

NCGuint32 (*NCGVGISRfp)(void);

Call "R_GRAPHICS_OnInterrupting" function from the last of this callback function.

In attached "RGPNCG", "NCGVGISRfp" type function is "NCGVG_RGPVG_ISR".

None

None

Argument

Return value

6.10.3.12

NCGVG_Init

Outline

Header

Declaration

Description

Starts to use

Renesas Graphics Processor for OpenVG™ (R-GPVG2) ncg_vg.h

NCGvoid NCGVG_Init( PNCGVGINFO pVGInfo );

If the Power-Down Mode of Renesas graphics processor for Renesas

Graphics Processor for OpenVG™ (R-GPVG2) was the halted state, change to the running state in this function.

PNCGVGINFO pVGInfo Not used

None

Argument

Return value

6.10.3.13

NCGVG_DeInit

Outline

Header

Declaration

Description

Argument

Return value

Ends to use

Renesas Graphics Processor for OpenVG™ (R-GPVG2) ncg_vg.h

NCGvoid NCGVG_DeInit( PNCGVGINFO pVGInfo );

If necessary, change the Power-Down Mode of Renesas graphics processor for

Renesas Graphics Processor for OpenVG™ (R-GPVG2) to the halted state in this function.

PNCGVGINFO pVGInfo

None

Not used

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 96 of 127

RZ/A1H

6.11 Supplementary Explanation

6.11.1 Correspondence to Canvas 2D and Correspondence to Hardware Acceleration

In the hardware column, ✓: Hardware is used, x: No hardware is used, —: Not applicable

Canvas2D API RGA - C++ API RGA - C language API

1 Conformance requirements

CanvasRenderingContext2D interface. getContext()

Canvas2D_ContextClass graphics_t

-

-

R_RGA_New_Canvas2D_Conte xtClass

R_GRAPHICS_Initialize

-

- context.canvas

CSS currentColor

2 The canvas state

.save ()

.restore()

3 Transformations

.scale(x, y)

.rotate(angle)

.translate(x, y)

.transform(a, b, c, d, e, f)

.setTransform(a, b, c, d, e, f)

4 Line styles

.lineWidth

.lineCap, .lineJoin, .miterLimit

5 Text styles

6 Building paths

.moveTo()

.closePath()

.lineTo()

.quadraticCurveTo()

.bezierCurveTo()

.arcTo()

.arc()

.rect()

7 Fill and stroke styles

.fillStyle single-color

.fillStyle gradation

.fillStyle pattern

.strokeStyle single-color

.strokeStyle gradation

-

-

.save()

.restore()

.scale(x, y)

.rotate(angle)

.translate(x, y)

.transform(a, b, c, d, e, f)

.setTransform(a, b, c, d, e, f)

-

-

-

-

-

-

-

-

.rect()

.fillStyle

-

-

-

.fillStyle

-

-

R_GRAPHICS_Save

R_GRAPHICS_Restore

R_GRAPHICS_ScaleMatrix

R_GRAPHICS_RotateMatrixRadian

R_GRAPHICS_TranslateMatrix

R_GRAPHICS_TransformMatrix

R_GRAPHICS_SetMatrix_2x3

-

-

-

-

-

-

-

-

R_GRAPHICS_Rect

R_GRAPHICS_SetFillColor

-

-

-

R_GRAPHICS_SetFillPattern

RGA

Hard ware

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 97 of 127

RZ/A1H

.strokeStyle pattern

.createLinearGradient()

.createRadialGradient() -

CanvasGradient.addColorStop() -

-

-

.createPattern() .createPattern()

8 The current default path

.beginPath()

.fill()

.stroke()

.drawSystemFocusRing()

.beginPath()

-

-

-

.drawCustomFocusRing()

.scrollPathIntoView()

.clip()

-

-

.clip()

(Only a single rectangle)

- .isPointInPath()

9 Drawing rectangles to the canvas

.clearRect()

.fillRect()

.clearRect()

.fillRect()

- .strokeRect()

10 Drawing text to the canvas

11 Drawing images to the canvas

.drawImage( dx, dy )

.drawImage( dx, dy, dw, dh )

-

.drawImage()

.drawImage()

.drawImage( sx, sy, sw, sh, dx, dy, dw, dh )

12 Pixel manipulation

.drawImage()

.createImageData( Width,

Height )

.createImageData()

.createImageData( ImageData ) .createImageData()

ImageData.width ImageData.width

ImageData.height

ImageData.data

.getImageData()

.putImageData()

ImageData.height

ImageData.data

.getImageData()

.putImageData()

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

-

-

-

-

R_GRAPHICS_PATTERN_Initializ e

RGA

R_GRAPHICS_BeginPath

-

-

-

-

-

R_GRAPHICS_Clip

(Only a single rectangle)

-

R_GRAPHICS_Clear

R_GRAPHICS_FillRect

-

-

R_GRAPHICS_DrawImage

R_GRAPHICS_DrawImageResized

R_GRAPHICS_DrawImageChild

R_GRAPHICS_IMAGE_-

InitR8G8B8A8

R_GRAPHICS_IMAGE_-

InitSameSizeR8G8B8A8

R_GRAPHICS_IMAGE_GetProperti es

R_GRAPHICS_IMAGE_GetProperti es

R_GRAPHICS_IMAGE_GetProperti es

R_GRAPHICS_IMAGE_-

InitCopyFrameBufferR8G8B8A8

R_GRAPHICS_DrawImage

R_GRAPHICS_DrawImageChild

— x x

Page 98 of 127

RZ/A1H

13 Compositing

.globalAlpha

.globalCompositeOperation

14 Shadows

.globalAlpha

.globalCompositeOperation

-

R_GRAPHICS_SetGlobalAlpha

R_GRAPHICS_-

SetGlobalCompositeOperation

-

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 99 of 127

RZ/A1H RGA

6.11.2 Internal operation in initialize function

Take care by referring the following call tree and comment, if RGA initialize was failed, please. And there is a

possibility to know a reason of the error by "SearchErrorInformation" command. See section 7.2. And see section 2

about general information of porting.

R_GRAPHICS_Initialize

A function registered by "R_GRAPHICS_STATIC_OnInitializeDefault" or

"R_GRAPHICS_STATIC_SetOnInitialize"

// Sets default value of "graphics_config_t" and work buffer

R_OSPL_ToUncachedAddress

// Change the address of work buffer to the address in uncached area or check the address

R_OSPL_ToPhysicalAddress

// Change the address of work buffer to physical address or check the address

NCGSYS_WriteReg (This function will be called many times from here.)

// An exception is raised, if R-GPVG was not supplied clock

// it is supplied by callbacking "NCGVG_Init"

NCGVG_Init

NCGSYS_CreateState

NCGSYS_SetState( 0x33, NCGSYS_STATE_SET_OR )

R_OSPL_EVENT_Set

NCGVG_Attach_ISR

NCGSYS_SetState( ~0x02, NCGSYS_STATE_SET_AND )

R_OSPL_EVENT_Clear

// Interrupt RGPVG INT1 (130). It is sometimes signaled before or after "NCGSYS_WaitState".

NCGVG_RGPVG_ISR

A function specified with "NCGVG_Attach_ISR".

NCGSYS_SetState( 0x02, NCGSYS_STATE_WAIT_OR | NCGSYS_STATE_CALL_INTERRUPT )

R_OSPL_EVENT_Set

// If the interrupt was not signaled, there is a possibility that the interrupt

// was masked or work buffer is not set in uncached area or the address is

// not changed to uncached area by "R_OSPL_ToUncachedAddress".

NCGSYS_WaitState( 0x02, NCGSYS_STATE_WAIT_OR )

R_OSPL_EVENT_Wait // Waiting "R_OSPL_EVENT_Set" called from interrupt

NCGSYS_SetState( ~0x02, NCGSYS_STATE_SET_AND )

R_OSPL_EVENT_Clear

NCGSYS_WaitState( 0x02, NCGSYS_STATE_WAIT_OR )

R_OSPL_EVENT_Wait // Waiting "R_OSPL_EVENT_Set" called from interrupt

// Interrupt RGPVG INT1 (130). It is sometimes signaled before or after "NCGSYS_WaitState".

NCGVG_RGPVG_ISR

A function specified with "NCGVG_Attach_ISR".

NCGSYS_SetState( 0x02, NCGSYS_STATE_WAIT_OR | NCGSYS_STATE_CALL_INTERRUPT )

R_OSPL_EVENT_Set

NCGSYS_SetStateEventValue

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 100 of 127

RZ/A1H RGA

6.11.3 Identifying Image Format

The first few bytes of the graphics_image_t-type structure to be specified for the argument of the

R_GRAPHICS_DrawImage (section 6.9.1.29), R_GRAPHICS_DrawImageResized (section 6.9.1.30), or

R_GRAPHICS_DrawImageChild (section 6.9.1.31) function are used to identify image formats. Therefore, JPEG file data or PNG file data can be specified directly for the graphics_image_t-type argument of the

R_GRAPHICS_DrawImage function.

Image Format

JPEG

PNG

Raw

First Few Bytes

0xFF 0xD8

0x89 0x50 0x4E 0x47

Others

Note

SOI segment

PNG header graphics_image_t-type structure + Raw data

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 101 of 127

RZ/A1H RGA

6.11.4 Changing RGAH and RGAS

RZ/A1H,M can use RGA using hardware acceleration version (RGAH) and RGA using no hardware acceleration version (RGAS). But RZ/A1L can use RGA using no hardware acceleration version (RGAS) only.

Initialize example and Video Display Controller 5 (VDC5) driver are not same for RZ/A1H as for RZ/A1L. Get the example for another target chip.

The way of changing RGAH and RGAS in RGA is the following steps.

1. Change enabled macro "IS_RGAH_ARM_VERSION" or "IS_RGAS_ARM_VERSION" in

"RGA_Sample\armcc\common\src\drivers\RGA\inc\RGA_Config.h".

2. In using RGAH, link RGA (ForRGAH), RGAH and PNG. jpeg is not linked. In using RGAS, link RGA

(ForRGAS), jpeg and PNG. RGAH is not linked. See Table 2-2 Library files.

3. Convert the alignment of 1 line of drawing raw image to the specification of RGAH or RGAS. See

"RGA_SOURCE_IMAGE_STRIDE_ALIGNMENT" constant value. In RGA example, run the batch file

*RGAH.bat or *RGAS.bat in the following folder.

RGA_Sample\armcc\common\src\samples\RGA\Sample_Common\Images

BinaryImageMakeRGAH.bat

BinaryImageMakeRGAS.bat

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 102 of 127

RZ/A1H RGA

6.11.5 Flush Mode

In auto-flush mode, drawn content can be displayed only by calling R_GRAPHICS_Finish or

R_WINDOW_SURFACES_SwapBuffers. In fast manual flush mode, however, cache flush operation is required.

Auto-flush mode is enabled by default. In this mode, you need not pay attention to the description of this section.

To enable fast manual flush mode, set graphics_config_t::is_fast_manual_flush to "true". Since unnecessary flush operation is not performed in the graphics library in this mode, the processing may be performed quickly.

To perform the flush operation efficiently, enclose the processing that accesses the frame buffer shared with the

drawing hardware or image data by R_GRAPHICS_BeginSoftwareRendering (section 6.9.1.48) to

R_GRAPPHICS_EndSoftwareRendering (section 6.9.1.49).

When the application defined buffer was drawn by software, call "R_GRAPHICS_Finish" in similar to drawing by

RGA.

R_GRAPHICS_BeginSoftwareRendering

Access the frame buffer shared with the drawing hardware or image data

R_GRAPHICS_EndSoftwareRendering

(At the end of function)

R_GRAPHICS_EndRenderingInFin

R_GRAPHICS_Finish or R_WINDOW_SURFACES_SwapBuffers

The following describes specific examples of processing that must be enclosed.

 When directly reading or writing the frame buffer from outside the graphics library. However, enclosing this processing is not necessary when accessing the frame buffer from a non-cache area.

 When reading or writing image data specified for R_GRAPHICS_DrawImage or image data obtained from

R_GRAPHICS_IMAGE_GetAddress. However, enclosing this processing is not necessary when reading or writing image data provided in the ROM.

 When this read or write operation is performed in the API that reads and writes files

When these functions are called, frame buffer data or image data is flushed from the CPU cache to the physical memory or hardware drawing is completed as needed.

If you do not want to use these functions, call R_GRAPHICS_Finish before accessing the frame buffer shared with the drawing hardware or image data. After the frame buffer or the image data is accessed, write back the CPU cache.

Sample

e= R_GRAPHICS_BeginSoftwareRendering( graphics ); IF(e){goto fin;}

/* Access to frame buffer directly */

IF ( error ) { e=ERROR_CODE; goto fin; }

e= R_GRAPHICS_EndSoftwareRendering( graphics ); IF(e){goto fin;} fin:

e= R_GRAPHICS_EndRenderingInFin( graphics, e );

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 103 of 127

RZ/A1H RGA

6.11.6 Using SDRAM

For RZ/A1H, SDRAM is out of PL310 which has L2 cache. If the target frame buffer or the source image is in

SDRAM, it is necessary to set and operate related with PL310.

6.11.6.1

Setting of enabling L2 cache

If "PL310_Enable" function was not called, write like the following code which calls "PL310_Enable" function for enabling L2 cache. Example of initialize (R01AN1864JJ0101) enables L2 cache at initializing.

#include "core_ca9_io.h" /* for pl310.h */

#include "pl310.h" /* L2 cache */

/* If present, you may also need to Invalidate and Enable L2 cache here

*/

l2_id = PL310_GetID();

if (l2_id)

{

PL310_InvAllByWay();

PL310_Enable();

}

6.11.6.2

Setting of NS bit in MMU of CPU

Set 1 at NS bit in MMU (TTB) of SDRAM area, if NS bit was set 0. Example of initialize (R01AN1864JJ0101) enables it at initializing.

6.11.6.3

Setting of the cache attribute output from bus masters (AWCACHE, ARCACHE)

If memory map was changed, modify define of "R_OSPL_AXI_Get2ndCacheAttribute" function and

"R_OSPL_MEMORY_GetLevelOfFlush" function in OSPL porting layer. RGA changes the cache attribute setting

(AWCACHE, ARCACHE in the register of RZ/A1H) depend on whether bus masters Renesas Graphics Processor for

OpenVG™ (R-GPVG2) and JPEG Codec Unit (JCU)) access On-Chip RAM or SDRAM. RGA gets the value of the cache attribute from above porting functions.

6.11.6.4

Changing calling functions for fast manual flush mode

In RZ/A1H, if a frame buffer or a source image was in SDRAM and all bus master in RZ/A1H access to SDRAM using L2 cache, it does not have to flush L2 cache. It is recommended this setting by set to MMU and define

"R_OSPL_AXI_Get2ndCacheAttribute" function and "R_OSPL_MEMORY_GetLevelOfFlush" function. If MMU

setting was needed to flush L2 cache and fast manual flush mode (6.11.5) was enabled, flush L2 cache by changing the

code calling "R_GRAPHICS_BeginSoftwareRendering2" function or "R_GRAPHICS_BeginSoftwareRenderingA" function instead of "R_GRAPHICS_BeginSoftwareRendering" function. It is not necessary to flush L2 cache on example of initialize (R01AN1864JJ0101).

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 104 of 127

RZ/A1H RGA

6.11.7 Layer structure of sample screen controller

The following table describes the correspondence relation between the layer structure of window_surfaces_t (6.6.5.5) and planes of Video Display Controller 5 (VDC5).

Table 6-6 Layer structure of sample screen controller for RZ/A1H, M id of layer_attributes_t (6.6.5.7) The plane name of VDC5

(Not used)

1

0

-1 (Background color or video input)

Graphics (3)

Graphics (2)

If " window_surfaces_config_t::pixel_format =

PIXEL_FORMAT_YCbCr422", the pixel format becomes

RGB565.

Graphics (1)

Graphics (0)

Background layer

Table 6-7 Layer structure of sample screen controller for RZ/A1L

(pixel_format

≠PIXEL_FORMAT_YCbCr422) id of layer_attributes_t (6.6.5.7)

1

0

-1 (Background color)

Graphics (3)

Graphics (2)

Graphics (0)

Table 6-8 Layer structure of sample screen controller for RZ/A1L

(pixel_format=PIXEL_FORMAT_YCbCr422)

The plane name of VDC5 id of layer_attributes_t (6.6.5.7)

(Not used)

1

0

The plane name of VDC5

Graphics (3)

Graphics (2) RG565.

Graphics (0) YCbCr422

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 105 of 127

RZ/A1H RGA

6.11.8 Flagged Structure Parameters

Flags member variables in the structure are used as a bit field. When the bit is 1, the corresponding member variable is enabled in this coding pattern. When the bit is 0, it is treated that the default value is set or not change for the member variable as omitted. Updating the version allows binary compatibility even when structure members increase.

FuncA_ConfigClass config; config.Flags = F_FuncA_Param1 | F_FuncA_Param2; config.Param1 = 10; config.Param2 = 2;

FuncA( &config );

The default value is config.Param3 because "Flags |= F_FuncA_Param3" does not exist.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 106 of 127

RZ/A1H RGA

6.11.9 Defaultable Flags

Defaultable flags are the type that can select three options: setting to ON, setting to OFF, and no setting (unchanged) for each array element when setting logic-type array variables. Symbols for setting to ON and setting to OFF are defined. When these symbols are not used, settings remain unchanged.

The variable type that stores defaultable flags is a 32-bit integer type. These flags are defined as a flag that sets the lower 16 bits to ON and a flag that sets the upper 16 bits to OFF. Components of the upper 16 bits are the same as those of the lower 16 bits.

Flag to be set to OFF

(upper 16 bits)

Flag to be set to ON

(lower 16 bits) typedef BitField DefaultableFlagsType; /* Flags of DefaultableFlagType */ enum DefaultableFlagType {

/* Set to "ON" */

ENABLE_SAMPLE_FLAG_A = 0x0001,

ENABLE_SAMPLE_FLAG_B = 0x0002,

ENABLE_SAMPLE_FLAG_C = 0x0004,

/* Set to "OFF" */

DISABLE_SAMPLE_FLAG_A = ENABLE_SAMPLE_FLAG_A << 16,

DISABLE_SAMPLE_FLAG_B = ENABLE_SAMPLE_FLAG_B << 16,

DISABLE_SAMPLE_FLAG_C = ENABLE_SAMPLE_FLAG_C << 16,

};

When the argument of the function to set flags (SampleClass_setDefaultableFlags below) is a defaultable flag, only flags to be set to "ON" or "OFF" are connected by "|". Settings remain unchanged for flags that are not set to "ON" or

"OFF." For initialization functions, default values are used. errnum_t main()

{

DefaultableFlagsType flags;

e= SampleClass_setDefaultableFlags( object,

ENABLE_SAMPLE_FLAG_A | DISABLE_SAMPLE_FLAG_B ); IF(e)goto fin;

/* SAMPLE_FLAG_C is not modified. */

e= SampleClass_getDefaultableFlags( object, &flags ); IF(e)goto fin;

if ( flags & ENABLE_SAMPLE_FLAG_A ) { ... }

if ( flags & DISABLE_SAMPLE_FLAG_B ) { ... }

if ( flags & ENABLE_SAMPLE_FLAG_C ) { ... }

} errnum_t SampleClass_setDefaultableFlags( SampleClass* self,

DefaultableFlagsType Flags )

{

self->Flags = self->Flags | ( Flags & 0x0000FFFF );

self->Flags = self->Flags & ~( Flags >> 16 );

} errnum_t SampleClass_getDefaultableFlags( SampleClass* self,

DefaultableFlagsType* out_Flags )

{

BitField flags = ( self->Flags & 0x0000FFFF );

*out_Flags = flags | ~( flags << 16 );

}

When the argument of the function to acquire the current flag (SampleClass_getDefaultableFlags above) is a defaultable flag, the upper 16 bits of an acquirable value are an inverted value of the lower 16 bits. For this reason, both symbols for setting to ON and symbols for setting to OFF can be used for decision statements. Since the internal variable that retains the current flag is the internal specification, there is no problem with specifications in which upper 16 bits are disabled.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 107 of 127

RZ/A1H

Inverted value of lower 16 bits

(upper 16 bits)

Current flag

(lower 16 bits)

RGA

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 108 of 127

RZ/A1H RGA

6.11.10 Function to Initialize Internal Variables with Constants (*_initConst Function)

In the C language class that includes the finalizing function (*_finalize function), the *_initConst function must be called first (before calling the *_initialize function). This is to prevent any exception from occurring even if the

*_finalize function is called when an error occurs from another object before initialization. Before calling the function that may cause an error first among functions, call the *_initConst function first at a time for all objects that only exist in functions (i.e. created and deleted in functions).

Even if the *_initConst function is called, many functions (methods) are not made available until the *_initialize function is called.

In the case of the C++ language API of this library, the *_initConst function responds to the constructor. The

*_initialize function responds to object creation functions (such as R_RGA_New_Canvas2D_ContextClass function).

The *_finalize function responds to the destroy member function. For example, when an error occurs before an object creation function is called after the constructor was called by the variable declaration, no exception occurs even when the destroy member function is called.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 109 of 127

RZ/A1H RGA

6.11.11 Finalize (*_Finalize Function)

The function that last name of is "_Finalize" does the operation of finalize. Finalize is close operation of file, the operation in the destructor of C++ language, the operation called from finally block of Java language and others.

Outline

Declaration

Argument

Return value

Does finalize operation. errnum_t *_Finalize( type* self, errnum_t e ); type* self errnum_t e

Target object to finalize

Error code raised from before.

There is different whether or not to do the rollback operation whether or not error was raised depending on a function's specification.

Error code or e 0 = successful and e = 0

If argument e is not 0, returns the value of e.

If argument e is 0, returns an error code of this finalize operation.

Pass error code raised from before to argument "e" like the following code. errnum_t Func()

{

errnum_t e;

CLASS_InitConst( &sample );

e= CLASS_Initialize( &sample ); IF(e){goto fin;}

e=0; fin:

e= CLASS_Finalize( &sample, e );

return e;

}

If the finalize operation was success, the target object becomes Uninitialized state.

If error was raised in the finalize operation, the function returns error code not 0 and may become the following state.

State after finalizing

Uninitialized

Reset

Description and expected behavior

The target object can be deleted.

In this case, all internal objects are finalized, even if errors were raised internally and the program can be resumed from error state.

Uninitialized internal objects are deleted.

Internal objects which returned to a previous state are not deleted until resource management object deletes it or the system was reset. Otherwise, the object may keep lock state. A callback function related internal object which returned to a previous state may be called.

Notify the error information to the end user or make logs after finalize function.

Calls "R_OSPL_RaiseUnrecoverable" function from the finalize function.

"R_OSPL_RaiseUnrecoverable" function resets the system or exits the process.

In this case, finalize function is not returned.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 110 of 127

RZ/A1H

(State before finalizing)

RGA

The object which returned to previous state can not be deleted.

Call finalize operation which usually returns to previous state from out of finally block (fin: in above code) and retry the finalize operation.

If the finalize operation is called from finally block, the object will not be deleted. Adjust anything before calling the finalize function.

An object which integrates not deleted object sometimes becomes to

Uninitialized state. In this case, see the description of "Uninitialized" in this table.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 111 of 127

RZ/A1H RGA

6.11.12 Compatibility between C++ Language and JavaScript Object

JavaScript codes using the Canvas 2D object can be operated as they are by using the C++ language class provided by this library. The following shows codes using variables of the class provided by this library, which are the same description of codes using variables that reference the JavaScript object.

 When assignment operation is performed, one object can be accessed from two variables. Therefore, an operation is performed as if the value of the pointer that indicates the C++ language object is copied. object_1_reference = object_1;

 When accessing a member, describe a period instead of the "->" operator (hyphen + inequality sign). object_1.attr = 1;

 Since the destructor is not automatically activated as in the case of JavaScript, explicitly call the destroy member function to delete objects. This corresponds delete operator of C++ language. object_1.destroy();

The compatibility between the C++ language provided by this library and JavaScript applies only to codes for objects.

In the C++ language, not all JavaScript codes operate as they are (such as required variable declaration).

When an error occurs in C++ API, the return value of "R_OSPL_GetErrNum" function is not 0. No exception occurs.

Call the "R_OSPL_CLEAR_ERROR" function when returning from the error. Even if a method of an error object is called, no internal processing is performed. However, "save" and "restore" methods do operations in the error state.

Sample code of error check code: if ( R_OSPL_GetErrNum() != 0 ) { ... }

Sample code of error clear code:

R_OSPL_CLEAR_ERROR();

If an error was raised in the function creating an object, "R_OSPL_GetErrNum" function returns not 0 and undefined object is returned from the creating function. Whether the return value is the undefined object or not can be determined by == operator of the object handle variable.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 112 of 127

RZ/A1H RGA

7. Tools

7.1 Image Format Conversion by ImagePackager

The ImagePackager packs multiple image files into a single binary file (for the target board) or a source file (for the target board and PC). When image files are packed, they can also be converted to the raw format of any pixel formats.

The integrated file is used as a source of binary data or C language data. In an XML file, specify image files to be packed. File names and extension name are not ignored case-insensitive comparison.

ImagePackager is one of commands in "RGA_Tools.vbs". It calls vbs files and exe files internally.

7.1.1 Operational Procedure

1. Make .image.xml file ().

2. Double click RGA_Tools.vbs file at armcc\common\src\samples\RGA, select "ImagePackager" command in opened window, specify .image.xml file. This makes header file and binary file or C language data source.

---------------------------------------------------------------------------

RGA Tools - Copyright(c) 2012-2015 Renesas Electronics Corporation

1. Convert image format [RunImagePackager]

2. Search error information [SearchErrorInformation]

Number or command >1

---------------------------------------------------------------------------

((( [RunImagePackager_sth] )))

Renesas Image Packager - Copyright(c) 2012-2015 Renesas Electronics

Corporation

Make one binary file from many image files and other files.

Enter only : Open sample folder.

Setting file(ImagePackagerConfig.xml) >

3. Write #include directive with a generated header file and pass a symbol of image defined in the header file to

"R_GRAPHICS_DrawImage" function or other functions.

4. If binary file was generated, write it at the address written in .image.xml file and start drawing operations. The address is written at /ImagePackager/OutputBinary/OutputHeader/@address in .image.xml file or generated header file.

ImagePackager can be started by the following command in the command prompt.

>cd armcc\common\src\samples\RGA\Sample_Common\Images

>cscript //nologo ..\..\RGA_Tools.vbs RunImagePackager

BinaryImageConfig.image.xml

7.1.2 List of files

File

RGA_Tools.vbs

*.image.xml

(*.bmp, *.jpg, *.png)

(Output: binary file)

(Output: source file)

Description

Script file which contains ImagePackager

Setting file of ImagePackager

Input image file

A file which contains images and files to download to the target board

A source file which contains image data and file data to put in the program

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 113 of 127

RZ/A1H

7.1.3 Sample

BinaryImageConfig.image.xml

<?xml version="1.0" encoding="UTF-8"?>

<ImagePackager>

<OutputBinary path="BinaryImage_RZ_A1H.c" language="C" symbol="g_RGA_Sample_BinaryImage" source_template="${ImagePackagerLib}\SourceTemplate.xml#default" super_class="${ImagePackagerLib}\SuperClass.xml#default">

<OutputHeader path="BinaryImage_RZ_A1H.h" include_define="BINARYIMAGE_RZ_A1H_H"/>

</OutputBinary>

<InputFiles>

<File path="BinaryHeader.txt" type="char[]" symbol="g_BinaryHeader"/>

<Image path="picture.bmp" type="graphics_image_t*" symbol="g_Picture_bmp" output_format="RGB565"/>

<Image path="smile32.bmp" type="graphics_image_t*" symbol="g_Smile_bmp" output_format="ARGB4444"/>

<File path="JPEG.jpg" type="graphics_image_t*" symbol="g_JPEG_jpg"/>

</InputFiles>

</ImagePackager>

Refer 7.1.8 regarding the basic forms of writing XML and XPath.

The folder that contains the XML file is the reference of relative paths.

A folder path or wild card can be specified for Image/@path.

Providing a fixed-value header at the top allows checking whether binary data is contained or not.

7.1.4 Types of Output Binary File (Language)

Binary format (external reference symbol of C language) + C language header

Binary format or S-record format (direct addressing such as in flush) + C language header

C language source + C language header

Specified for /ImagePackager/OutputBinary/@language and /ImagePackager/OutputHeader/@address

7.1.5 File Formats in the Output Binary File

RGA

Format Description

Offset table The array of 4byte integer type in the first of the binary file that indicates the offset value to image data and binary data.

Raw-format image Specified for /ImagePackager/InputFiles/Image/@output_format

"ARGB8888", "XRGB8888"(X component is 0x00), "RGB565", "ARGB1555",

"ARGB4444", "YUV422", "CLUT8","CLUT4","CLUT1","A8","A4","A1"

See following "The format of Raw-format image"

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 114 of 127

RZ/A1H

Binary format When expanding JPEG data on the target board, the file is stored as it is.

Specified for /ImagePackager/InputFiles/File

The format of Raw-format image:

RGA

Offset

0x00

0x04

0x08

0x0C

0x0E

0x10

0x11

*

Size

4byte

4byte

4byte

2byte

2byte

1byte

7byte

Description

The bit flags described the type of image

[bit0] 1fixed

[bit1] (reserved)

[bit2] 1=Premultiplied alpha, 0=not Premultiplied alpha

[bit3-bit15] (reserved) [bit16-bit31] 0

This endian is depended on the setting of "@endian".

The offset value to the image data from the first of Raw-format image.

This endian is depended on the setting of "@endian".

(reserved)

The image width (pixels)

This endian is depended on the setting of "@endian".

The image height (pixels)

This endian is depended on the setting of "@endian".

The pixel format

0=RGB565, 2=ARGB1555, 3=ARGB4444, 6=CLUT8, 7=CLUT4, 8=CLUT1,

9=XRGB8888, 10=ARGB8888, 11=YUV422, 20=A8, 21=A4, 22=A1

(reserved)

Image data

If the pixel format was RGB components, this endian is depended on the setting of

"@endian". If the pixel format was YUV components, this endian is not depended on.

The offset value of this image data is depended on the setting of

"@raw_image_alignment".

The byte count par one line (stride) is depended on the setting of

"@raw_stride_alignment" and so on.

If this image data had CLUT (Color Look Up Table, Palette), there are image data after CLUT. The elements of CLUT are ARGB8888 format depended on the endian by "@endian" setting. A value is fixed to 0xFF. The count of elements are 256

(CLUT8), 16 (CLUT4) or 2(CLUT1).

Limitation for RGA:

It is necessary that start address and byte count as 1 line of image data drawing by

RGA is aligned to following values.

Alignment of start address for the image (byte)

Alignment of byte count for the image (byte)

RGB

32

YCbCr

4

CLUT

1 RGA hardware rendering

RGA software rendering

RGB

32

4

YCbCr

4

4

7.1.6 Input Formats

BMP format: 32 bits or 24 bits (256, 16, or 2 colors for CLUT)

CLUT

1

1 4 4 1

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 115 of 127

RZ/A1H

PNG format: Supports data with alpha

JPEG format

See the description on @path of "/ImagePackager/InputFiles/Image".

RGA

7.1.7 Parameters That Can Be Described in BinaryImageConfig.image.xml

/ImagePackager/OutputBinary: One or more parameters (Two or more parameters are used to output both "Binary"

@language and "C" @language.)

@path

@symbol

@raw_image_alignment

_symbol

Path of the binary file output destination (Essential)

C language's external reference symbol (global variable name) that supports all binary files (Essential)

When outputting multiple binary files, do not change this parameter in each binary file. When /ImagePackager/OutputHeader/@address is set, this parameter is a macro name having the address value.

@language

@section

Programming language of output binary data (Optional)

"Binary" and "C", "SRec"(S-record) can be set. "Binary" is set by default.

Specified section is embedded in the output source.

Example: section = "BinaryImage" --- BinaryImage section is created.

This is filled at ${Section} in /ImagePackager/SourceTemplate.

@endian Endian (Optional)

"LittleEndian" or "BigEndian" can be selected. @endian pointed from

@super_class is set by default.

@raw_image_alignment Alignment (bytes) of the starting address of raw-format image data

(Optional)

Only 2 n

can be set. @raw_image_alignment pointed from

@super_class is set by default. When outputting multiple binary files, do not change this parameter in each binary file.

The raw-format header is not aligned by this setting.

The #define symbol name containing the @raw_image_alignment value (Optional)

The #define symbol name is output to the header file to be generated. Compile the program using binary files by using the header.

Example: raw_image_alignment_symbol=

"GRAPHICS_RAW_IMAGE_ALIGNMENT"

The code filled in the header file:

#define RAW_IMAGE_ALIGNMENT 32

The #define sentence of the symbol name is not output by default.

When outputting multiple binary files, do not change this parameter in each binary file.

@raw_stride_alignment Alignment of the number of bytes up to the line immediately below in an image to be output (Optional). The number of bytes is carried to a multiple of the value specified for (value).

@raw_stride_alignment_

4

@raw_stride_alignment pointed from @super_class is set by default.

Example: raw_stride_alignment = 32

Pixel format of output image in which the number of bytes up to the line immediately below is 4. Two or more CSV formats can be specified. (Optional)

This setting takes precedence over the @raw_stride_alignment setting.

@raw_stride_alignment_4 pointed from @super_class is set by default.

Example: raw_stride_alignment_4 = YUV422

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 116 of 127

RZ/A1H RGA

@table_format

@source_template

@super_class

The format of the table. (Optional)

 "Offset": Fills not only the body but also the offset to the body in the binary file, because re-compile does not have to be done, even if the size of the image or the file was changed.

 "Embed": Fills images and files normally.

Default value is the following value.

 If @language="Binary", @table_format="Offset"

 If @language="C", @table_format="Embed"

ID of the template of the output source file in the case of

@language="C". (Optional)

Set the value of "/ImagePackager/SourceTemplate/@id".

It is able to set the reference to the other XML file.

${ImagePackagerLib} is replaced to the folder path containing

ImagePackagerLib.vbs

Example: source_template="${ImagePackagerLib}\SourceTempla te.xml#default"

ID of the super class attached to the binary file. (Optional)

Set the value of "/ImagePackager/SuperClass/@id".

It is able to set the reference to the other XML file.

${ImagePackagerLib} is replaced to the folder path containing

ImagePackagerLib.vbs

Example: super_class="${ImagePackagerLib}\SuperClass.xml#d efault"

/ImagePackager/OutputBinary/OutputHeader: One or more elements

/ImagePackager/OutputHeader: Zero or one element

@path

@include_define

@address

Path of the header file output destination (Essential)

The #define symbol name to prevent the header file from being included twice (Optional)

Default name: "__BINARY_IMAGE__"

Memory address to allocate binary files (Optional)

Specify the memory address in the 0x00000000 format. This parameter is used when allocating addresses directly in the flash memory in addition to the program image to be linked. Since the set address is output to the header file to be created, compile the program that references binary data by using the header. If this parameter is omitted, the C language's external reference symbol

(global variable name) specified for

/ImagePackager/OutputBinary/@symbol is used.

/ImagePackager/InputFiles: Only one element

@base_folder A path to be the reference of

/ImagePackager/InputFiles/Image/@path (Optional)

The reference of relative paths is the folder that contains the

BinaryImageConfig.image.xml file. Default path: "."

/ImagePackager/InputFiles/Image: Zero, one or more elements

The data converted to Raw-format are embedded in the binary file.

@path Path of image files to be input (Essential)

As the reference of relative paths, the path of the

/ImagePackager/InputFiles/@base_folder folder and the sub-folder

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 117 of 127

RZ/A1H

@type

@symbol

@output_format

RGA are also input when a wild card is specified. In the case of "png" or

"jpg" extension, incompressibly expanded files are output to binary files. When expanding a file on the target board, specify JPEG file for /ImagePackager/InputFiles/File. For images with no alpha channel or images whose all alpha values are 0xFF, information that shows that alpha blending is not required is embedded in the output data. This information may allow fast drawing.

Type of symbols described in the header file (Essential)

@symbol type. Specify graphics_image_t*.

A symbol described in the header file (Essential)

The #define symbol in the global scope. @type type

When "${...}" is used, the symbol is replaced with a file name.

Example: g_${BaseName}_${Extension}_${Format} -

> g_Sample_jpg_ARGB8888

Format of files to be output (Essential)

If input file was 24bit/32bit Window bitmap file, JPEG file, PNG file

(with alpha/without alpha), values "ARGB8888", "XRGB8888"(X component is 0x00), "RGB565", "ARGB1555", "ARGB4444",

"YUV422", "A8", "A4" and "A1" can be specified.

When "CLUT8" is specified, input a 256-color Windows bitmap file.

When "CLUT4" is specified, input a 16-color Windows bitmap file.

When "CLUT1" is specified, input a monochrome Windows bitmap file.

The following table describes alpha component of output image. If input image was 256, 16 colors or monochrome Windows bitmap file, see the input color as CLUT referenced color at the following table. Notice: PNG format created by Paint Brush for Windows 7 always has alpha component.

Input

Image

Output

Image

Alpha component of output

With A Every format A component of the input image

Without A ARGB 0xFF

A component only

Y component (luminance) converted input image from RGB to YCbCr

@premultiplied_alpha

Two or more values can be specified in the CSV format. In that case, however, include "${Format}" in @symbol. "${Format}" will be replaced to the name of pixel format.

This parameter shows whether to multiply RGB components by the alpha component. (Optional)

 "no": Not multiplied (default)

 "yes": RGB components are converted to multiplied values before they are output. This choice is available only when the alpha component is not contained in the drawing destination.

 "already_yes": The input image has already been multiplied. This choice is available only when the alpha component is not contained in the drawing destination.

/ImagePackager/InputFiles/File: Zero, one or more elements

Not converted data are embedded in the binary file.

@path Path of files to be input (Essential)

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 118 of 127

RZ/A1H RGA

@type

@symbol

@alignment

Reference of relative paths:

/ImagePackager/InputFiles/@base_folder

Files in sub folder are input, if the value had wildcard.

Type of symbols described in the header file (Optional)

@symbol type. When the file content is an array, attach [] to the end of the type name. uint8_t[] is set by default.

A symbol described in the header file (Essential)

The #define symbol in the global scope. uint8_t[] type.

The address alignment of the file. (Optional)

@alignment pointed from

/ImagePackager/OutputBinary/@super_class is set by default.

/ImagePackager/InputFiles/Var: Zero, one or more elements

The values written in XML file are embedded in the binary file.

@type

@symbol

@value

Type of the symbol written in the header file. (Essential) int32_t, uint32_t, int16_t, uint16_t, int8_t, uint8_t can be specified.

The symbol name written in the header file. (Essential)

This name is a name of global variable initialized the value embedded in the binary file.

The value embedded in the binary file. (Essential)

Integer or the following special format can be specified.

 Example of integer: "10", "-10", "0xFF"

 Special format "(new Image('file_path')).width" : Width of image named by file_path

 Special format "(new Image('file_path')).height" : Height of image named by file_path

"file_path" is the path of image file.

/ImagePackager/SourceTemplate/ : Zero, one or more elements

@id

Source/text()

SourceWithSection/text()

Header/text()

ID of SourceTemplate tag. (Essential)

This value is referred from

/ImagePackager/OutputBinary/@source_template.

Template of source file. (Essential)

The following tags can be filled in the template.

 ${Section} : Section name. The value of

/ImagePackager/OutputBinary/@section

 ${Symbol} : Variable name. The value of

/ImagePackager/OutputBinary/@symbol

 ${Size} : Size of the binary file (bytes)

 ${BinaryData} : Binary data

Template of source file, if a section was specified. (Optional)

If SourceWithSection tag was not specified, the content specified by Source tag is used, even if a section was specified.

Template of header file. (Essential)

The following tags can be filled in the template.

 ${include_define} : Macro name avoiding double include. The value of

/ImagePackager/OutputBinary/OutputHeader/@include_define

 ${DeclareBinaryImageSymbol} : Declares of symbols in the binary data. The content of DeclareVariable/text() or

DeclareAddress/text() and #define by

@raw_image_alignment_symbol

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 119 of 127

RZ/A1H RGA

 ${Variables} : #define list as variables

 ${Section} : Section name. The value of

/ImagePackager/OutputBinary/@section

 ${Symbol} : Variable name. The value of

/ImagePackager/OutputBinary/@symbol

 ${Size} : Size of the binary file (bytes)

 ${StartAddress} : Start address of the binary data

 ${LastAddress} : Last address of the binary data

HeaderWithSection/text() Template of header file, if a section was specified. (Optional)

If HeaderWithSection tag was not specified, the content specified by Header tag is used, even if a section was specified.

DeclareVariable/text() If @language="C", template filled at

${DeclareBinaryImageSymbol}.

DeclareAddress/text()

The following tags can be filled in the template.

 ${Section} : Section name. The value of

/ImagePackager/OutputBinary/@section

 ${Symbol} : Variable name. The value of

/ImagePackager/OutputBinary/@symbol

 ${Size} : Size of the binary file (bytes)

If @language="Binary", template filled at

${DeclareBinaryImageSymbol}.

The following tags can be filled in the template.

 ${Section} : Section name. The value of

/ImagePackager/OutputBinary/@section

 ${Symbol} : Variable name. The value of

/ImagePackager/OutputBinary/@symbol

 ${StartAddress} : Start address of the binary data

 ${LastAddress} : Last address of the binary data

/ImagePackager/SuperClass: Zero, one or more elements

@id ID of SuperClass tag. (Essential)

This value is referred from

/ImagePackager/OutputBinary/@super_class.

/ImagePackager/SuperClass/OutputBinary : Zero or one

@endian

@raw_image_alignment

@raw_stride_alignment

@raw_stride_alignment_4

Default value of /ImagePackager/OutputBinary/@endian. This default value is "LittleEndian".

Default value of

/ImagePackager/OutputBinary/@raw_image_alignment. This default value is 4.

Default value of

/ImagePackager/OutputBinary/@raw_stride_alignment. This default value is 1.

Default value of

/ImagePackager/OutputBinary/@raw_stride_alignment_4. This default value is "".

/ImagePackager/SuperClass/InputFiles/File : Zero, one or more elements

@path

@alignment

Path of target file attached with SuperClass. Wildcard can be specified. (Essential)

Example: path="*.jpg"

Default value of /ImagePackager/InputFiles/File/@alignment.

This default value is 4.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 120 of 127

RZ/A1H RGA

7.1.8 Basic forms of writing XML

This section describes basic forms of writing XML, XPath and # fragment that is data format specified with tools.

7.1.8.1

XML

XML file is one of text file. You can edit it by text editor. This section describes basic forms of writing XML only.

XML declaration is written at the head of XML file like the following text. Character code set is generally encoding="UTF-8", if XML declaration was omitted. The following text is an example.

<?xml version="1.0" encoding="ISO-8859-1"?>

A markup construct that begins with < and ends with >. Start-tags must be paired with end-tags. End-tag is appended with slash at head of start-tag's name. Target program ignores not supported tags and does not warn spelling mistakes.

Difference between upper case and lower case is treated as different name.

<Root>

</Root>

XML tags must have tree structure. Also there must be one root end tag. Data passing to target program are not changed, even if return character was replaced space or tab character or deleted between tags.

<Root>

<LeafA></LeafA>

<LeafB></LeafB>

</Root>

Start-tag and end-tag can be replaced to one tag that has a name appended slash at the tail of tag name. Data passing to target program are not changed, even if they were replaced like it.

<Root>

<LeafA/>

<LeafB/>

</Root>

Text can be written between start-tag and end-tag. The text is specified value depending on tag specification defined by target program. It is depended on tag specification whether different text between upper case and lower case is treated as same data or not same data.

<Root>

<LeafA>ABC</LeafA>

<LeafB>DEF</LeafB>

</Root>

Specified value can be written as attribute's value in start-tag. The attribute's value (right of equal) must be enclosed between " " or ' '. It is no different between " " and ' '. Specified value can not be written in end-tag. Target program ignores not supported attributes and does not warn spelling mistakes. Difference between upper case and lower case is treated as different attribute's name. It is depended on target program whether different attribute's value between upper case and lower case is treated as same data or not same data.

<Root>

<Leaf attribute="1" other="no"/>

</Root>

Same name tags can be written depended on tag's specification. 2nd tag and more tags are ignored, if specification of the tag can be allowed one tag only. It is depended on target program whether only one tag was allowed or not.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 121 of 127

RZ/A1H RGA

<Root>

<Leaf attribute="1" other="no"/>

<Leaf attribute="2" other="no"/>

<Leaf attribute="3" other="yes"/>

</Root>

7.1.8.2

XPath

XPath is one of address that can point to a part of XML text. XPath is written by the forms like file path. This section describes basic forms only.

When there was XML text like the following text:

<Root>

<LeafA>ABC</LeafA>

<LeafB attribute="1" other="no"/>

</Root>

The following text is an XPath that points to the position at the text value "ABC". Between XML nodes are split by slash character. "text()" points a text between tags. It is necessary to write "()" at the tail of "text". Difference between upper case and lower case is treated as different name. The following text is an example.

/Root/LeafA/text()

The following text is an XPath that points to the position at the attribute's value "1". It is necessary to write slash and

"@" at the head of attribute's name.

/Root/LeafA/@attribute

It is step path that the head of XPath is not slash.

LeafB/@attribute

@attribute

7.1.8.3

# fragment

# and ID (fragment) can be written after specified file name or path depended on the specification of target program.

The following text is an example.

Folder\File.xml#Leaf1

Fragment is compared with id attributes from all XML tags in the specified file. Difference between upper case and lower case is treated as different name. Path attached fragment points an XML tag that has matched id attribute's value.

For example, "Folder\File.xml#Leaf1" points following "LeafA" tag in "Folder\File.xml" file.

<Root>

<LeafA id="Leaf1">ABC</LeafA>

<LeafB id="Leaf2">ABC</LeafB>

</Root>

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 122 of 127

RZ/A1H RGA

7.2 Searching for Error Information by SearchErrorInformation

When an error occurs in the debug-version library, the R_DEBUG_BREAK_IF_ERROR function shows the location raising an error. For RZ/A1H, it output the following message to serial output. If target board did not have serial port, there is the way of getting error information by using LED and so on. (See following sentence). printf output:

<ERROR error_ID="1" file="C:\folder\Library.c(2095)"/>

If you want to change to debug configuration, change the linking library from

"lib\RGA\For<SubModule>\Release\RGA.a" to "lib\RGA\For<SubModule>\Debug\RGA.a", delete

"R_OSPL_NDEBUG=1" in #define of the project settings.

When the SearchErrorInformation command is executed by double-clicking RGA_Tools.vbs, more advanced error information than the error code can be obtained from the file name and the line number in the library.

Window after RGA_Tools.vbs is double-clicked:

RGA Tools - Copyright(c) 2012-2015 Renesas Electronics Corporation

1. Image format conversion [RunImagePackager]

2. Error information search [SearchErrorInformation]

Number or command >2

-----------------------------------------------------------------

((( [SearchErrorInformation_sth] )))

Path or file name of error source file >Library.c

Error line number >2095

SoftFillRectangle_YUV422(): Rectangle.Left must be even

SoftFillRectangle_YUV422(): Rectangle.Left must be an even number.

If you want to break the location raising the error, call "R_OSPL_SET_BREAK_ERROR_ID" function at the first of the program. The argument is "error_ID" attribute of the above "ERROR" tag.

R_OSPL_SET_BREAK_ERROR_ID( 1 );

In RZ/A1H connected with ULINK2, after connecting the target (loading the program), open

"src\drivers\ospl\porting\DebugBreak.c" file by drag and drop to DS-5, set a breakpoint by right click at the left of the line defined "R_DebugBreak" function [ DS-5 breakpoints > Toggle Hardware Breakpoint ].

When the program was re-started, CPU breaks at the location raising the error. In DS-5, caller function is shown in

"Debug Control" view.

Even if the target board did not have serial port, you can get information from LED or GPIO connected with oscilloscope. The operational procedure is to call LED control function and waiting function (e.g. R_OSPL_Delay) from R_DebugBreak function and display the argument of R_DebugBreak function like Morse code.

Example:

 At start, turn on for 1 second and turn off for 1 second

 If bit was 1, turn on for 0.5 second and turn off for 0.5 second

 If bit was 0, turn on for 0.2 second and turn off for 0.8 second

 Display next binary digit by shift operation

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 123 of 127

RZ/A1H

7.3 Converting binary by ConvertBin

ConvertBin converts from binary file to C language array or S-record format (Motorola S-record).

RGA

Command Description

BinToC

BinToSRec

SRecToBin

Converts from binary file to C language array.

Variable name can be specified.

Converts from binary file to S-record format.

Comment, load address and execute address can be specified.

Execute address is usually 0 for data binary.

Converts from S-record format to binary file.

Window after RGA_Tools.vbs is double-clicked:

RGA Tools - Copyright(c) 2012-2015 Renesas Electronics Corporation

1. Convert image format [RunImagePackager]

2. Search error information [SearchErrorInformation]

3. Convert to binary [ConvertBin]

Number or command >3

---------------------------------------------------------------------------

((( [ConvertBin] )))

1. Binary to C language [BinToC]

2. Binary to S-record format [BinToSRec]

3. S-record format to binary [SRecToBin]

Number or command >

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 124 of 127

RZ/A1H RGA

7.4 Creating image file by RawToBmp

RawToBmp creates a BMP image file from Raw data in frame buffer.

Window after RGA_Tools.vbs is double-clicked:

RGA Tools - Copyright(c) 2012-2015 Renesas Electronics Corporation

1. Convert image format [RunImagePackager]

2. Search error information [SearchErrorInformation]

3. Convert to binary [ConvertBin]

4. Convert to BMP file [RawToBmp]

Number or command >4

---------------------------------------------------------------------------

Path of setting file >C:\Folder\RawToBmp.ini

Example of setting file:

RawPath = Image.bin

OutBmpPath = Image.bmp

Stride = 1600

Format = RGB565

Description of setting file:

Attribute Name

RawPath

OutBmpPath

Stride

Format

ReadOffset

Description

File path saved Raw data loaded from frame buffer

File path of output BMP file

Number of bytes of pixels having the same x coordinate in the previously below line.

Pixel format. Any one of ARGB8888, RGB565, ARGB1555, ARGB4444, YCbCr422,

A8, A4, A1. See Table 1-3.

List of offsets that means byte order of reading 8 bytes. e.g.) 01234567(Little endian), 76543210(Big endian)

"ReadOffset" can not specify with YCbCr422 format.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 125 of 127

RZ/A1H RGA

8. Sample Codes

Sample codes are contained in "src\samples\RGA" in the DS-5 project.

See the attached document "RGA Tutorial" about the operational procedure.

9. Reference Documents

User's Manual: Hardware

RZ/A1H Group User's Manual (Hardware)

The latest version can be downloaded from the Renesas Electronics website.

R7S72100 RTK772100BC00000BR (GENMAI) User's Manual

The latest version can be downloaded from the Renesas Electronics website.

R7S72100 CPU (GENMAI) Optional Board RTK7721000B00000BR User's Manual

The latest version can be downloaded from the Renesas Electronics website.

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition Issue C

The latest version can be downloaded from the ARM website.

ARM Generic Interrupt Controller Architecture Specification Architecture version 1.0

The latest version can be downloaded from the ARM website.

Technical Update/Technical News

The latest information can be downloaded from the Renesas Electronics website.

User's Manual: Development Tools

ARM Software Development Tools (ARM Compiler toolchain, ARM DS-5 etc) can be downloaded from the ARM website.

The latest version can be downloaded from the ARM website.

HTML Canvas 2D Context

W3C Candidate Recommendation 29 March 2012

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

Page 126 of 127

RZ/A1H

Website and Support

Renesas Electronics Website

http://www.renesas.com/

Inquiries

http://www.renesas.com/contact/

All trademarks and registered trademarks are the property of their respective owners.

R01AN2162EJ0210 Rev. 2.10

Mar. 29, 2016

RGA

Page 127 of 127

Revision History

Rev.

1.03

1.10

1.20

2.00

2.10

Date

Jul. 4, 2014

Dec, 16, 2014

Feb. 10, 2015

Jul. 31, 2015

Feb. 29, 2016

Description

First edition issued

Supported alpha only source image. Enlarged max size of source image.

Supported for RZ/1L. Supported PNG. Added "GRAPHICS_COPY",

"lock_object". Reduced porting work of RGPNCG.

Second edition issued

Updated initial settings to version 1.01. Reduced unnecessary L2 flush.

See 6.11.5.

Added "RawToBmp" tool.

Resolved issue that "R_GRAPHICS_Clear" function does not clear, when

"R_GRAPHICS_SetGlobalAlpha" was called with 0.

Resolved issue that thread attached event was conflicted and called

"R_OSPL_EVENT_Allocate/Free" of OSPL from RGA inside.

Added "NCGSYS_SetNextStateEventValue" function.

Calling malloc/free changed to calling new/delete in RGA C++ API. See

createImageData 6.9.5.7.

General Precautions in the Handling of MPU/MCU Products

The following usage notes are applicable to all MPU/MCU products from Renesas. For detailed usage notes on the products covered by this manual, refer to the relevant sections of the manual. If the descriptions under General

Precautions in the Handling of MPU/MCU Products and in the body of the manual differ from each other, the description in the body of the manual takes precedence.

1. Handling of Unused Pins

Handle unused pins in accord with the directions given under Handling of Unused Pins in the manual.

 The input pins of CMOS products are generally in the high-impedance state. In operation with an unused pin in the open-circuit state, extra electromagnetic noise is induced in the vicinity of LSI, an associated shoot-through current flows internally, and malfunctions occur due to the false recognition of the pin state as an input signal become possible. Unused pins should be handled as described under Handling of Unused Pins in the manual.

2. Processing at Power-on

The state of the product is undefined at the moment when power is supplied.

 The states of internal circuits in the LSI are indeterminate and the states of register settings and pins are undefined at the moment when power is supplied.

In a finished product where the reset signal is applied to the external reset pin, the states of pins are not guaranteed from the moment when power is supplied until the reset process is completed.

In a similar way, the states of pins in a product that is reset by an on-chip power-on reset function are not guaranteed from the moment when power is supplied until the power reaches the level at which resetting has been specified.

3. Prohibition of Access to Reserved Addresses

Access to reserved addresses is prohibited.

 The reserved addresses are provided for the possible future expansion of functions. Do not access these addresses; the correct operation of LSI is not guaranteed if they are accessed.

4. Clock Signals

After applying a reset, only release the reset line after the operating clock signal has become stable.

When switching the clock signal during program execution, wait until the target clock signal has stabilized.

 When the clock signal is generated with an external resonator (or from an external oscillator) during a reset, ensure that the reset line is only released after full stabilization of the clock signal.

Moreover, when switching to a clock signal produced with an external resonator (or by an external oscillator) while program execution is in progress, wait until the target clock signal is stable.

5. Differences between Products

Before changing from one product to another, i.e. to one with a different type number, confirm that the change will not lead to problems.

 The characteristics of MPU/MCU in the same group but having different type numbers may differ because of the differences in internal memory capacity and layout pattern. When changing to products of different type numbers, implement a system-evaluation test for each of the products.

Notice

1.

Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software, and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits, software, or information.

Notice

2.

Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein.

3.

Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others.

4.

You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part. Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from such alteration, modification, copy or otherwise misappropriation of Renesas Electronics product.

5.

Renesas Electronics products are classified according to the following two quality grades: "Standard" and "High Quality". The recommended applications for each Renesas Electronics product depends on the product's quality grade, as indicated below.

"Standard": Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots etc.

"High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anti-crime systems; and safety equipment etc.

Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to human life or bodily injury (artificial life support devices or systems, surgical implantations etc.), or may cause serious property damages (nuclear reactor control systems, military equipment etc.). You must check the quality grade of each Renesas Electronics product before using it in a particular application. You may not use any Renesas Electronics product for any application for which it is not intended. Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas Electronics.

6.

You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges.

7.

Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further, Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or systems manufactured by you.

8.

Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations.

9.

Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. You should not use Renesas Electronics products or technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the development of weapons of mass destruction. When exporting the Renesas Electronics products or technology described in this document, you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations.

10. It is the responsibility of the buyer or distributor of Renesas Electronics products, who distributes, disposes of, or otherwise places the product with a third party, to notify such third party in advance of the contents and conditions set forth in this document, Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics products.

11. This document may not be reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics.

12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products, or if you have any other inquiries.

(Note 1) "Renesas Electronics" as used in this document means Renesas Electronics Corporation and also includes its majority-owned subsidiaries.

(Note 2) "Renesas Electronics product(s)" means any product developed or manufactured by or for Renesas Electronics.

SALES OFFICES

Refer to "http://www.renesas.com/" for the latest and detailed information.

Renesas Electronics America Inc.

2801 Scott Boulevard Santa Clara, CA 95050-2549, U.S.A.

Tel: +1-408-588-6000, Fax: +1-408-588-6130

Renesas Electronics Canada Limited

9251 Yonge Street, Suite 8309 Richmond Hill, Ontario Canada L4C 9T3

Tel: +1-905-237-2004

Renesas Electronics Europe Limited

Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, U.K

Tel: +44-1628-585-100, Fax: +44-1628-585-900

Renesas Electronics Europe GmbH

Arcadiastrasse 10, 40472 Düsseldorf, Germany

Tel: +49-211-6503-0, Fax: +49-211-6503-1327

Renesas Electronics (China) Co., Ltd.

Room 1709, Quantum Plaza, No.27 ZhiChunLu Haidian District, Beijing 100191, P.R.China

Tel: +86-10-8235-1155, Fax: +86-10-8235-7679

Renesas Electronics (Shanghai) Co., Ltd.

Unit 301, Tower A, Central Towers, 555 Langao Road, Putuo District, Shanghai, P. R. China 200333

Tel: +86-21-2226-0888, Fax: +86-21-2226-0999

Renesas Electronics Hong Kong Limited

Unit 1601-1611, 16/F., Tower 2, Grand Century Place, 193 Prince Edward Road West, Mongkok, Kowloon, Hong Kong

Tel: +852-2265-6688, Fax: +852 2886-9022

Renesas Electronics Taiwan Co., Ltd.

13F, No. 363, Fu Shing North Road, Taipei 10543, Taiwan

Tel: +886-2-8175-9600, Fax: +886 2-8175-9670

Renesas Electronics Singapore Pte. Ltd.

80 Bendemeer Road, Unit #06-02 Hyflux Innovation Centre, Singapore 339949

Tel: +65-6213-0200, Fax: +65-6213-0300

Renesas Electronics Malaysia Sdn.Bhd.

Unit 1207, Block B, Menara Amcorp, Amcorp Trade Centre, No. 18, Jln Persiaran Barat, 46050 Petaling Jaya, Selangor Darul Ehsan, Malaysia

Tel: +60-3-7955-9390, Fax: +60-3-7955-9510

Renesas Electronics India Pvt. Ltd.

No.777C, 100 Feet Road, HAL II Stage, Indiranagar, Bangalore, India

Tel: +91-80-67208700, Fax: +91-80-67208777

Renesas Electronics Korea Co., Ltd.

12F., 234 Teheran-ro, Gangnam-Gu, Seoul, 135-080, Korea

Tel: +82-2-558-3737, Fax: +82-2-558-5141 http://www.renesas.com

© 2016 Renesas Electronics Corporation. All rights reserved.

Colophon 5.0

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals