For Seminar
Dependencies: GR-PEACH_video GraphicsFramework R_BSP mbed-rtos mbed
Fork of RGA_HelloWorld by
Diff: rga_func.cpp
- Revision:
- 4:99ff10b59637
- Parent:
- 3:841987280a7f
- Child:
- 6:43a00280a595
diff -r 841987280a7f -r 99ff10b59637 rga_func.cpp --- a/rga_func.cpp Thu Jan 21 10:21:28 2016 +0000 +++ b/rga_func.cpp Wed Aug 31 02:15:51 2016 +0000 @@ -260,3 +260,86 @@ /* Complete drawing */ R_GRAPHICS_Finish(canvas2d.c_LanguageContext); } + +void RGA_Func_Training(frame_buffer_t* frmbuf_info, int animation_timing, float32_t relative_pos) { + /* Do accelerated motion from right to left */ + int position = 100; + r8g8b8a8_t fillColor; + uint8_t alpha; + + /* 回転角度 */ + const float32_t angle = (float32_t)(relative_pos * 3.14159 * 2.5); + + /* Clear */ + canvas2d.clearRect(0, 0, frmbuf_info->width, frmbuf_info->height); + + /* programing area 1 ------------------------------------------------*/ + + + + + /*---------------------------------------------------------------------*/ + + /*---------------------------------------------------------------------*/ + /* 画像の描画 (Section: 6.9.1.29) */ + canvas2d.drawImage(Landscape_wide_jpg_File, 100, 100); + /*---------------------------------------------------------------------*/ + + /* programing area 2 ------------------------------------------------*/ + + + + /*---------------------------------------------------------------------*/ + + + /* Draw return button */ + canvas2d.drawImage(RetBtn_jpg_File, 640, 10); + + /* Complete drawing */ + R_GRAPHICS_Finish(canvas2d.c_LanguageContext); +} + +#ifdef NEVER_COMES_HERE + /* 画像の描画 (Section: 6.9.1.29) */ + canvas2d.drawImage(g_sample0_jpg_File, 100, 100); + + /* matrix operation */ + /* 原点中心で回転処理 */ + canvas2d.rotate(angle); + + /* 原点が左上の画像に対して、画像の中心が原点となるように平行移動 */ + canvas2d.translate((-IMG_DRAW_WIDTH / 2), (-IMG_DRAW_HEIGHT / 2)); + + /* 希望する位置への移動 */ + canvas2d.translate((100 + (IMG_DRAW_WIDTH / 2)), (100 + (IMG_DRAW_HEIGHT / 2))); + + /* 拡大縮小 */ + canvas2d.scale(relative_pos * 1.2, relative_pos * 1.2); + + /* マトリクスの初期化 */ + canvas2d.setTransform(1, 0, 0, 1, 0, 0); + + /* animation */ + /* アニメーション時の位置取得 */ + R_Get_AnimationTimingFunction("ease-in-out", &accelerator); + position = R_ANIMATION_TIMING_FUNCTION_GetValue(accelerator, relative_pos, 550.0f, 10.0f); + + /* 背景色の設定 */ + /* 色の指定例: その他は http://www.colordic.org/ + 赤 緑 青 + 白: 255, 255, 255 + 黒: 0, 0, 0 + 赤: 255, 0, 0 + */ + fillColor.u.Alpha = 255; + fillColor.u.Red = 255; + fillColor.u.Green = 255; + fillColor.u.Blue = 255; + R_GRAPHICS_SetBackgroundColor(canvas2d.c_LanguageContext, fillColor); + + /* alpha blending */ + /* アルファ値の設定 */ + alpha = (uint8_t) (relative_pos * (float32_t)ACCELERATE_MAX_NUM) + 15; + R_GRAPHICS_SetGlobalAlpha(canvas2d.c_LanguageContext, alpha); + +#endif \ No newline at end of file