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

License

When you use this library, we judge you have agreed to the following contents.

https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

Note

If you import the GraphicsFramework library, please import GR-PEACH_video library and R_BSP library together.



JPEG Converter

The JPEG Converter driver implements encode and decode functionality which uses the JCU of the RZ/A Series.

Hello World!

Import programJCU_HelloWorld

Hello World for JCU(JPEG Codec Unit). JCU is JPEG codec unit of RZ/A1. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

API

Import library

Data Structures

struct bitmap_buff_info_t
Bitmap data setting struct. More...
struct encode_options_t
Encode option setting. More...

Public Types

enum jpeg_conv_error_t {
JPEG_CONV_OK = 0, JPEG_CONV_JCU_ERR = -1, JPEG_CONV_FORMA_ERR = -2, JPEG_CONV_PARAM_ERR = -3,
JPEG_CONV_BUSY = -4, JPEG_CONV_PARAM_RANGE_ERR = -7
}

Error codes.

More...
enum wr_rd_swa_t {
WR_RD_WRSWA_NON = 0, WR_RD_WRSWA_8BIT = 1, WR_RD_WRSWA_16BIT = 2, WR_RD_WRSWA_16_8BIT = 3,
WR_RD_WRSWA_32BIT = 4, WR_RD_WRSWA_32_8BIT = 5, WR_RD_WRSWA_32_16BIT = 6, WR_RD_WRSWA_32_16_8BIT = 7
}

Write/Read image pixcel frame buffer swap setting.

More...
enum wr_rd_format_t { WR_RD_YCbCr422 = 0x00, WR_RD_ARGB8888 = 0x01, WR_RD_RGB565 = 0x02 }

Write/Read image pixcel format selects.

More...
enum sub_sampling_t { SUB_SAMPLING_1_1 = 0x00, SUB_SAMPLING_1_2 = 0x01, SUB_SAMPLING_1_4 = 0x02, SUB_SAMPLING_1_8 = 0x03 }

Thinning output image selects.

More...
enum cbcr_offset_t { CBCR_OFFSET_0 = 0x00, CBCR_OFFSET_128 = 0x01 }

Cb/Cr range selects for decode.

More...

Public Member Functions

JPEG_Converter ()
Constructor method of JPEG converter(encode/decode)
virtual ~JPEG_Converter ()
Destructor method of JPEG converter(encode/decode)
JPEG_Converter::jpeg_conv_error_t decode (void *pJpegBuff, bitmap_buff_info_t *psOutputBuff)
Decode JPEG to rinear data.
JPEG_Converter::jpeg_conv_error_t decode (void *pJpegBuff, bitmap_buff_info_t *psOutputBuff, decode_options_t *pOptions)
JPEG data decode to bitmap.
JPEG_Converter::jpeg_conv_error_t encode ( bitmap_buff_info_t *psInputBuff, void *pJpegBuff, size_t *pEncodeSize)
Encode rinear data to JPEG.
JPEG_Converter::jpeg_conv_error_t encode ( bitmap_buff_info_t *psInputBuff, void *pJpegBuff, size_t *pEncodeSize, encode_options_t *pOptions)
Bitmap data encode to JPEG.
JPEG_Converter::jpeg_conv_error_t SetQuality (const uint8_t qual)
Set encode quality.

Correspondence file

A correspondence file of JPEG Converter is as the following table.

JPEGCorrespondence
Width>0(greater than 0)
Height>0(greater than 0)
Color formatYCbCr444, YCbCr422, YCbCr420, YCbCr411
BitmapCorrespondence
Width>0(greater than 0)
Height>0(greater than 0)
Color formatYCbCr422

Notice

You run JPEG converter once destruction each time.

You set whether these JPEG files aren't input, or it check error setting decode(set in "flag" = true). The JPEG file which becomes correspondence outside will be the following condition.

  • File besides the above-mentioned correspondence file.
  • As information in the JPEG file, WIDTH or HEIGHT is larger than output buffer setting.

Buffer area is used encode/decode, set 8 bytes align and non-cash memory area. The output buffer when decoding, is made beyond the size decided in the size of the JPEG file, the format, setting of thinning out. You make output buffer for decode/encode to enough big size in order to stock this result. JPEG Converter, if you do not particularly perform specified, does not check size against the output data at the time of encoding and decoding. You set the output buffer so that there is no effect of corruption by the output data.

Color format

Color format in case to be converted from Bitmap to JPEG is either ARGB8888 or RGB555, YCbCr422. Color format of the If you want to convert from JPEG file to Bitmap file is YCbCr422. You correct "alpha(member of decode_options_t)" of setting and "output_cb_cr_offset(member of decode_options_t)" according to color format when decoding.

  • example
    decode to ARGB8888(WR_RD_ARGB8888 set in format member of bitmap_buff_info_t)
    alpha = 0x01-0xFF
    output_cb_cr_offset = CBCR_OFFSET_0

    decode to YCbCr422(WR_RD_YCbCr422 set in format member of bitmap_buff_info_t)
    alpha = 0
    output_cb_cr_offset = CBCR_OFFSET_0 or CBCR_OFFSET_128

    decode to RGB565(WR_RD_RGB565 set in format member of bitmap_buff_info_t)
    alpha = 0
    output_cb_cr_offset = CBCR_OFFSET_0

Decode/encode settings are optional

If omitted encode/decode settings, it will work with the following settings.
[Decode option setting (member of decode_options_t)]

  • Vertical sub sampling is thinning output image to 1/1.
  • Horizontal sub sampling is thinning output image to 1/1.
  • Output data of Cb/Cr range is -128 to 127.
  • Output data of swap in 8-bit units: 2-1-4-3-6-5-8-7.
  • Alpha value of 0.
  • JPEG format correspondence outside error check.
  • It decode in a synchronous function.

[Encode option setting (member of encode_options_t)]

  • DRI value is 0.
  • Encoding JPEG file start width offset is 0.
  • Encoding JPEG file start height offset is 0.
  • Input data of Cb/Cr range of input data is -128 to 127.
  • Input data swap in 8-bit units: 2-1-4-3-6-5-8-7.
  • It don't check encode size.
  • Quantization Y use default table(Quality75).
  • Quantization C use default table(Quality75).
  • Huffman Y DC use default table.
  • Huffman C DC use default table.
  • Huffman Y AC use default table.
  • Huffman C AC use default table.
  • It encode in a synchronous function.

Synchronous/asynchronous switching

Decoding and encoding setting to operate asynchronously by setting a callback function(decode_options_t and encode_options_t).

Quality

Quality changes are possible. If you want to change the Quality, please specify the table made of Quality you want to change the address of the setting. If you do not want to change the Quality, it will operate at Quality75.

RGA

The RGA library implements fast drawing functionality which uses the RGA of the RZ/A Series.
Supporting compiler is ARMCC, GCC ARM and IAR.

Hello World!

Import programRGA_HelloWorld

Hello World for RGA(Renesas Graphics Architecture). RGA is the Graphics Library of RZ/A1. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

Committer:
dkato
Date:
Mon Apr 24 08:16:23 2017 +0000
Revision:
13:1ee2176ef13f
Parent:
3:9f857750e4e9
Add "SetQuality()" to JCU.
; Bug fixes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
1050186 3:9f857750e4e9 1 /*******************************************************************************
1050186 3:9f857750e4e9 2 * DISCLAIMER
1050186 3:9f857750e4e9 3 * This software is supplied by Renesas Electronics Corporation and is only
1050186 3:9f857750e4e9 4 * intended for use with Renesas products. No other uses are authorized. This
1050186 3:9f857750e4e9 5 * software is owned by Renesas Electronics Corporation and is protected under
1050186 3:9f857750e4e9 6 * all applicable laws, including copyright laws.
1050186 3:9f857750e4e9 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
1050186 3:9f857750e4e9 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
1050186 3:9f857750e4e9 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
1050186 3:9f857750e4e9 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
1050186 3:9f857750e4e9 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
1050186 3:9f857750e4e9 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
1050186 3:9f857750e4e9 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
1050186 3:9f857750e4e9 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
1050186 3:9f857750e4e9 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
1050186 3:9f857750e4e9 16 * Renesas reserves the right, without notice, to make changes to this software
1050186 3:9f857750e4e9 17 * and to discontinue the availability of this software. By using this software,
1050186 3:9f857750e4e9 18 * you agree to the additional terms and conditions found by accessing the
1050186 3:9f857750e4e9 19 * following link:
1050186 3:9f857750e4e9 20 * http://www.renesas.com/disclaimer
1050186 3:9f857750e4e9 21 * Copyright (C) 2013 - 2014 Renesas Electronics Corporation. All rights reserved.
1050186 3:9f857750e4e9 22 *******************************************************************************/
1050186 3:9f857750e4e9 23 /**
1050186 3:9f857750e4e9 24 * @file RGA_Cpp.h
1050186 3:9f857750e4e9 25 * @brief $Module: RGA $ $PublicVersion: 1.20 $ (=RGA_VERSION)
1050186 3:9f857750e4e9 26 * $Rev: $
1050186 3:9f857750e4e9 27 * $Date:: $
1050186 3:9f857750e4e9 28 */
1050186 3:9f857750e4e9 29
1050186 3:9f857750e4e9 30 #ifndef RGA_CPP_H
1050186 3:9f857750e4e9 31 #define RGA_CPP_H
1050186 3:9f857750e4e9 32
1050186 3:9f857750e4e9 33 #ifndef __cplusplus
1050186 3:9f857750e4e9 34 #error C++ only
1050186 3:9f857750e4e9 35 #endif
1050186 3:9f857750e4e9 36
1050186 3:9f857750e4e9 37
1050186 3:9f857750e4e9 38 /******************************************************************************
1050186 3:9f857750e4e9 39 Includes <System Includes> , "Project Includes"
1050186 3:9f857750e4e9 40 ******************************************************************************/
1050186 3:9f857750e4e9 41 #include "RGA.h"
1050186 3:9f857750e4e9 42
1050186 3:9f857750e4e9 43
1050186 3:9f857750e4e9 44 /******************************************************************************
1050186 3:9f857750e4e9 45 Typedef definitions
1050186 3:9f857750e4e9 46 ******************************************************************************/
1050186 3:9f857750e4e9 47
1050186 3:9f857750e4e9 48 /******************************************************************************
1050186 3:9f857750e4e9 49 Macro definitions
1050186 3:9f857750e4e9 50 ******************************************************************************/
1050186 3:9f857750e4e9 51
1050186 3:9f857750e4e9 52 /******************************************************************************
1050186 3:9f857750e4e9 53 Variable Externs
1050186 3:9f857750e4e9 54 ******************************************************************************/
1050186 3:9f857750e4e9 55
1050186 3:9f857750e4e9 56 /******************************************************************************
1050186 3:9f857750e4e9 57 Functions Prototypes
1050186 3:9f857750e4e9 58 ******************************************************************************/
1050186 3:9f857750e4e9 59
1050186 3:9f857750e4e9 60 typedef float graphics_matrix_float_t;
1050186 3:9f857750e4e9 61 typedef double graphics_matrix_other_float_t;
1050186 3:9f857750e4e9 62
1050186 3:9f857750e4e9 63
1050186 3:9f857750e4e9 64 /***********************************************************************
1050186 3:9f857750e4e9 65 * Class: ObjectHandleClass
1050186 3:9f857750e4e9 66 ************************************************************************/
1050186 3:9f857750e4e9 67 class ObjectHandleClass
1050186 3:9f857750e4e9 68 {
1050186 3:9f857750e4e9 69 public:
1050186 3:9f857750e4e9 70 void *Entity;
1050186 3:9f857750e4e9 71
1050186 3:9f857750e4e9 72 ObjectHandleClass() {
1050186 3:9f857750e4e9 73 this->Entity = NULL;
1050186 3:9f857750e4e9 74 }
1050186 3:9f857750e4e9 75 };
1050186 3:9f857750e4e9 76
1050186 3:9f857750e4e9 77 bool_t operator == ( ObjectHandleClass Left, ObjectHandleClass Right );
1050186 3:9f857750e4e9 78
1050186 3:9f857750e4e9 79
1050186 3:9f857750e4e9 80 /** undefined */
1050186 3:9f857750e4e9 81 #define undefined get_undefined()
1050186 3:9f857750e4e9 82 extern ObjectHandleClass get_undefined();
1050186 3:9f857750e4e9 83
1050186 3:9f857750e4e9 84
1050186 3:9f857750e4e9 85 /***********************************************************************
1050186 3:9f857750e4e9 86 * Class: saveList_st
1050186 3:9f857750e4e9 87 ************************************************************************/
1050186 3:9f857750e4e9 88 struct saveList_st {
1050186 3:9f857750e4e9 89 saveList_st *beforePoint;
1050186 3:9f857750e4e9 90 graphics_status_t saveData;
1050186 3:9f857750e4e9 91 };
1050186 3:9f857750e4e9 92
1050186 3:9f857750e4e9 93
1050186 3:9f857750e4e9 94 /***********************************************************************
1050186 3:9f857750e4e9 95 * Class: Canvas2D_ImageEntityClass
1050186 3:9f857750e4e9 96 ************************************************************************/
1050186 3:9f857750e4e9 97 class Canvas2D_ImageEntityClass
1050186 3:9f857750e4e9 98 {
1050186 3:9f857750e4e9 99 public:
1050186 3:9f857750e4e9 100 graphics_image_t *C_Image;
1050186 3:9f857750e4e9 101 bool_t isImageDataComposition;
1050186 3:9f857750e4e9 102
1050186 3:9f857750e4e9 103 Canvas2D_ImageEntityClass( bool_t composition ) {
1050186 3:9f857750e4e9 104 this->C_Image = NULL;
1050186 3:9f857750e4e9 105 this->isImageDataComposition = composition;
1050186 3:9f857750e4e9 106 }
1050186 3:9f857750e4e9 107 };
1050186 3:9f857750e4e9 108
1050186 3:9f857750e4e9 109
1050186 3:9f857750e4e9 110 /***********************************************************************
1050186 3:9f857750e4e9 111 * Class: Canvas2D_ImageClass
1050186 3:9f857750e4e9 112 ************************************************************************/
1050186 3:9f857750e4e9 113 class Canvas2D_ImageClass
1050186 3:9f857750e4e9 114 {
1050186 3:9f857750e4e9 115 public:
1050186 3:9f857750e4e9 116 Canvas2D_ImageEntityClass *Entity;
1050186 3:9f857750e4e9 117
1050186 3:9f857750e4e9 118 Canvas2D_ImageClass() {
1050186 3:9f857750e4e9 119 this->Entity = NULL;
1050186 3:9f857750e4e9 120 }
1050186 3:9f857750e4e9 121
1050186 3:9f857750e4e9 122 operator ObjectHandleClass () {
1050186 3:9f857750e4e9 123 return *(ObjectHandleClass *) this;
1050186 3:9f857750e4e9 124 }
1050186 3:9f857750e4e9 125
1050186 3:9f857750e4e9 126 Canvas2D_ImageClass &operator = ( ObjectHandleClass Right ) {
1050186 3:9f857750e4e9 127 this->Entity = (Canvas2D_ImageEntityClass *) Right.Entity;
1050186 3:9f857750e4e9 128 return *this;
1050186 3:9f857750e4e9 129 }
1050186 3:9f857750e4e9 130
1050186 3:9f857750e4e9 131
1050186 3:9f857750e4e9 132 void set_imageClass( graphics_image_t *imageClass );
1050186 3:9f857750e4e9 133 inline void operator= ( graphics_image_t *imageClass ) {
1050186 3:9f857750e4e9 134 this->set_imageClass( imageClass );
1050186 3:9f857750e4e9 135 }
1050186 3:9f857750e4e9 136
1050186 3:9f857750e4e9 137 inline operator graphics_image_t *() {
1050186 3:9f857750e4e9 138 return this->Entity->C_Image;
1050186 3:9f857750e4e9 139 }
1050186 3:9f857750e4e9 140
1050186 3:9f857750e4e9 141
1050186 3:9f857750e4e9 142 void destroy();
1050186 3:9f857750e4e9 143
1050186 3:9f857750e4e9 144
1050186 3:9f857750e4e9 145 /* "width" property */
1050186 3:9f857750e4e9 146 class widthProperty
1050186 3:9f857750e4e9 147 {
1050186 3:9f857750e4e9 148 public:
1050186 3:9f857750e4e9 149 inline operator int_t() {
1050186 3:9f857750e4e9 150 graphics_image_properties_t prop;
1050186 3:9f857750e4e9 151 errnum_t e;
1050186 3:9f857750e4e9 152 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)(
1050186 3:9f857750e4e9 153 (char *) this - offsetof( Canvas2D_ImageClass, width ) );
1050186 3:9f857750e4e9 154 e = R_GRAPHICS_IMAGE_GetProperties( parent->Entity->C_Image, &prop );
1050186 3:9f857750e4e9 155 if( e ) {
1050186 3:9f857750e4e9 156 R_OSPL_SetErrNum( e );
1050186 3:9f857750e4e9 157 prop.width = 0;
1050186 3:9f857750e4e9 158 }
1050186 3:9f857750e4e9 159 return prop.width;
1050186 3:9f857750e4e9 160 }
1050186 3:9f857750e4e9 161 } width;
1050186 3:9f857750e4e9 162
1050186 3:9f857750e4e9 163 /* "height" property */
1050186 3:9f857750e4e9 164 class heightProperty
1050186 3:9f857750e4e9 165 {
1050186 3:9f857750e4e9 166 public:
1050186 3:9f857750e4e9 167 inline operator int_t() {
1050186 3:9f857750e4e9 168 graphics_image_properties_t prop;
1050186 3:9f857750e4e9 169 errnum_t e;
1050186 3:9f857750e4e9 170 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)(
1050186 3:9f857750e4e9 171 (char *) this - offsetof( Canvas2D_ImageClass, height ) );
1050186 3:9f857750e4e9 172 e = R_GRAPHICS_IMAGE_GetProperties( parent->Entity->C_Image, &prop );
1050186 3:9f857750e4e9 173 if( e ) {
1050186 3:9f857750e4e9 174 R_OSPL_SetErrNum( e );
1050186 3:9f857750e4e9 175 prop.height = 0;
1050186 3:9f857750e4e9 176 }
1050186 3:9f857750e4e9 177 return prop.height;
1050186 3:9f857750e4e9 178 }
1050186 3:9f857750e4e9 179 } height;
1050186 3:9f857750e4e9 180
1050186 3:9f857750e4e9 181 /* "data" property */
1050186 3:9f857750e4e9 182 class dataProperty
1050186 3:9f857750e4e9 183 {
1050186 3:9f857750e4e9 184 public:
1050186 3:9f857750e4e9 185 inline operator uint8_t *() {
1050186 3:9f857750e4e9 186 graphics_image_properties_t prop;
1050186 3:9f857750e4e9 187 errnum_t e;
1050186 3:9f857750e4e9 188 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)(
1050186 3:9f857750e4e9 189 (char *) this - offsetof( Canvas2D_ImageClass, data ) );
1050186 3:9f857750e4e9 190 e = R_GRAPHICS_IMAGE_GetProperties( parent->Entity->C_Image, &prop );
1050186 3:9f857750e4e9 191 if( e ) {
1050186 3:9f857750e4e9 192 R_OSPL_SetErrNum( e );
1050186 3:9f857750e4e9 193 prop.data = NULL;
1050186 3:9f857750e4e9 194 }
1050186 3:9f857750e4e9 195 return prop.data;
1050186 3:9f857750e4e9 196 }
1050186 3:9f857750e4e9 197
1050186 3:9f857750e4e9 198 inline operator r8g8b8a8_t *() {
1050186 3:9f857750e4e9 199 return (r8g8b8a8_t *)(uint8_t *) *this;
1050186 3:9f857750e4e9 200 }
1050186 3:9f857750e4e9 201
1050186 3:9f857750e4e9 202 inline operator void *() {
1050186 3:9f857750e4e9 203 return (void *)(uint8_t *) *this;
1050186 3:9f857750e4e9 204 }
1050186 3:9f857750e4e9 205
1050186 3:9f857750e4e9 206 inline uint8_t &operator[]( int Index ) {
1050186 3:9f857750e4e9 207 return ( (uint8_t *) *this )[ Index ];
1050186 3:9f857750e4e9 208 }
1050186 3:9f857750e4e9 209
1050186 3:9f857750e4e9 210 inline uint8_t *operator+( int Index ) {
1050186 3:9f857750e4e9 211 return ( (uint8_t *) *this ) + Index;
1050186 3:9f857750e4e9 212 }
1050186 3:9f857750e4e9 213 } data;
1050186 3:9f857750e4e9 214
1050186 3:9f857750e4e9 215 /* "src" property */
1050186 3:9f857750e4e9 216 class srcProperty
1050186 3:9f857750e4e9 217 {
1050186 3:9f857750e4e9 218 public:
1050186 3:9f857750e4e9 219 inline void operator= ( const graphics_image_t *imageClass ) {
1050186 3:9f857750e4e9 220 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)(
1050186 3:9f857750e4e9 221 (char *) this - offsetof( Canvas2D_ImageClass, src ) );
1050186 3:9f857750e4e9 222
1050186 3:9f857750e4e9 223 parent->set_imageClass( (graphics_image_t *)imageClass );
1050186 3:9f857750e4e9 224 }
1050186 3:9f857750e4e9 225 inline operator graphics_image_t *() {
1050186 3:9f857750e4e9 226 graphics_image_t *outData = NULL;
1050186 3:9f857750e4e9 227 Canvas2D_ImageClass *parent = (Canvas2D_ImageClass *)(
1050186 3:9f857750e4e9 228 (char *) this - offsetof( Canvas2D_ImageClass, src ) );
1050186 3:9f857750e4e9 229
1050186 3:9f857750e4e9 230 if( parent->Entity != NULL ) {
1050186 3:9f857750e4e9 231 outData = parent->Entity->C_Image;
1050186 3:9f857750e4e9 232 }
1050186 3:9f857750e4e9 233 return outData;
1050186 3:9f857750e4e9 234 }
1050186 3:9f857750e4e9 235 } src;
1050186 3:9f857750e4e9 236 };
1050186 3:9f857750e4e9 237
1050186 3:9f857750e4e9 238
1050186 3:9f857750e4e9 239 /***********************************************************************
1050186 3:9f857750e4e9 240 * Class: Canvas2D_PatternClass
1050186 3:9f857750e4e9 241 ************************************************************************/
1050186 3:9f857750e4e9 242 class Canvas2D_PatternClass
1050186 3:9f857750e4e9 243 {
1050186 3:9f857750e4e9 244 public:
1050186 3:9f857750e4e9 245 graphics_pattern_t *Entity;
1050186 3:9f857750e4e9 246
1050186 3:9f857750e4e9 247 Canvas2D_PatternClass() {
1050186 3:9f857750e4e9 248 this->Entity = NULL;
1050186 3:9f857750e4e9 249 }
1050186 3:9f857750e4e9 250
1050186 3:9f857750e4e9 251 operator ObjectHandleClass () {
1050186 3:9f857750e4e9 252 return *(ObjectHandleClass *) this;
1050186 3:9f857750e4e9 253 }
1050186 3:9f857750e4e9 254
1050186 3:9f857750e4e9 255 Canvas2D_PatternClass &operator = ( ObjectHandleClass Right ) {
1050186 3:9f857750e4e9 256 this->Entity = (graphics_pattern_t *) Right.Entity;
1050186 3:9f857750e4e9 257 return *this;
1050186 3:9f857750e4e9 258 }
1050186 3:9f857750e4e9 259
1050186 3:9f857750e4e9 260 void destroy();
1050186 3:9f857750e4e9 261 };
1050186 3:9f857750e4e9 262
1050186 3:9f857750e4e9 263
1050186 3:9f857750e4e9 264 /***********************************************************************
1050186 3:9f857750e4e9 265 * Class: Canvas2D_ContextEntityClass
1050186 3:9f857750e4e9 266 ************************************************************************/
1050186 3:9f857750e4e9 267 class Canvas2D_ContextEntityClass
1050186 3:9f857750e4e9 268 {
1050186 3:9f857750e4e9 269 public:
1050186 3:9f857750e4e9 270 graphics_t *C_Graphics;
1050186 3:9f857750e4e9 271 saveList_st *LastSavePoint;
1050186 3:9f857750e4e9 272
1050186 3:9f857750e4e9 273 Canvas2D_ContextEntityClass() {
1050186 3:9f857750e4e9 274 this->C_Graphics = NULL;
1050186 3:9f857750e4e9 275 this->LastSavePoint = NULL;
1050186 3:9f857750e4e9 276 }
1050186 3:9f857750e4e9 277 };
1050186 3:9f857750e4e9 278
1050186 3:9f857750e4e9 279
1050186 3:9f857750e4e9 280 /***********************************************************************
1050186 3:9f857750e4e9 281 * Class: Canvas2D_ContextClass
1050186 3:9f857750e4e9 282 ************************************************************************/
1050186 3:9f857750e4e9 283 class Canvas2D_ContextClass
1050186 3:9f857750e4e9 284 {
1050186 3:9f857750e4e9 285 public:
1050186 3:9f857750e4e9 286 Canvas2D_ContextEntityClass *Entity;
1050186 3:9f857750e4e9 287
1050186 3:9f857750e4e9 288 Canvas2D_ContextClass() {
1050186 3:9f857750e4e9 289 this->Entity = NULL;
1050186 3:9f857750e4e9 290 }
1050186 3:9f857750e4e9 291
1050186 3:9f857750e4e9 292 operator ObjectHandleClass () {
1050186 3:9f857750e4e9 293 return *(ObjectHandleClass *) this;
1050186 3:9f857750e4e9 294 }
1050186 3:9f857750e4e9 295
1050186 3:9f857750e4e9 296 Canvas2D_ContextClass &operator = ( ObjectHandleClass Right ) {
1050186 3:9f857750e4e9 297 this->Entity = (Canvas2D_ContextEntityClass *) Right.Entity;
1050186 3:9f857750e4e9 298 return *this;
1050186 3:9f857750e4e9 299 }
1050186 3:9f857750e4e9 300
1050186 3:9f857750e4e9 301 void destroy();
1050186 3:9f857750e4e9 302 void clearRect( int x, int y, int w, int h );
1050186 3:9f857750e4e9 303 void save();
1050186 3:9f857750e4e9 304 void restore();
1050186 3:9f857750e4e9 305 void drawImage( const graphics_image_t *image, int_t minX, int_t minY );
1050186 3:9f857750e4e9 306 void drawImage( const graphics_image_t *image, int_t minX, int_t minY , int_t width, int_t height );
1050186 3:9f857750e4e9 307 void drawImage( const graphics_image_t *image, int_t srcMinX, int_t srcMinY, int_t srcWidth, int_t srcHeight,
1050186 3:9f857750e4e9 308 int_t destMinx, int_t destMinY, int_t destWidth , int_t destHeight );
1050186 3:9f857750e4e9 309 Canvas2D_ImageClass createImageData( Canvas2D_ImageClass image );
1050186 3:9f857750e4e9 310 Canvas2D_ImageClass createImageData( int_t width, int_t height );
1050186 3:9f857750e4e9 311 Canvas2D_ImageClass getImageData( int_t minX, int_t minY, int_t width, int_t height );
1050186 3:9f857750e4e9 312 void putImageData( Canvas2D_ImageClass imageData, int_t minX, int_t minY );
1050186 3:9f857750e4e9 313 void putImageData ( Canvas2D_ImageClass imageData, int_t minX, int_t minY, int_t dirtyX, int_t dirtyY, int_t dirtyWidth, int_t dirtyHeight );
1050186 3:9f857750e4e9 314 void fillRect( int x, int y, int w, int h );
1050186 3:9f857750e4e9 315 Canvas2D_PatternClass createPattern( const graphics_image_t *image, const char *repetition );
1050186 3:9f857750e4e9 316 void beginPath();
1050186 3:9f857750e4e9 317 void rect( int_t minX, int_t minY, int_t width, int_t height );
1050186 3:9f857750e4e9 318 void clip();
1050186 3:9f857750e4e9 319
1050186 3:9f857750e4e9 320 void setTransform( graphics_matrix_float_t sx, graphics_matrix_float_t ky,
1050186 3:9f857750e4e9 321 graphics_matrix_float_t kx, graphics_matrix_float_t sy,
1050186 3:9f857750e4e9 322 graphics_matrix_float_t tx, graphics_matrix_float_t ty );
1050186 3:9f857750e4e9 323 void setTransform( graphics_matrix_other_float_t sx, graphics_matrix_other_float_t ky,
1050186 3:9f857750e4e9 324 graphics_matrix_other_float_t kx, graphics_matrix_other_float_t sy,
1050186 3:9f857750e4e9 325 graphics_matrix_other_float_t tx, graphics_matrix_other_float_t ty ) {
1050186 3:9f857750e4e9 326 setTransform( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) ky,
1050186 3:9f857750e4e9 327 (graphics_matrix_float_t) kx, (graphics_matrix_float_t) sy,
1050186 3:9f857750e4e9 328 (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty );
1050186 3:9f857750e4e9 329 }
1050186 3:9f857750e4e9 330 void setTransform( int_t sx, int_t ky, int_t kx, int_t sy, int_t tx, int_t ty ) {
1050186 3:9f857750e4e9 331 setTransform( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) ky,
1050186 3:9f857750e4e9 332 (graphics_matrix_float_t) kx, (graphics_matrix_float_t) sy,
1050186 3:9f857750e4e9 333 (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty );
1050186 3:9f857750e4e9 334 }
1050186 3:9f857750e4e9 335
1050186 3:9f857750e4e9 336 void translate( graphics_matrix_float_t tx, graphics_matrix_float_t ty );
1050186 3:9f857750e4e9 337 void translate( graphics_matrix_other_float_t tx, graphics_matrix_other_float_t ty ) {
1050186 3:9f857750e4e9 338 translate( (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty );
1050186 3:9f857750e4e9 339 }
1050186 3:9f857750e4e9 340 void translate( graphics_matrix_float_t tx, graphics_matrix_other_float_t ty ) {
1050186 3:9f857750e4e9 341 translate( tx, (graphics_matrix_float_t) ty );
1050186 3:9f857750e4e9 342 }
1050186 3:9f857750e4e9 343 void translate( graphics_matrix_other_float_t tx, graphics_matrix_float_t ty ) {
1050186 3:9f857750e4e9 344 translate( (graphics_matrix_float_t) tx, ty );
1050186 3:9f857750e4e9 345 }
1050186 3:9f857750e4e9 346 void translate( int_t tx, int_t ty ) {
1050186 3:9f857750e4e9 347 translate( (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty );
1050186 3:9f857750e4e9 348 }
1050186 3:9f857750e4e9 349
1050186 3:9f857750e4e9 350 void scale( graphics_matrix_float_t sx, graphics_matrix_float_t sy );
1050186 3:9f857750e4e9 351 void scale( graphics_matrix_other_float_t sx, graphics_matrix_other_float_t sy ) {
1050186 3:9f857750e4e9 352 scale( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) sy );
1050186 3:9f857750e4e9 353 }
1050186 3:9f857750e4e9 354 void scale( graphics_matrix_float_t sx, graphics_matrix_other_float_t sy ) {
1050186 3:9f857750e4e9 355 scale( sx, (graphics_matrix_float_t) sy );
1050186 3:9f857750e4e9 356 }
1050186 3:9f857750e4e9 357 void scale( graphics_matrix_other_float_t sx, graphics_matrix_float_t sy ) {
1050186 3:9f857750e4e9 358 scale( (graphics_matrix_float_t) sx, sy );
1050186 3:9f857750e4e9 359 }
1050186 3:9f857750e4e9 360 void scale( int_t sx, int_t sy ) {
1050186 3:9f857750e4e9 361 scale( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) sy );
1050186 3:9f857750e4e9 362 }
1050186 3:9f857750e4e9 363
1050186 3:9f857750e4e9 364 void rotate( graphics_matrix_float_t angle );
1050186 3:9f857750e4e9 365 void rotate( graphics_matrix_other_float_t angle ) {
1050186 3:9f857750e4e9 366 rotate( (graphics_matrix_float_t) angle );
1050186 3:9f857750e4e9 367 }
1050186 3:9f857750e4e9 368
1050186 3:9f857750e4e9 369 void transform( graphics_matrix_float_t sx, graphics_matrix_float_t ky,
1050186 3:9f857750e4e9 370 graphics_matrix_float_t kx, graphics_matrix_float_t sy,
1050186 3:9f857750e4e9 371 graphics_matrix_float_t tx, graphics_matrix_float_t ty );
1050186 3:9f857750e4e9 372 void transform( graphics_matrix_other_float_t sx, graphics_matrix_other_float_t ky,
1050186 3:9f857750e4e9 373 graphics_matrix_other_float_t kx, graphics_matrix_other_float_t sy,
1050186 3:9f857750e4e9 374 graphics_matrix_other_float_t tx, graphics_matrix_other_float_t ty ) {
1050186 3:9f857750e4e9 375 transform( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) ky,
1050186 3:9f857750e4e9 376 (graphics_matrix_float_t) kx, (graphics_matrix_float_t) sy,
1050186 3:9f857750e4e9 377 (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty );
1050186 3:9f857750e4e9 378 }
1050186 3:9f857750e4e9 379 void transform( int_t sx, int_t ky, int_t kx, int_t sy, int_t tx, int_t ty ) {
1050186 3:9f857750e4e9 380 transform( (graphics_matrix_float_t) sx, (graphics_matrix_float_t) ky,
1050186 3:9f857750e4e9 381 (graphics_matrix_float_t) kx, (graphics_matrix_float_t) sy,
1050186 3:9f857750e4e9 382 (graphics_matrix_float_t) tx, (graphics_matrix_float_t) ty );
1050186 3:9f857750e4e9 383 }
1050186 3:9f857750e4e9 384
1050186 3:9f857750e4e9 385
1050186 3:9f857750e4e9 386 /* "fillStyle" property */
1050186 3:9f857750e4e9 387 void Set_fillStyle( const char *Color );
1050186 3:9f857750e4e9 388 void Set_fillStyle( r8g8b8a8_t Color );
1050186 3:9f857750e4e9 389 void Set_fillStylePattern( const Canvas2D_PatternClass Pattern );
1050186 3:9f857750e4e9 390 #if 0
1050186 3:9f857750e4e9 391 void Set_fillStyleGradient( const Canvas2D_GradientClass Gradient );
1050186 3:9f857750e4e9 392 #endif
1050186 3:9f857750e4e9 393 class fillStyleProperty
1050186 3:9f857750e4e9 394 {
1050186 3:9f857750e4e9 395 public:
1050186 3:9f857750e4e9 396 inline void operator= ( const char *Color ) {
1050186 3:9f857750e4e9 397 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 398 (char *) this - offsetof( Canvas2D_ContextClass, fillStyle ) );
1050186 3:9f857750e4e9 399
1050186 3:9f857750e4e9 400 parent->Set_fillStyle( Color );
1050186 3:9f857750e4e9 401 }
1050186 3:9f857750e4e9 402 inline void operator= ( r8g8b8a8_t Color ) {
1050186 3:9f857750e4e9 403 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 404 (char *) this - offsetof( Canvas2D_ContextClass, fillStyle ) );
1050186 3:9f857750e4e9 405
1050186 3:9f857750e4e9 406 parent->Set_fillStyle( Color );
1050186 3:9f857750e4e9 407 }
1050186 3:9f857750e4e9 408 inline void operator= ( const Canvas2D_PatternClass Pattern ) {
1050186 3:9f857750e4e9 409 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 410 (char *) this - offsetof( Canvas2D_ContextClass, fillStyle ) );
1050186 3:9f857750e4e9 411
1050186 3:9f857750e4e9 412 parent->Set_fillStylePattern( Pattern );
1050186 3:9f857750e4e9 413 }
1050186 3:9f857750e4e9 414 #if 0
1050186 3:9f857750e4e9 415 inline void operator= ( const Canvas2D_GradientClass Gradient ) {
1050186 3:9f857750e4e9 416 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 417 (char *) this - offsetof( Canvas2D_ContextClass, fillStyle ) );
1050186 3:9f857750e4e9 418
1050186 3:9f857750e4e9 419 parent->Set_fillStyleGradient( Gradient );
1050186 3:9f857750e4e9 420 }
1050186 3:9f857750e4e9 421 #endif
1050186 3:9f857750e4e9 422 } fillStyle;
1050186 3:9f857750e4e9 423
1050186 3:9f857750e4e9 424
1050186 3:9f857750e4e9 425 /* "c_LanguageContext" property */
1050186 3:9f857750e4e9 426 class c_LanguageContextProperty
1050186 3:9f857750e4e9 427 {
1050186 3:9f857750e4e9 428 inline graphics_t *get_c_LanguageContext() {
1050186 3:9f857750e4e9 429 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 430 (char *) this - offsetof( Canvas2D_ContextClass, c_LanguageContext ) );
1050186 3:9f857750e4e9 431
1050186 3:9f857750e4e9 432 return parent->Entity->C_Graphics;
1050186 3:9f857750e4e9 433 }
1050186 3:9f857750e4e9 434 public:
1050186 3:9f857750e4e9 435
1050186 3:9f857750e4e9 436 inline operator graphics_t *() {
1050186 3:9f857750e4e9 437 return get_c_LanguageContext();
1050186 3:9f857750e4e9 438 }
1050186 3:9f857750e4e9 439 inline graphics_t *operator->() {
1050186 3:9f857750e4e9 440 return get_c_LanguageContext();
1050186 3:9f857750e4e9 441 }
1050186 3:9f857750e4e9 442 } c_LanguageContext;
1050186 3:9f857750e4e9 443
1050186 3:9f857750e4e9 444
1050186 3:9f857750e4e9 445 /* "globalAlpha" property */
1050186 3:9f857750e4e9 446 void set_globalAlpha( const float32_t alpha );
1050186 3:9f857750e4e9 447 float32_t get_globalAlpha();
1050186 3:9f857750e4e9 448 class globalAlphaProperty
1050186 3:9f857750e4e9 449 {
1050186 3:9f857750e4e9 450 public:
1050186 3:9f857750e4e9 451 inline void operator= ( const float32_t alpha ) {
1050186 3:9f857750e4e9 452 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 453 (char *) this - offsetof( Canvas2D_ContextClass, globalAlpha ) );
1050186 3:9f857750e4e9 454
1050186 3:9f857750e4e9 455 parent->set_globalAlpha( alpha );
1050186 3:9f857750e4e9 456 }
1050186 3:9f857750e4e9 457 inline void operator= ( const float64_t alpha ) {
1050186 3:9f857750e4e9 458 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 459 (char *) this - offsetof( Canvas2D_ContextClass, globalAlpha ) );
1050186 3:9f857750e4e9 460
1050186 3:9f857750e4e9 461 parent->set_globalAlpha( (float32_t) alpha );
1050186 3:9f857750e4e9 462 }
1050186 3:9f857750e4e9 463 inline operator float32_t() {
1050186 3:9f857750e4e9 464 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 465 (char *) this - offsetof( Canvas2D_ContextClass, globalAlpha ) );
1050186 3:9f857750e4e9 466
1050186 3:9f857750e4e9 467 return parent->get_globalAlpha();
1050186 3:9f857750e4e9 468 }
1050186 3:9f857750e4e9 469 } globalAlpha;
1050186 3:9f857750e4e9 470
1050186 3:9f857750e4e9 471
1050186 3:9f857750e4e9 472 /* "globalCompositeOperation" property */
1050186 3:9f857750e4e9 473 void set_globalCompositeOperation( const char *operation );
1050186 3:9f857750e4e9 474 char *get_globalCompositeOperation();
1050186 3:9f857750e4e9 475 class globalCompositeOperationProperty
1050186 3:9f857750e4e9 476 {
1050186 3:9f857750e4e9 477 public:
1050186 3:9f857750e4e9 478 inline void operator= ( const char *operation ) {
1050186 3:9f857750e4e9 479 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 480 (char *) this - offsetof( Canvas2D_ContextClass, globalCompositeOperation ) );
1050186 3:9f857750e4e9 481
1050186 3:9f857750e4e9 482 parent->set_globalCompositeOperation( operation );
1050186 3:9f857750e4e9 483 }
1050186 3:9f857750e4e9 484 inline operator char *() {
1050186 3:9f857750e4e9 485 Canvas2D_ContextClass *parent = (Canvas2D_ContextClass *)(
1050186 3:9f857750e4e9 486 (char *) this - offsetof( Canvas2D_ContextClass, globalCompositeOperation ) );
1050186 3:9f857750e4e9 487
1050186 3:9f857750e4e9 488 return parent->get_globalCompositeOperation();
1050186 3:9f857750e4e9 489 }
1050186 3:9f857750e4e9 490 } globalCompositeOperation;
1050186 3:9f857750e4e9 491
1050186 3:9f857750e4e9 492 };
1050186 3:9f857750e4e9 493
1050186 3:9f857750e4e9 494
1050186 3:9f857750e4e9 495 /***********************************************************************
1050186 3:9f857750e4e9 496 * Class: Canvas2D_ContextConfigClass
1050186 3:9f857750e4e9 497 ************************************************************************/
1050186 3:9f857750e4e9 498 struct Canvas2D_ContextConfigClass {
1050186 3:9f857750e4e9 499 frame_buffer_t *frame_buffer;
1050186 3:9f857750e4e9 500 bool_t is_fast_manual_flush;
1050186 3:9f857750e4e9 501
1050186 3:9f857750e4e9 502 Canvas2D_ContextConfigClass() {
1050186 3:9f857750e4e9 503 frame_buffer = NULL;
1050186 3:9f857750e4e9 504 is_fast_manual_flush = false;
1050186 3:9f857750e4e9 505 }
1050186 3:9f857750e4e9 506 };
1050186 3:9f857750e4e9 507
1050186 3:9f857750e4e9 508
1050186 3:9f857750e4e9 509 /***********************************************************************
1050186 3:9f857750e4e9 510 * Functions: Canvas2D_Constructers
1050186 3:9f857750e4e9 511 ************************************************************************/
1050186 3:9f857750e4e9 512 Canvas2D_ContextClass R_RGA_New_Canvas2D_ContextClass( frame_buffer_t *frame_buffer );
1050186 3:9f857750e4e9 513 Canvas2D_ContextClass R_RGA_New_Canvas2D_ContextClass( Canvas2D_ContextConfigClass &in_out_Config );
1050186 3:9f857750e4e9 514 Canvas2D_ImageClass R_RGA_New_Canvas2D_ImageClass();
1050186 3:9f857750e4e9 515
1050186 3:9f857750e4e9 516 #endif // RGA_CPP_H