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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers frame_buffer_typedef.h Source File

frame_buffer_typedef.h

Go to the documentation of this file.
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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
00022 *******************************************************************************/
00023 /**
00024 * @file  frame_buffer_typedef.h
00025 * @brief   $Module: CLibCommon $ $PublicVersion: 1.00 $ (=CLIB_VERSION)
00026 * $Rev: 38 $
00027 * $Date:: 2014-03-18 16:14:45 +0900#$
00028 */
00029 
00030 #ifndef  FRAME_BUFFER_TYPEDEF_H
00031 #define  FRAME_BUFFER_TYPEDEF_H
00032 
00033 /******************************************************************************
00034 Includes   <System Includes> , "Project Includes"
00035 ******************************************************************************/
00036 #include  "Project_Config.h"
00037 #include  <stdint.h>
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif /* __cplusplus */
00042 
00043 
00044 /******************************************************************************
00045 Typedef definitions
00046 ******************************************************************************/
00047 
00048 /**
00049 * @typedef  byte_per_pixel_t
00050 * @brief  This can have shift value, if byte per pixel is less than 1
00051 */
00052 typedef int  byte_per_pixel_t;
00053 #ifdef  IS_WINDOW_SURFACES_EX
00054 enum {
00055     R_BYTE_PER_PIXEL_MASK  = 0xFF,  /*[R_BYTE_PER_PIXEL_MASK]*/
00056     R_BYTE_PER_PIXEL_SHIFT = 8      /*[R_BYTE_PER_PIXEL_SHIFT]*/
00057 };
00058 #endif
00059 
00060 
00061 /**
00062 * @typedef  frame_buffer_delegate_t
00063 * @brief  This is user defined variable. Library does not access it.
00064 */
00065 typedef void  frame_buffer_delegate_t;
00066 enum { /* int_fast32_t */  frame_buffer_t_max_buffer_count = 3 };
00067 
00068 
00069 /**
00070 * @enum   pixel_format_t
00071 * @brief  pixel_format_t
00072 *
00073 *    - PIXEL_FORMAT_UNKNOWN - 0,              0x00
00074 *    - PIXEL_FORMAT_ARGB8888 - 1,              0x01
00075 *    - PIXEL_FORMAT_RGB565 - 3,              0x03
00076 *    - PIXEL_FORMAT_ARGB4444 - 5,              0x05
00077 *    - PIXEL_FORMAT_A8 - 11,              0x0B
00078 *    - PIXEL_FORMAT_A4 - 14,              0x0E
00079 *    - PIXEL_FORMAT_A1 - 13,              0x0D
00080 *    - PIXEL_FORMAT_RGB888 - 15,              0x0F
00081 *    - PIXEL_FORMAT_R8G8B8A8 - 6 | (1 << 4),   0x16
00082 *    - PIXEL_FORMAT_XRGB8888 - 0 | (1 << 6),   0x40
00083 *    - PIXEL_FORMAT_ARGB1555 - 4 | (1 << 6),   0x10002
00084 *    - PIXEL_FORMAT_YCbCr422 - 2 | (1 << 16),  0x10002
00085 *    - PIXEL_FORMAT_YUV422 - 2 | (1 << 16),  0x10002
00086 *    - PIXEL_FORMAT_YUV422_GRAY_SCALE_IS_0x80 - 2 | (1 << 16),  0x10002
00087 *    - PIXEL_FORMAT_JPEG - 12 | (2 << 8),    0x20C
00088 *    - PIXEL_FORMAT_PNG - 12 | (3 << 8),    0x30C
00089 *    - PIXEL_FORMAT_GIF - 12 | (4 << 8),    0x40C
00090 *    - PIXEL_FORMAT_CLUT1 - 12 | (1 << 12),  0x100C
00091 *    - PIXEL_FORMAT_CLUT4 - 12 | (4 << 12),  0x400C
00092 *    - PIXEL_FORMAT_CLUT8 - 12 | (8 << 12)   0x800C
00093 */
00094 enum _pixel_format_t {
00095     PIXEL_FORMAT_UNKNOWN  =  0,
00096     PIXEL_FORMAT_ARGB8888 =  1,
00097     PIXEL_FORMAT_RGB565   =  3,
00098     PIXEL_FORMAT_ARGB4444 =  5,
00099     PIXEL_FORMAT_A8       = 11,
00100     PIXEL_FORMAT_A4       = 14,
00101     PIXEL_FORMAT_A1       = 13,
00102     PIXEL_FORMAT_RGB888   = 15,
00103     PIXEL_FORMAT_R8G8B8A8 =  6 | (1 << 4),
00104     PIXEL_FORMAT_XRGB8888 =  0 | (1 << 6),
00105     PIXEL_FORMAT_ARGB1555 =  4 | (1 << 6),
00106     PIXEL_FORMAT_YCbCr422 =  2 | (1 << 16),
00107     PIXEL_FORMAT_YUV422   =  2 | (1 << 16),
00108     PIXEL_FORMAT_YUV422_GRAY_SCALE_IS_0x80  = 2 | (1 << 16),
00109     PIXEL_FORMAT_JPEG     = 12 | (2 << 8),
00110     PIXEL_FORMAT_PNG      = 12 | (3 << 8),
00111     PIXEL_FORMAT_GIF      = 12 | (4 << 8),
00112     PIXEL_FORMAT_CLUT1    = 12 | (1 << 12),
00113     PIXEL_FORMAT_CLUT4    = 12 | (4 << 12),
00114     PIXEL_FORMAT_CLUT8    = 12 | (8 << 12)
00115 };
00116 typedef enum _pixel_format_t  pixel_format_t;
00117 
00118 
00119 /**
00120 * @struct  frame_buffer_t
00121 * @brief  frame_buffer_t
00122 */
00123 typedef struct st_frame_buffer_t  frame_buffer_t;
00124 struct st_frame_buffer_t {
00125 
00126     /** Cached address, [2] is Reserved */
00127     uint8_t          *buffer_address[ frame_buffer_t_max_buffer_count ];
00128 
00129     /** max is 2 */
00130     int_fast32_t      buffer_count;
00131 
00132     /** Index of "buffer_address" */
00133     int_fast32_t      show_buffer_index;
00134 
00135     /** Index of "buffer_address" */
00136     int_fast32_t      draw_buffer_index;
00137 
00138     /** width */
00139     int_fast32_t      width;
00140 
00141     /** check Stride and PixelFormat */
00142     byte_per_pixel_t  byte_per_pixel;
00143 
00144     /** byte to next bottom line */
00145     int_fast32_t      stride;
00146 
00147     /** height */
00148     int_fast32_t      height;
00149 
00150     /** pixel_format */
00151     pixel_format_t    pixel_format;
00152 
00153     /** delegate */
00154     frame_buffer_delegate_t  *delegate;
00155 };
00156 
00157 
00158 /**
00159 * @struct  r8g8b8a8_t
00160 * @brief  One of color type
00161 */
00162 #define  r8g8b8a8_t  r8g8b8a8_t
00163 typedef union st_r8g8b8a8_t  r8g8b8a8_t;
00164 union st_r8g8b8a8_t {
00165     struct {
00166 #if  BIT_FIELD_ENDIAN == BIT_FIELD_LITTLE_ENDIAN
00167 
00168         /** u */
00169         uint8_t  Red;
00170 
00171         /** u */
00172         uint8_t  Green;
00173 
00174         /** u */
00175         uint8_t  Blue;
00176 
00177         /** u */
00178         uint8_t  Alpha;
00179 #else
00180         uint8_t  Alpha;
00181         uint8_t  Blue;
00182         uint8_t  Green;
00183         uint8_t  Red;
00184 #endif
00185     } u;  /* 1st member "u" can be used by initializer */
00186 
00187     /** Value */
00188     uint32_t  Value;  /* This is depend on CPU endian. Use only copy or compare */
00189 };
00190 
00191 
00192 /**
00193 * @struct  argb8888_t
00194 * @brief  One of color type
00195 */
00196 #define        argb8888_t  argb8888_t
00197 typedef union _ARGB8888Type  argb8888_t;
00198 union _ARGB8888Type {
00199     uint32_t  Value;  /* CPU Endian. Not frame buffer endian */
00200     struct {
00201 #if BYTE_ENDIAN == BYTE_LITTLE_ENDIAN
00202 
00203         /** Blue is Value & 0x000000FF */
00204         uint8_t  Blue;
00205 
00206         /** u */
00207         uint8_t  Green;
00208 
00209         /** u */
00210         uint8_t  Red;
00211 
00212         /** u */
00213         uint8_t  Alpha;
00214 #else
00215         uint8_t  Alpha;
00216         uint8_t  Red;
00217         uint8_t  Green;
00218         uint8_t  Blue;   /* Blue is Value & 0x000000FF */
00219 #endif
00220     } u;
00221 };
00222 
00223 
00224 /**
00225 * @struct  xrgb8888_t
00226 * @brief  One of color type
00227 */
00228 #define        xrgb8888_t  xrgb8888_t
00229 typedef union _XRGB8888Type  xrgb8888_t;
00230 union _XRGB8888Type {
00231     uint32_t  Value;  /* CPU Endian. Not frame buffer endian */
00232     struct {
00233 #if BYTE_ENDIAN == BYTE_LITTLE_ENDIAN
00234 
00235         /** Blue is Value & 0x000000FF */
00236         uint8_t  Blue;
00237 
00238         /** u */
00239         uint8_t  Green;
00240 
00241         /** u */
00242         uint8_t  Red;
00243 
00244         /** u */
00245         uint8_t  X;      /* zero */
00246 #else
00247         uint8_t  X;      /* zero */
00248         uint8_t  Red;
00249         uint8_t  Green;
00250         uint8_t  Blue;   /* Blue is Value & 0x000000FF */
00251 #endif
00252     } u;
00253 };
00254 
00255 
00256 /**
00257 * @struct  rgb565_t
00258 * @brief  One of color type
00259 */
00260 #define        rgb565_t  rgb565_t
00261 typedef union _RGB565Type  rgb565_t;
00262 union _RGB565Type {
00263     uint16_t  Value;  /* CPU Endian. Not frame buffer endian */
00264     struct {
00265 #if  BIT_FIELD_ENDIAN == BIT_FIELD_LITTLE_ENDIAN
00266 
00267         /** Blue is at LSB */
00268         unsigned  Blue  : 5;
00269 
00270         /** u */
00271         unsigned  Green : 6;
00272 
00273         /** u */
00274         unsigned  Red   : 5;
00275 #else
00276         unsigned  Red   : 5;
00277         unsigned  Green : 6;
00278         unsigned  Blue  : 5;  /* Blue is at LSB */
00279 #endif
00280     } u;
00281 };
00282 
00283 
00284 /**
00285 * @struct  argb1555_t
00286 * @brief  One of color type
00287 */
00288 #define        argb1555_t  argb1555_t
00289 typedef union _ARGB1555Type  argb1555_t;
00290 union _ARGB1555Type {
00291     uint16_t  Value;  /* CPU Endian. Not frame buffer endian */
00292     struct {
00293 #if  BIT_FIELD_ENDIAN == BIT_FIELD_LITTLE_ENDIAN
00294 
00295         /** Blue is at LSB */
00296         unsigned  Blue  : 5;
00297 
00298         /** u */
00299         unsigned  Green : 5;
00300 
00301         /** u */
00302         unsigned  Red   : 5;
00303 
00304         /** u */
00305         unsigned  Alpha : 1;
00306 #else
00307         unsigned  Alpha : 1;
00308         unsigned  Red   : 5;
00309         unsigned  Green : 5;
00310         unsigned  Blue  : 5;  /* Blue is at LSB */
00311 #endif
00312     } u;
00313 };
00314 
00315 
00316 /**
00317 * @struct  argb4444_t
00318 * @brief  One of color type
00319 */
00320 #define        argb4444_t  argb4444_t
00321 typedef union _ARGB4444Type  argb4444_t;
00322 union _ARGB4444Type {
00323     uint16_t  Value;  /* CPU Endian. Not frame buffer endian */
00324     struct {
00325 #if  BIT_FIELD_ENDIAN == BIT_FIELD_LITTLE_ENDIAN
00326 
00327         /** Blue is at LSB */
00328         unsigned  Blue  : 4;
00329 
00330         /** u */
00331         unsigned  Green : 4;
00332 
00333         /** u */
00334         unsigned  Red   : 4;
00335 
00336         /** u */
00337         unsigned  Alpha : 4;
00338 #else
00339         unsigned  Alpha : 4;
00340         unsigned  Red   : 4;
00341         unsigned  Green : 4;
00342         unsigned  Blue  : 4;  /* Blue is at LSB */
00343 #endif
00344     } u;
00345 };
00346 
00347 
00348 /**
00349 * @struct  rgba8888_t
00350 * @brief  One of color type
00351 */
00352 #define        rgba8888_t  rgba8888_t
00353 typedef union _RGBA8888Type  rgba8888_t;
00354 union _RGBA8888Type {
00355     uint32_t  Value;  /* CPU Endian. Not frame buffer endian */
00356     struct {
00357 #if  BIT_FIELD_ENDIAN == BIT_FIELD_LITTLE_ENDIAN
00358 
00359         /** Alpha is at LSB */
00360         unsigned  Alpha : 8;
00361 
00362         /** u */
00363         unsigned  Blue  : 8;
00364 
00365         /** u */
00366         unsigned  Green : 8;
00367 
00368         /** u */
00369         unsigned  Red   : 8;
00370 #else
00371         unsigned  Red   : 8;
00372         unsigned  Green : 8;
00373         unsigned  Blue  : 8;
00374         unsigned  Alpha : 8;  /* Alpha is at LSB */
00375 #endif
00376     } u;
00377 };
00378 
00379 
00380 /**
00381 * @struct  y_cb_cr_422_t
00382 * @brief  Same as <yuv422_t>
00383 */
00384 /**
00385 * @struct  yuv422_t
00386 * @brief  One of color type
00387 */
00388 #define          y_cb_cr_422_t  y_cb_cr_422_t
00389 typedef union st_y_cb_cr_422_t  y_cb_cr_422_t;
00390 #define          yuv422_t       yuv422_t
00391 typedef union st_y_cb_cr_422_t  yuv422_t;
00392 union st_y_cb_cr_422_t {
00393     struct {
00394         /** U */
00395         uint8_t  Cb_01;
00396 
00397         /** u */
00398         uint8_t  Y_0;
00399 
00400         /** V */
00401         uint8_t  Cr_01;
00402 
00403         /** u */
00404         uint8_t  Y_1;
00405 
00406     } u;  /* 1st member "u" can be used by initializer */
00407 
00408     struct {
00409         /** uu */
00410         uint8_t  U_01;
00411 
00412         /** uu */
00413         uint8_t  Y_0;
00414 
00415         /** uu */
00416         uint8_t  V_01;
00417 
00418         /** uu */
00419         uint8_t  Y_1;
00420     } uu;
00421 
00422     uint32_t  Value;
00423 };
00424 
00425 
00426 /******************************************************************************
00427 Macro definitions
00428 ******************************************************************************/
00429 
00430 /* Section: Global */
00431 /**
00432 * @enum   E_CATEGORY_PIXEL_FORMAT
00433 * @brief  E_CATEGORY_PIXEL_FORMAT
00434 *
00435 *    - E_NOT_SUPPORTED_PIXEL_FORMAT - E_CATEGORY_PIXEL_FORMAT | 0x01
00436 */
00437 #ifndef  E_CATEGORY_PIXEL_FORMAT
00438 #define  E_CATEGORY_PIXEL_FORMAT  E_CATEGORY_PIXEL_FORMAT
00439 enum {   E_CATEGORY_PIXEL_FORMAT = 0x00009400 };
00440 #endif
00441 enum { E_NOT_SUPPORTED_PIXEL_FORMAT  = E_CATEGORY_PIXEL_FORMAT | 0x01 }; /* 0x9401 = 37889 */
00442 
00443 
00444 /******************************************************************************
00445 Variable Externs
00446 ******************************************************************************/
00447 
00448 /******************************************************************************
00449 Functions Prototypes
00450 ******************************************************************************/
00451 /* In "frame_buffer.h" */
00452 
00453 #ifdef __cplusplus
00454 }  /* extern "C" */
00455 #endif /* __cplusplus */
00456 
00457 #endif