Renesas / Mbed OS RGA_HelloWorld

Dependencies:   GR-PEACH_video GraphicsFramework R_BSP LCD_shield_config

You are viewing an older revision! See the latest version

Homepage

Information

Japanese version is available in lower part of this page.

このページの後半に日本語版が用意されています.

What is this ?

RGA(Renesas Graphics Architecture) sample program using GR-PEACH.
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 was defined 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.

Please refer to following link about RGA.
http://www.renesas.com/support/downloads/download_results/C1000000-C9999999/mpumcu/rz/an_r01an2162ej_rza1h_other.jsp
This sample program draws in the frame buffer by using the buffer drawing mode of RGA.

Composition

GR-PEACH and LCD Shield.
/media/uploads/1050186/gr-peach-lcd_shield_01.jpg /media/uploads/1050186/gr-peach-lcd_shield_02.jpg

How to use

  1. Please connect GR-PEACH and LCD Shield. Then turn on the power to GR-PEACH.
  2. Please press the reset button of GR-PEACH.
  3. The top screen which "RGA Library Sample" is drawn is displayed on the LCD.
    /media/uploads/1050186/rga_sample_top.jpg
  4. There are seven touch buttons at the bottom of the top screen.When you press each button, the function of RGA that have been linked to the panel is executed, and the output image will be displayed on the LCD.
    Please refer to the "Drawing using the RGA" below about the function of RGA that have been linked to the panel.
  5. When RGA of the execution is completed, "Return Top Screen" button displaies at the top right of the screen. When you press it, the top screen is displayed.

Drawing using the RGA

Touch ButtonDiscriptions
Drawing of RectangleDrawing the rectangle.
The sample program draws the rectangle of red color, green color, blue color, black color and white color at regular intervals.
/media/uploads/1050186/drawing_of_rectangle2.jpg
Drawing of ImageDraw the image.
The sample program draws by overlapping the two images(flower and crystal image) in a state in which the shifted position.
/media/uploads/1050186/drawing_of_image.jpg
DissolutionDissolve by carry out the fade-in and the fade-out at the same time.
The sample program draws by overlapping the two images. And the transparency of the upper image is slowly lower, and the transparency of the lower image is slowly higher.
/media/uploads/1050186/dissolution4.jpg
ScrollScroll the image.
The sample program draws while being shifted the position of cutting out of the rendering source from the left to the right by the one pixel while fixing the display position of the drawing destination.
/media/uploads/1050186/scroll3.jpg
ZoomZoom the image.
The sample program draws while being increased the size of cutting out of the rendering source while fixing the display position of the drawing destination.
/media/uploads/1050186/zoom3.jpg
RotationRotate the image.
The sample program draws while being rotated the image clockwise by tilting the image by one degree.
/media/uploads/1050186/rotation4.jpg
AccelerationMovement of the image along with the acceleration.
The sample program draws while moving the image from right to left along with the acceleration which moves smooth the start and the end.
/media/uploads/1050186/acceleration3.jpg

About image to be drawn

Image files that are used in the sample program is easily possible replacement by using the "Convert Image to BinaryTable" tool below.
This tool generates "BinaryImage_RZ_A1H.c" and "BinaryImage_RZ_A1H.h" in the Images folder and converts each image file to binary. Then, this tool outputs the data to "RGA_Sample_BinaryImage" table of "BinaryImage_RZ_A1H.c" and defines the macro name indicating the offset position in the table to "BinaryImage_RZ_A1H.h".
The sample program executes with reference to this macro name for offset.

Convert Image to BinaryTable

File Description

Folder and FileDiscriptions
Images folder
BinaryImage_RZ_A1H.c[Output File]
Source file which binary table is generated
BinaryImage_RZ_A1H.h[Output File]Header file which macro name for the offset is defined
BinaryImageConfigRGAH.image.xmlSetting file
*.jpg, *.png, *.bmp[Input File]
Image files for drawing
scriptlib folderCommand files called from a script
RGA_Tools.vbsScript file
BinaryImageMakeRGAH.batExecute file

How to use

  1. Please download the "Convert Image to BinaryTable" tool and unzip it.
  2. Please put the image file to the Images folder and edit "BinaryImageConfigRGAH.image.xml".
  3. Please execute "BinaryImageMakeRGAH.bat". Then, "BinaryImage_RZ_A1H.c" and "BinaryImage_RZ_A1H.h" is generated.
  4. Please replace "BinaryImage_RZ_A1H.c" and "BinaryImage_RZ_A1H.h" in your program to the generated files.
  5. If necessary, please change macro name for the offset that is referenced in your program.
  6. Please build your program


概要

GR-PEACHを使ったRGA(ルネサスグラフィックスライブラリ)サンプルプログラムです。
RGAの特徴は以下の通りです。

  • ハードウェア アクセラレーションを使って高速に描画
  • W3C 標準である HTML Canvas 2D Context をベースに作成した API のため、学習が容易。
    また HTML Canvas 2D Context の下位互換として動作できる C++API を提供
  • アプリケーション側で用意したメモリー領域を描画先、または、入力画像として使用可能
  • 半透明な画像の描画と、アルファマスクを使った任意の形状の描画

RGAの詳細については、以下を参照下さい。
http://japan.renesas.com/support/downloads/download_results/C1000000-C9999999/mpumcu/rz/an_r01an2162jj_rza1h_other.jsp
本サンプルプログラムでは、RGAのバッファー描画モードを使ってフレームバッファに描画しています。

構成

GR-PEACH、LCDシールド
/media/uploads/1050186/gr-peach-lcd_shield_01.jpg /media/uploads/1050186/gr-peach-lcd_shield_02.jpg

使い方

  1. GR-PEACHとLCDシールドを接続し、GR-PEACHに電源を入れます。
  2. GR-PEACHのリセットボタンを押します。
  3. "RGA Library Sample"というトップ画面がLCDに表示されます。
    /media/uploads/1050186/rga_sample_top.jpg
  4. 画面下に7個のタッチボタンがあり、それぞれを押すと、各パネルに紐付けられたRGAの機能が実行され、その出力画像がLCDに表示されます。
    パネルに紐付けられたRGAの機能については、下記"RGAを使った描画"を参照下さい。
  5. RGA機能の実行が終わると、画面右上に"Return Top Screen"のボタンが表示されますので、押すとトップ画面に戻ります。

RGAを使った描画

タッチボタン説明
Drawing of Rectangle四角形の描画を行ないます。
サンプルでは、赤色/緑色/青色/黒色/白色の四角形を等間隔で描画します。
/media/uploads/1050186/drawing_of_rectangle2.jpg
Drawing of Image画像を描画を行ないます。
サンプルでは、位置をずらした状態で2つの画像(花とクリスタルの画像)を重ねて描画します。
/media/uploads/1050186/drawing_of_image.jpg
Dissolutionフェードインとフェードアウトを同時に行うことでディゾルブを行ないます。
サンプルでは、2つの画像を重ねて表示して、上の画像の透明度を徐々に下げ、下の画像の透明度を徐々に上げて描画します。
/media/uploads/1050186/dissolution4.jpg
Scroll画像のスクロールを行ないます。
サンプルでは、描画先の表示位置は固定のまま、描画元の取り出す位置を左から右に1ピクセルずつずらしながら描画します。
/media/uploads/1050186/scroll3.jpg
Zoom画像のズームを行ないます。
サンプルでは、描画先の表示位置は固定のまま、描画元の取り出すサイズを徐々に大きくしながら描画します。
/media/uploads/1050186/zoom3.jpg
Rotation画像の回転を行ないます。
サンプルでは、傾きを1度ずつ増やすことで、右回り回転させながら画像を描画します。
/media/uploads/1050186/rotation4.jpg
Acceleration加速を伴って画像の移動を行ないます。
サンプルでは、開始と終了が滑らかに動く加速を伴って、画像を右から左に移動させながら描画します。
/media/uploads/1050186/acceleration3.jpg

描画する画像について

サンプルプログラムで使用している画像ファイルは、下記の"Convert Image to BinaryTable"ツールを利用する事で、簡単に差し替えが可能です。
このツールは、Imagesフォルダ内にBinaryImage_RZ_A1H.c ファイルと BinaryImage_RZ_A1H.h ファイルを生成し、各画像ファイルをバイナリ変換します。そして、そのデータをBinaryImage_RZ_A1H.c ファイルのRGA_Sample_BinaryImageテーブルに出力し、BinaryImage_RZ_A1H.h ファイルにテーブル内のオフセット位置を示すマクロ名を定義します。
サンプルプログラムでは、オフセット用のマクロ名を参照して動作します。

Convert Image to BinaryTable

ファイル説明

フォルダ、ファイル説明
Imagesフォルダ
BinaryImage_RZ_A1H.c[出力ファイル]
バイナリテーブルが生成されるソースファイル
BinaryImage_RZ_A1H.h[出力ファイル]
オフセット用のマクロ名が定義されるヘッダファイル
BinaryImageConfigRGAH.image.xml設定ファイル
*.jpg, *.png, *.bmp[入力ファイル]
描画用の画像ファイル
scriptlibフォルダスクリプトから呼ばれるコマンドファイル
RGA_Tools.vbsスクリプトファイル
BinaryImageMakeRGAH.bat実行ファイル

使い方

  1. "Convert Image to BinaryTable"ツールをダウンロードして解凍します
  2. Imagesフォルダ内に画像ファイルを入れ、BinaryImageConfigRGAH.image.xmlを編集します
  3. BinaryImageMakeRGAH.batを実行し、BinaryImage_RZ_A1H.cとBinaryImage_RZ_A1H.hを生成します
  4. 生成されたファイルをプログラム内のBinaryImage_RZ_A1H.cとBinaryImage_RZ_A1H.hと置き換えます
  5. 必要であれば、プログラム内で参照しているオフセット用のマクロ名を変更します
  6. プログラムをビルドします


All wikipages