/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2006
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
#ifndef VMGRAPHIC_H_
#define VMGRAPHIC_H_
#include "vmsys.h"
#ifdef __cplusplus
extern "C" {
#endif
/* GDI return code */
typedef enum
{
VM_GDI_ERR_BASE_LAYER_EXIST = -17, //baselayer exist when set wallpaper
VM_GDI_FONTSIZE_NOT_SUPPORT = -16, //self define size not support
VM_GDI_ERR_NOT_SUPPORT_ROTATE = -15,
VM_GDI_MIBR_ERR = -14, /*general MIBR error*/
VM_GDI_MIBR_RES_ERR, /*GDI MIBR resource error*/
VM_GDI_MIBR_NOT_FORE, /*APP is not in foreground status*/
VM_GDI_MIBR_NO_RES, /*no resource */
VM_GDI_ERR_PLATFORM_DECODE_FAILED, /*platform decode error*/
VM_GDI_ERR_BASE_LAYER_NOT_EXIST, /*base layer not exist*/
VM_GDI_ERR_UNSUPPORT_IMAGE_TYPE, /*decode image type no support*/
VM_GDI_ERR_MALLOC_FAILED, /*can not malloc memory*/
VM_GDI_ERR_LAYER_BIND, /*layer bind with canvas error*/
VM_GDI_ERR_FREE_RES, /*free resource error*/
VM_GDI_ERR_CREATE_LAYER_FAILED, /*create layer fail*/
VM_GDI_ERR_CREATE_CANVAS_FAILED, /*general MIBR fail*/
VM_GDI_ERR_WRONG_PARAM, /*parameter error*/
VM_GDI_FAILED, /*general GDI error*/
VM_GDI_SUCCEED /*general GDI succeed*/
}vm_graphic_result;
/*GDI rotate type*/
typedef enum
{
VM_GDI_ROTATE_NORMAL = 0, /*rotate 0 degree*/
VM_GDI_ROTATE_90 = 0x01, /*rotate 90 degree*/
VM_GDI_ROTATE_180 = 0x02, /*rotate 180 degree*/
VM_GDI_ROTATE_270 = 0x03, /*rotate 270 degree*/
VM_GDI_MIRROR = 0x80, /*mirror*/
VM_GDI_MIRROR_ROTATE_90 = 0x81,/*mirror 90 degree*/
VM_GDI_MIRROR_ROTATE_180 = 0x82,/*mirror 180 degree*/
VM_GDI_MIRROR_ROTATE_270 = 0x83/*mirror 270 degree*/
}vm_graphic_rotate_value;
/*GDI gradient paint style*/
typedef enum
{
VM_GDI_GP_HOR = 0, /*horizon*/
VM_GDI_GP_VER, /*vertical*/
VM_GDI_GP_DIA, /*lean 45 degree */
VM_GDI_GP_DIA_INV, /*de-lean 45 degree*/
VM_GDI_GP_FLIP /*from middle to edge*/
}vm_graphic_gp_style;
/*screen rotate type enum*/
typedef enum
{
VM_GRAPHIC_SCREEN_ROTATE_0=0,
VM_GRAPHIC_SCREEN_ROTATE_90,//1
VM_GRAPHIC_SCREEN_ROTATE_180,//2
VM_GRAPHIC_SCREEN_ROTATE_270,//3
VM_GRAPHIC_SCREEN_ROTATE_MIRROR_0,//4
VM_GRAPHIC_SCREEN_ROTATE_MIRROR_90,//5
VM_GRAPHIC_SCREEN_ROTATE_MIRROR_180,//6
VM_GRAPHIC_SCREEN_ROTATE_MIRROR_270,//7
VM_GRAPHIC_SCREEN_ROTATE_MAX_TYPE//8
} vm_graphic_screen_rotate_value;
/*
*This macro is not work now,just keep for compatibility.
*/
#define MAX_BLT_LAYER (4)
/* GDI_RESULT define*/
#define VM_GDI_RESULT VMINT
/* GDI_HANDLE define*/
#define VM_GDI_HANDLE VMINT
/* max layer width*/
#define MAX_LAYER_WIDTH (65535)
/*max layer height*/
#define MAX_LAYER_HEIGHT (65535)
/*max layer count*/
#define MAX_LAYER (16)
/*max layer number when flatten to other layer or canvas*/
#define MAX_FLATTEN_LAYER (4)
/*max multiples when enlarge image */
#define MAX_PIXEL_ENLARGE (512)
/*the offset from the canvas beginning to the image data*/
#define CANVAS_BUF_OFFSET (VM_CANVAS_SIGNATURE_SIZE + VM_CANVAS_FRAME_PROPERTY_SIZE)
/*layer or canvas attribute: no transparent color*/
#define VM_NO_TRANS_COLOR (-1)
/* RGB565 white color */
#define VM_COLOR_WHITE (0XFFFF)
/* RGB565 black color */
#define VM_COLOR_BLACK (0X0000)
/* RGB565 red color */
#define VM_COLOR_RED (0XF800)
/* RGB565 green color */
#define VM_COLOR_GREEN (0X07E0)
/* RGB565 blue color */
#define VM_COLOR_BLUE (0X001F)
/* get color value from RGB value */
#define VM_RGB(r, g, b) ((b << 16) + (g << 8) + r)
/* get 565 color from a value of int type */
#define VM_COLOR_INT_TO_565(i) ((i & 0xf8) << 8) + ((i & 0xfc00) >> 5) + ((i & 0xf80000) >> 19)
/* convert color format from 888 to 565 */
#define VM_COLOR_888_TO_565(r, g, b) (((r & 0xf8) + ((g & 0xe0) >> 5)) << 8) + ((g & 0x1c) << 3) + (b >> 3)
/* convert color format from 565 to 888 */
#define VM_COLOR_565_TO_888(color16) ((color16 & 0x001F) << 19) + ((color16 & 0x07E0) << 5) + ((color16 & 0xF800) >> 8)
/* get Red value from a rgb value */
#define VM_COLOR_GET_RED(color16) ((color16 & 0xF800) >> 8)
/* get Green value from a rgb value */
#define VM_COLOR_GET_GREEN(color16) ((color16 & 0x07E0) >> 3)
/* get Blue value from a rgb value */
#define VM_COLOR_GET_BLUE(color16) ((color16 & 0x001F) << 3)
typedef void (*vm_graphic_screen_rotate_event_callback)(VMINT, VMINT); // 1:envent 2:inside/outside|| horizontal/vertical
/*clip region*/
typedef struct clip_rect{
VMINT16 left; /*x offset at begin*/
VMINT16 top; /*y offset at begin*/
VMINT16 right; /*x offset at end*/
VMINT16 bottom; /*y offset at end*/
VMBYTE flag; /* flag = 0: the clip region is invalid; flag =1: the clip region is valid*/
}clip_rect;
/* single frame info for gif image */
struct frame_prop
{
VMUINT8 flag; /* marker to show it is frame beginning */
VMUINT16 left; /* x offset */
VMUINT16 top; /* y offset */
VMUINT16 width; /*image width */
VMUINT16 height; /* image height*/
VMUINT16 delay_time; /* the interval between two frames*/
VMUINT8 trans_color_index; /* reserved*/
VMUINT16 trans_color; /* transparent color*/
VMUINT32 offset; /* current frame size , unit:byte */
};
/*image property*/
typedef struct _vm_graphic_imgprop
{
VMINT width; /*image widtg*/
VMINT height; /*image height*/
}vm_graphic_imgprop;
/*character infomation*/
typedef struct _vm_graphic_char_info
{
VMINT dwidth; /*the real width of the