Graphics framework for GR-PEACH. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
Dependents: ImageZoomInout_Sample ImageRotaion_Sample ImageScroll_Sample GR-PEACH_LCD_4_3inch_Save_to_USB ... more
RGA_Cpp.h
00001 /******************************************************************************* 00002 * DISCLAIMER 00003 * This software is supplied by Renesas Electronics Corporation and is only 00004 * intended for use with Renesas products. No other uses are authorized. This 00005 * software is owned by Renesas Electronics Corporation and is protected under 00006 * all applicable laws, including copyright laws. 00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING 00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT 00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. 00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS 00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE 00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR 00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE 00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00016 * Renesas reserves the right, without notice, to make changes to this software 00017 * and to discontinue the availability of this software. By using this software, 00018 * you agree to the additional terms and conditions found by accessing the 00019 * following link: 00020 * http://www.renesas.com/disclaimer 00021 * Copyright (C) 2013 - 2014 Renesas Electronics Corporation. All rights reserved. 00022 *******************************************************************************/ 00023 /** 00024 * @file RGA_Cpp.h 00025 * @brief $Module: RGA $ $PublicVersion: 1.20 $ (=RGA_VERSION) 00026 * $Rev: $ 00027 * $Date:: $ 00028 */ 00029 00030 #ifndef RGA_CPP_H 00031 #define RGA_CPP_H 00032 00033 #ifndef __cplusplus 00034 #error C++ only 00035 #endif 00036 00037 00038 /****************************************************************************** 00039 Includes <System Includes> , "Project Includes" 00040 ******************************************************************************/ 00041 #include "RGA.h" 00042 00043 00044 /****************************************************************************** 00045 Typedef definitions 00046 ******************************************************************************/ 00047 00048 /****************************************************************************** 00049 Macro definitions 00050 ******************************************************************************/ 00051 00052 /****************************************************************************** 00053 Variable Externs 00054 ******************************************************************************/ 00055 00056 /****************************************************************************** 00057 Functions Prototypes 00058 ******************************************************************************/ 00059 00060 typedef float graphics_matrix_float_t; 00061 typedef double graphics_matrix_other_float_t; 00062 00063 00064 /*********************************************************************** 00065 * Class: ObjectHandleClass 00066 ************************************************************************/ 00067 class ObjectHandleClass 00068 { 00069 public: 00070 void *Entity; 00071 00072 ObjectHandleClass() { 00073 this->Entity = NULL; 00074 } 00075 }; 00076 00077 bool_t operator == ( ObjectHandleClass Left, ObjectHandleClass Right ); 00078 00079 00080 /** undefined */ 00081 #define undefined get_undefined() 00082 extern ObjectHandleClass get_undefined(); 00083 00084 00085 /*********************************************************************** 00086 * Class: saveList_st 00087 ************************************************************************/ 00088 struct saveList_st { 00089 saveList_st *beforePoint; 00090 graphics_status_t saveData; 00091 }; 00092 00093 00094 /*********************************************************************** 00095 * Class: Canvas2D_ImageEntityClass 00096 ************************************************************************/ 00097 class Canvas2D_ImageEntityClass 00098 { 00099 public: 00100 graphics_image_t *C_Image; 00101 bool_t isImageDataComposition; 00102 00103 Canvas2D_ImageEntityClass( bool_t composition ) { 00104 this->C_Image = NULL; 00105 this->isImageDataComposition = composition; 00106 } 00107 }; 00108 00109 00110 /*********************************************************************** 00111 * Class: Canvas2D_ImageClass 00112 ************************************************************************/ 00113 class Canvas2D_ImageClass 00114 { 00115 public: 00116 Canvas2D_ImageEntityClass *Entity; 00117 00118 Canvas2D_ImageClass() { 00119 this->Entity = NULL; 00120 } 00121 00122 operator ObjectHandleClass () { 00123 return *(ObjectHandleClass *) this; 00124 } 00125 00126 Canvas2D_ImageClass &operator = ( ObjectHandleClass Right ) { 00127 this->Entity = (Canvas2D_ImageEntityClass *) Right.Entity; 00128 return *this; 00129 } 00130 00131 00132 void set_imageClass( graphics_image_t *imageClass ); 00133 inline void operator= ( graphics_image_t *imageClass ) { 00134 this->set_imageClass( imageClass ); 00135 } 00136 00137 inline operator graphics_image_t *() { 00138 return this->Entity->C_Image; 00139 } 00140 00141 00142 void destroy(); 00143 00144 00145 /* "width" property */ 00146 class widthProperty 00147 { 00148 public: 00149 inline operator int_t() { 00150 graphics_image_properties_t prop; 00151 errnum_t e; 00152 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)( 00153 (char *) this - offsetof( Canvas2D_ImageClass, width ) ); 00154 e = R_GRAPHICS_IMAGE_GetProperties( parent->Entity->C_Image, &prop ); 00155 if( e ) { 00156 R_OSPL_SetErrNum( e ); 00157 prop.width = 0; 00158 } 00159 return prop.width; 00160 } 00161 } width; 00162 00163 /* "height" property */ 00164 class heightProperty 00165 { 00166 public: 00167 inline operator int_t() { 00168 graphics_image_properties_t prop; 00169 errnum_t e; 00170 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)( 00171 (char *) this - offsetof( Canvas2D_ImageClass, height ) ); 00172 e = R_GRAPHICS_IMAGE_GetProperties( parent->Entity->C_Image, &prop ); 00173 if( e ) { 00174 R_OSPL_SetErrNum( e ); 00175 prop.height = 0; 00176 } 00177 return prop.height; 00178 } 00179 } height; 00180 00181 /* "data" property */ 00182 class dataProperty 00183 { 00184 public: 00185 inline operator uint8_t *() { 00186 graphics_image_properties_t prop; 00187 errnum_t e; 00188 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)( 00189 (char *) this - offsetof( Canvas2D_ImageClass, data ) ); 00190 e = R_GRAPHICS_IMAGE_GetProperties( parent->Entity->C_Image, &prop ); 00191 if( e ) { 00192 R_OSPL_SetErrNum( e ); 00193 prop.data = NULL; 00194 } 00195 return prop.data; 00196 } 00197 00198 inline operator r8g8b8a8_t *() { 00199 return (r8g8b8a8_t *)(uint8_t *) *this; 00200 } 00201 00202 inline operator void *() { 00203 return (void *)(uint8_t *) *this; 00204 } 00205 00206 inline uint8_t &operator[]( int Index ) { 00207 return ( (uint8_t *) *this )[ Index ]; 00208 } 00209 00210 inline uint8_t *operator+( int Index ) { 00211 return ( (uint8_t *) *this ) + Index; 00212 } 00213 } data; 00214 00215 /* "src" property */ 00216 class srcProperty 00217 { 00218 public: 00219 inline void operator= ( const graphics_image_t *imageClass ) { 00220 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)( 00221 (char *) this - offsetof( Canvas2D_ImageClass, src ) ); 00222 00223 parent->set_imageClass( (graphics_image_t *)imageClass ); 00224 } 00225 inline operator graphics_image_t *() { 00226 graphics_image_t *outData = NULL; 00227 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)( 00228 (char *) this - offsetof( Canvas2D_ImageClass, src ) ); 00229 00230 if( parent->Entity != NULL ) { 00231 outData = parent->Entity->C_Image; 00232 } 00233 return outData; 00234 } 00235 } src; 00236 }; 00237 00238 00239 /*********************************************************************** 00240 * Class: Canvas2D_PatternClass 00241 ************************************************************************/ 00242 class Canvas2D_PatternClass 00243 { 00244 public: 00245 graphics_pattern_t *Entity; 00246 00247 Canvas2D_PatternClass() { 00248 this->Entity = NULL; 00249 } 00250 00251 operator ObjectHandleClass () { 00252 return *(ObjectHandleClass *) this; 00253 } 00254 00255 Canvas2D_PatternClass &operator = ( ObjectHandleClass Right ) { 00256 this->Entity = (graphics_pattern_t *) Right.Entity; 00257 return *this; 00258 } 00259 00260 void destroy(); 00261 }; 00262 00263 00264 /*********************************************************************** 00265 * Class: Canvas2D_ContextEntityClass 00266 ************************************************************************/ 00267 class Canvas2D_ContextEntityClass 00268 { 00269 public: 00270 graphics_t *C_Graphics; 00271 saveList_st *LastSavePoint; 00272 00273 Canvas2D_ContextEntityClass() { 00274 this->C_Graphics = NULL; 00275 this->LastSavePoint = NULL; 00276 } 00277 }; 00278 00279 00280 /*********************************************************************** 00281 * Class: Canvas2D_ContextClass 00282 ************************************************************************/ 00283 class Canvas2D_ContextClass 00284 { 00285 public: 00286 Canvas2D_ContextEntityClass *Entity; 00287 00288 Canvas2D_ContextClass() { 00289 this->Entity = NULL; 00290 } 00291 00292 operator ObjectHandleClass () { 00293 return *(ObjectHandleClass *) this; 00294 } 00295 00296 Canvas2D_ContextClass &operator = ( ObjectHandleClass Right ) { 00297 this->Entity = (Canvas2D_ContextEntityClass *) Right.Entity; 00298 return *this; 00299 } 00300 00301 void destroy(); 00302 void clearRect( int x, int y, int w, int h ); 00303 void save(); 00304 void restore(); 00305 void drawImage( const graphics_image_t *image, int_t minX, int_t minY ); 00306 void drawImage( const graphics_image_t *image, int_t minX, int_t minY , int_t width, int_t height ); 00307 void drawImage( const graphics_image_t *image, int_t srcMinX, int_t srcMinY, int_t srcWidth, int_t srcHeight, 00308 int_t destMinx, int_t destMinY, int_t destWidth , int_t destHeight ); 00309 Canvas2D_ImageClass createImageData( Canvas2D_ImageClass image ); 00310 Canvas2D_ImageClass createImageData( int_t width, int_t height ); 00311 Canvas2D_ImageClass getImageData( int_t minX, int_t minY, int_t width, int_t height ); 00312 void putImageData( Canvas2D_ImageClass imageData, int_t minX, int_t minY ); 00313 void putImageData ( Canvas2D_ImageClass imageData, int_t minX, int_t minY, int_t dirtyX, int_t dirtyY, int_t dirtyWidth, int_t dirtyHeight ); 00314 void fillRect( int x, int y, int w, int h ); 00315 Canvas2D_PatternClass createPattern( const graphics_image_t *image, const char *repetition ); 00316 void beginPath(); 00317 void rect( int_t minX, int_t minY, int_t width, int_t height ); 00318 void clip(); 00319 00320 void setTransform( graphics_matrix_float_t sx, graphics_matrix_float_t ky, 00321 graphics_matrix_float_t kx, graphics_matrix_float_t sy, 00322 graphics_matrix_float_t tx, graphics_matrix_float_t ty ); 00323 void setTransform( graphics_matrix_other_float_t sx, graphics_matrix_other_float_t ky, 00324 graphics_matrix_other_float_t kx, graphics_matrix_other_float_t sy, 00325 graphics_matrix_other_float_t tx, graphics_matrix_other_float_t ty ) { 00326 setTransform( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) ky, 00327 (graphics_matrix_float_t) kx, (graphics_matrix_float_t) sy, 00328 (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty ); 00329 } 00330 void setTransform( int_t sx, int_t ky, int_t kx, int_t sy, int_t tx, int_t ty ) { 00331 setTransform( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) ky, 00332 (graphics_matrix_float_t) kx, (graphics_matrix_float_t) sy, 00333 (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty ); 00334 } 00335 00336 void translate( graphics_matrix_float_t tx, graphics_matrix_float_t ty ); 00337 void translate( graphics_matrix_other_float_t tx, graphics_matrix_other_float_t ty ) { 00338 translate( (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty ); 00339 } 00340 void translate( graphics_matrix_float_t tx, graphics_matrix_other_float_t ty ) { 00341 translate( tx, (graphics_matrix_float_t) ty ); 00342 } 00343 void translate( graphics_matrix_other_float_t tx, graphics_matrix_float_t ty ) { 00344 translate( (graphics_matrix_float_t) tx, ty ); 00345 } 00346 void translate( int_t tx, int_t ty ) { 00347 translate( (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty ); 00348 } 00349 00350 void scale( graphics_matrix_float_t sx, graphics_matrix_float_t sy ); 00351 void scale( graphics_matrix_other_float_t sx, graphics_matrix_other_float_t sy ) { 00352 scale( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) sy ); 00353 } 00354 void scale( graphics_matrix_float_t sx, graphics_matrix_other_float_t sy ) { 00355 scale( sx, (graphics_matrix_float_t) sy ); 00356 } 00357 void scale( graphics_matrix_other_float_t sx, graphics_matrix_float_t sy ) { 00358 scale( (graphics_matrix_float_t) sx, sy ); 00359 } 00360 void scale( int_t sx, int_t sy ) { 00361 scale( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) sy ); 00362 } 00363 00364 void rotate( graphics_matrix_float_t angle ); 00365 void rotate( graphics_matrix_other_float_t angle ) { 00366 rotate( (graphics_matrix_float_t) angle ); 00367 } 00368 00369 void transform( graphics_matrix_float_t sx, graphics_matrix_float_t ky, 00370 graphics_matrix_float_t kx, graphics_matrix_float_t sy, 00371 graphics_matrix_float_t tx, graphics_matrix_float_t ty ); 00372 void transform( graphics_matrix_other_float_t sx, graphics_matrix_other_float_t ky, 00373 graphics_matrix_other_float_t kx, graphics_matrix_other_float_t sy, 00374 graphics_matrix_other_float_t tx, graphics_matrix_other_float_t ty ) { 00375 transform( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) ky, 00376 (graphics_matrix_float_t) kx, (graphics_matrix_float_t) sy, 00377 (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty ); 00378 } 00379 void transform( int_t sx, int_t ky, int_t kx, int_t sy, int_t tx, int_t ty ) { 00380 transform( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) ky, 00381 (graphics_matrix_float_t) kx, (graphics_matrix_float_t) sy, 00382 (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty ); 00383 } 00384 00385 00386 /* "fillStyle" property */ 00387 void Set_fillStyle( const char *Color ); 00388 void Set_fillStyle( r8g8b8a8_t Color ); 00389 void Set_fillStylePattern( const Canvas2D_PatternClass Pattern ); 00390 #if 0 00391 void Set_fillStyleGradient( const Canvas2D_GradientClass Gradient ); 00392 #endif 00393 class fillStyleProperty 00394 { 00395 public: 00396 inline void operator= ( const char *Color ) { 00397 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00398 (char *) this - offsetof( Canvas2D_ContextClass, fillStyle ) ); 00399 00400 parent->Set_fillStyle( Color ); 00401 } 00402 inline void operator= ( r8g8b8a8_t Color ) { 00403 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00404 (char *) this - offsetof( Canvas2D_ContextClass, fillStyle ) ); 00405 00406 parent->Set_fillStyle( Color ); 00407 } 00408 inline void operator= ( const Canvas2D_PatternClass Pattern ) { 00409 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00410 (char *) this - offsetof( Canvas2D_ContextClass, fillStyle ) ); 00411 00412 parent->Set_fillStylePattern( Pattern ); 00413 } 00414 #if 0 00415 inline void operator= ( const Canvas2D_GradientClass Gradient ) { 00416 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00417 (char *) this - offsetof( Canvas2D_ContextClass, fillStyle ) ); 00418 00419 parent->Set_fillStyleGradient( Gradient ); 00420 } 00421 #endif 00422 } fillStyle; 00423 00424 00425 /* "c_LanguageContext" property */ 00426 class c_LanguageContextProperty 00427 { 00428 inline graphics_t *get_c_LanguageContext() { 00429 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00430 (char *) this - offsetof( Canvas2D_ContextClass, c_LanguageContext ) ); 00431 00432 return parent->Entity->C_Graphics; 00433 } 00434 public: 00435 00436 inline operator graphics_t *() { 00437 return get_c_LanguageContext(); 00438 } 00439 inline graphics_t *operator->() { 00440 return get_c_LanguageContext(); 00441 } 00442 } c_LanguageContext; 00443 00444 00445 /* "globalAlpha" property */ 00446 void set_globalAlpha( const float32_t alpha ); 00447 float32_t get_globalAlpha(); 00448 class globalAlphaProperty 00449 { 00450 public: 00451 inline void operator= ( const float32_t alpha ) { 00452 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00453 (char *) this - offsetof( Canvas2D_ContextClass, globalAlpha ) ); 00454 00455 parent->set_globalAlpha( alpha ); 00456 } 00457 inline void operator= ( const float64_t alpha ) { 00458 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00459 (char *) this - offsetof( Canvas2D_ContextClass, globalAlpha ) ); 00460 00461 parent->set_globalAlpha( (float32_t) alpha ); 00462 } 00463 inline operator float32_t() { 00464 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00465 (char *) this - offsetof( Canvas2D_ContextClass, globalAlpha ) ); 00466 00467 return parent->get_globalAlpha(); 00468 } 00469 } globalAlpha; 00470 00471 00472 /* "globalCompositeOperation" property */ 00473 void set_globalCompositeOperation( const char *operation ); 00474 char *get_globalCompositeOperation(); 00475 class globalCompositeOperationProperty 00476 { 00477 public: 00478 inline void operator= ( const char *operation ) { 00479 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00480 (char *) this - offsetof( Canvas2D_ContextClass, globalCompositeOperation ) ); 00481 00482 parent->set_globalCompositeOperation( operation ); 00483 } 00484 inline operator char *() { 00485 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)( 00486 (char *) this - offsetof( Canvas2D_ContextClass, globalCompositeOperation ) ); 00487 00488 return parent->get_globalCompositeOperation(); 00489 } 00490 } globalCompositeOperation; 00491 00492 }; 00493 00494 00495 /*********************************************************************** 00496 * Class: Canvas2D_ContextConfigClass 00497 ************************************************************************/ 00498 struct Canvas2D_ContextConfigClass { 00499 frame_buffer_t *frame_buffer; 00500 bool_t is_fast_manual_flush; 00501 00502 Canvas2D_ContextConfigClass() { 00503 frame_buffer = NULL; 00504 is_fast_manual_flush = false; 00505 } 00506 }; 00507 00508 00509 /*********************************************************************** 00510 * Functions: Canvas2D_Constructers 00511 ************************************************************************/ 00512 Canvas2D_ContextClass R_RGA_New_Canvas2D_ContextClass( frame_buffer_t *frame_buffer ); 00513 Canvas2D_ContextClass R_RGA_New_Canvas2D_ContextClass( Canvas2D_ContextConfigClass &in_out_Config ); 00514 Canvas2D_ImageClass R_RGA_New_Canvas2D_ImageClass(); 00515 00516 #endif // RGA_CPP_H
Generated on Tue Jul 12 2022 11:15:04 by 1.7.2