wingui.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:231k
- /*******************************************************************************
- * Modification Notice:
- * --------------------------
- * This software is modified by MediaTek Inc. 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) 2005
- *
- * 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).
- *
- *******************************************************************************/
- /*******************************************************************************
- * Filename:
- * ---------
- * wingui.c
- *
- * Project:
- * --------
- * Maui_Software
- *
- * Description:
- * ------------
- * GUI related funtions
- *
- * Author:
- * -------
- * -------
- *
- *------------------------------------------------------------------------------
- * $Log$
- *
- * removed!
- * removed!
- * apply correct compile option: __MMI_RESOURCE_ENFB_SUPPORT__
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- * check in [NewFeature]MMI trace string
- *
- * removed!
- * removed!
- * Add gdi_image_estimate_show_fullscreen_time bypass function.
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- * Turn on backlight in the end of MMICheckDiskDisplay
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- *******************************************************************************/
- /******************************************************************************
- *
- * File: %P%
- * -----
- *
- * SCCS Version: %I%
- * -------------
- *
- * Copyright Statement:
- * --------------------
- *****************************************************************************/
- /**
- * Copyright Notice
- * (c) 2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
- * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
- * (It is illegal to remove this copyright notice from this software or any
- * portion of it)
- */
- /**********************************************************************************
- Filename: wingui.c
- Author: manju
- Date Created: September-03-2002
- Contains: OS / hardware driver interface for the UI
- Platform: Win32 / Hardware (Use the MMI_BUILD_TYPE flag)
- **********************************************************************************
- * Project:
- * --------
- *
- * Software Unit: MMI
- * --------------
- *
- * Description:
- * ------------
- *
- *
- * Modification History:
- * ---------------------
- * Date Vers Auth Details
- * ---- ---- ---- -------
- * 20040517 1.0 Leo Hu Initial version.
- */
- #include "mmi_features.h" /* for gdi_profile and sub_lcd setting */
- #include "PixcomFontengine.h"
- #include "pixteldatatypes.h"
- #include "globalconstants.h"
- #include "EventsGprot.h"
- #include "TimerEvents.h"
- #include "gui_config.h"
- #include "Bootup.h"
- #include "FileSystemDef.h"
- #include "UCS2prot.h"
- #include "gui_data_types.h"
- #include "gui.h"
- #include "gui_bytestream.h"
- #include "wgui_categories_defs.h"
- #include "kal_non_specific_general_types.h"
- #include "gdi_include.h" /* graphic lib */
- #include "gui_setting.h"
- #include "lcd_sw_rnd.h"
- #include "wgui_status_icons.h"
- #include "DebugInitDef.h"
- /* PMT VIKAS START 20051217 */
- #if defined (__MMI_UI_TRANSPARENT_EFFECT__) || defined (__MMI_UI_LIST_HIGHLIGHT_EFFECTS__) || defined (__MMI_UI_TRANSPARENT_EFFECT_IN_DALMATIAN_CALENDAR__) /* 072505 Calvin modified */
- #include"gd_primitive.h" /* for gd functions */
- #endif
- /* PMT VIKAS END 20051217 */
- /* bear - hardware only for LCD interface */
- #ifdef MMI_ON_HARDWARE_P
- /* lcd driver related */
- #include "kal_non_specific_general_types.h"
- #include "lcd_sw.h"
- #include "lcd_sw_inc.h"
- #include "lcd_if.h"
- #include "L4Dr.h"
- #endif /* MMI_ON_HARDWARE_P */
- #ifdef __MMI_SCREEN_ROTATE__
- #include "ScreenRotationGprot.h"
- #endif
- #if defined(__MMI_RESOURCE_ENFB_SUPPORT__)
- #include "ResMemMgrGprot.h"
- #endif /* __MMI_RESOURCE_ENFB_SUPPORT__ */
- /************************************************************************/
- /* Variable */
- /************************************************************************/
- /* Device bitmaps used for graphics contexts */
- /* Test valuse are used here and there for gui to determine use which LCD context */
- bitmap main_LCD_device_bitmap;
- bitmap sub_LCD_device_bitmap;
- bitmap *current_LCD_device_bitmap = NULL;
- bitmap *current_saved_LCD_device_bitmap = NULL;
- UI_font_type UI_font;
- color UI_current_text_color;
- /* Body in PixcomFontEngine - to draw a string */
- extern U32 ShowString(S32 x, S32 y, stFontAttribute Font, U8 BackGround, U8 *String, U32 LineHeight);
- #ifdef MMI_ON_HARDWARE_P
- extern kal_bool custom_cfg_gpio_set_level(kal_uint8 gpio_dev_type, kal_uint8 gpio_dev_level);
- #endif
- /* 1: Selects OS timer implementation. Timers are multiplexed by the OS */
- /* 0: Selects UI timer implementation. Timers are multiplexed by the UI */
- #define WINGUI_USE_OS_TIMERS 1
- #if(!WINGUI_USE_OS_TIMERS)
- #define UI_TIMER_RESOLUTION 100
- #endif
- /* actual body of these parameter is at gui_wrapper.c */
- extern S32 MAIN_LCD_device_width;
- extern S32 MAIN_LCD_device_height;
- #ifdef __MMI_SUBLCD__
- extern S32 SUB_LCD_device_width;
- extern S32 SUB_LCD_device_height;
- #endif /* __MMI_SUBLCD__ */
- extern U16 gCurrLangIndex; /* MTK Leo add 0106 */
- extern U16 *MainLCD_ShadowBuf_p;
- extern S16 MMI_status_icons_list1[];
- extern S16 MMI_status_icons_list2[];
- extern S16 MMI_status_icons_list3[];
- /* PMT VIKAS START 20050707 */
- #ifdef __MMI_UI_DALMATIAN_SOFTKEYS__
- extern void (*pixtel_shuffle_draw_background) (void);
- #endif
- #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
- extern BOOL line_draw; /* 20050412 modified */
- extern BOOL inline_bottom_line_draw; /* 20050412 modified */
- #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */
- /* PMT VIKAS END 20050707 */
- /************************************************************************/
- /* Function Pre-Declare */
- /************************************************************************/
- void UI_set_sub_LCD_graphics_context(void);
- void UI_set_main_LCD_graphics_context(void);
- void UI_putpixel(S32 x, S32 y, color c);
- void UI_putpixel_alpha(S32 x, S32 y, color c);
- void _show_transparent_image(S32 x, S32 y, U8 *image, UI_transparent_color_type t);
- void _animated_image_processor(void);
- U8 _show_animation_frame(S32 x, S32 y, U8 *image, S16 frame_number);
- U8 _show_transparent_animation_frame(S32 x, S32 y, U8 *image, UI_transparent_color_type t, S16 frame_number);
- void _show_animated_image(S32 x, S32 y, animated_image *a);
- animated_image *_show_animation(S32 x, S32 y, U8 *image);
- //animated_image* _show_transparent_animation(S32 x,S32 y,byte *image,UI_transparent_color_type t);//071205 Calvin removed
- //animated_image* _show_transparent_animation_frames(S32 x,S32 y,byte* image,UI_transparent_color_type t,S16 start_frame,S16 end_frame);//071205 Calvin removed
- void _load_animation_frames(U8 *image, animated_image *a);
- //void _hide_animated_image(animated_image *a);//071205 Calvin removed
- //void _set_hide_animated_image(animated_image *a,void (*f)(S32 x1,S32 y1,S32 x2,S32 y2));//071205 Calvin removed
- /************************************************************************/
- /* UnChanged Code */
- /************************************************************************/
- /* /// Vikram for WBMP */
- U8 Display_WBMP(S32 sx, S32 sy, FILE_HANDLE file);
- /* End */
- /*****************************************************************************
- * FUNCTION
- * _pfgetc
- * DESCRIPTION
- *
- * PARAMETERS
- * file [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 _pfgetc(FILE_HANDLE file)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (U8) pfgetc(file);
- }
- /*****************************************************************************
- * FUNCTION
- * _pfgetword
- * DESCRIPTION
- *
- * PARAMETERS
- * file [IN]
- * RETURNS
- *
- *****************************************************************************/
- U16 _pfgetword(FILE_HANDLE file)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 MSB, LSB;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- LSB = _pfgetc(file);
- MSB = _pfgetc(file);
- return ((U16) ((MSB << 8) | LSB));
- }
- /*****************************************************************************
- * FUNCTION
- * _pfgetdword
- * DESCRIPTION
- *
- * PARAMETERS
- * file [IN]
- * RETURNS
- *
- *****************************************************************************/
- U32 _pfgetdword(FILE_HANDLE file)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 MSB, LSB;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- LSB = _pfgetword(file);
- MSB = _pfgetword(file);
- return ((MSB << 16) | LSB);
- }
- #define _pfseek(file,offset,flags) pCacheFileSeek(file,offset,flags)
- #define _pfread(data,s1,s2,file)
- { S32 l;
- pCacheFileRead(file,s2,&l,data);
- }
- #define _pfsize(file) GetFSFileSize(file)
- #define _pfeof(file) IsEndOfCurrentFile()
- /*****************************************************************************
- * FUNCTION
- * UI_cross_hatch_fill_rectangle
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- static U32 UI_translate_gui_alpha_to_gdi_alpha(U8 alpha)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 alpha_value;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- alpha_value = (((U32)(alpha)) << 8) / 100;
- if (256 <= alpha_value)
- {
- alpha_value = 255;
- }
- return alpha_value;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_cross_hatch_fill_rectangle
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_cross_hatch_fill_rectangle(S32 x1, S32 y1, S32 x2, S32 y2, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_fill_dot_rect(x1,y1,x2,y2,gdi_act_color_from_rgb(UI_translate_gui_alpha_to_gdi_alpha(c.alpha),c.r,c.g,c.b));
- }
- /*****************************************************************************
- * FUNCTION
- * UI_alternate_cross_hatch_fill_rectangle
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c1 [IN]
- * c2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_alternate_cross_hatch_fill_rectangle(S32 x1, S32 y1, S32 x2, S32 y2, color c1, color c2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j, k = 0;
- U8 flag = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!((x2 - x1 + 1) % 2))
- {
- flag = 1;
- }
- for (j = y1; j <= y2; j++)
- {
- if (flag)
- {
- pixtel_toggle(k);
- }
- for (i = x1; i <= x2; i++)
- {
- if (k)
- {
- UI_putpixel(i, j, c1);
- }
- else
- {
- UI_putpixel(i, j, c2);
- }
- pixtel_toggle(k);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_hatch_fill_rectangle
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_hatch_fill_rectangle(S32 x1, S32 y1, S32 x2, S32 y2, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j, k = 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (j = y1; j <= y2; j++)
- {
- if (k)
- {
- for (i = x1; i <= x2; i++)
- {
- UI_putpixel(i, j, c);
- }
- }
- pixtel_toggle(k);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_alternate_hatch_fill_rectangle
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c1 [IN]
- * c2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_alternate_hatch_fill_rectangle(S32 x1, S32 y1, S32 x2, S32 y2, color c1, color c2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j, k = 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (j = y1; j <= y2; j++)
- {
- if (k)
- {
- for (i = x1; i <= x2; i++)
- {
- UI_putpixel(i, j, c1);
- }
- }
- else
- {
- for (i = x1; i <= x2; i++)
- {
- UI_putpixel(i, j, c2);
- }
- }
- pixtel_toggle(k);
- }
- }
- /* Line drawing algorithm */
- /* Bresenham line drawing routine */
- /*****************************************************************************
- * FUNCTION
- * UI_line_sign
- * DESCRIPTION
- *
- * PARAMETERS
- * a [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_line_sign(S32 a)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (a < 0)
- {
- return (-1);
- }
- else if (a > 0)
- {
- return (1);
- }
- else
- {
- return (0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_line
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_line(S32 x1, S32 y1, S32 x2, S32 y2, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 dx, dy, p, c1, c2, x, y, xinc, yinc, i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- dx = x2 - x1;
- dy = y2 - y1;
- xinc = UI_line_sign(dx);
- yinc = UI_line_sign(dy);
- dx = abs(dx);
- dy = abs(dy);
- x = x1;
- y = y1;
- if (dx >= dy)
- {
- p = (dy << 1) - dx;
- c1 = dy << 1;
- c2 = (dy - dx) << 1;
- for (i = 0; i <= dx; i++)
- {
- gui_putpixel(x, y, c);
- if (p < 0)
- {
- p += c1;
- }
- else
- {
- p += c2;
- y += yinc;
- }
- x += xinc;
- }
- }
- else
- {
- p = (dx << 1) - dy;
- c1 = dx << 1;
- c2 = (dx - dy) << 1;
- for (i = 0; i <= dy; i++)
- {
- gui_putpixel(x, y, c);
- if (p < 0)
- {
- p += c1;
- }
- else
- {
- p += c2;
- x += xinc;
- }
- y += yinc;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_wline
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * w [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_wline(S32 x1, S32 y1, S32 x2, S32 y2, color c, S32 w)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 dx, dy, p, c1, c2, x, y, xinc, yinc, i, j;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- dx = x2 - x1;
- dy = y2 - y1;
- xinc = UI_line_sign(dx);
- yinc = UI_line_sign(dy);
- dx = abs(dx);
- dy = abs(dy);
- x = x1;
- y = y1;
- if (dx >= dy)
- {
- p = (dy << 1) - dx;
- c1 = dy << 1;
- c2 = (dy - dx) << 1;
- for (i = 0; i <= dx; i++)
- {
- for (j = (w >> 1); j >= 0; j--)
- {
- gui_putpixel(x, y - j, c);
- gui_putpixel(x, y + j, c);
- }
- if (p < 0)
- {
- p += c1;
- }
- else
- {
- p += c2;
- y += yinc;
- }
- x += xinc;
- }
- }
- else
- {
- p = (dx << 1) - dy;
- c1 = dx << 1;
- c2 = (dx - dy) << 1;
- for (i = 0; i <= dy; i++)
- {
- for (j = (w >> 1); j >= 0; j--)
- {
- gui_putpixel(x + j, y, c);
- gui_putpixel(x - j, y, c);
- }
- if (p < 0)
- {
- p += c1;
- }
- else
- {
- p += c2;
- x += xinc;
- }
- y += yinc;
- }
- }
- }
- /* Available only for Main LCD */
- /*****************************************************************************
- * FUNCTION
- * UI_smooth_pixel
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_smooth_pixel(S32 x, S32 y, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- color ca = c;
- color cb = c;
- color cc = c;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ca.alpha = 100;
- cb.alpha = 40;
- cc.alpha = 20;
- UI_putpixel(x, y, ca);
- UI_putpixel(x - 1, y, cb);
- UI_putpixel(x + 1, y, cb);
- UI_putpixel(x, y - 1, cb);
- UI_putpixel(x, y + 1, cb);
- UI_putpixel(x - 1, y - 1, cc);
- UI_putpixel(x - 1, y + 1, cc);
- UI_putpixel(x + 1, y - 1, cc);
- UI_putpixel(x + 1, y + 1, cc);
- }
- /* Available only for Main LCD */
- /*****************************************************************************
- * FUNCTION
- * UI_smooth_wline
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * w [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_smooth_wline(S32 x1, S32 y1, S32 x2, S32 y2, color c, S32 w)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 dx, dy, p, c1, c2, x, y, xinc, yinc, i, j;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- dx = x2 - x1;
- dy = y2 - y1;
- xinc = UI_line_sign(dx);
- yinc = UI_line_sign(dy);
- dx = abs(dx);
- dy = abs(dy);
- x = x1;
- y = y1;
- if (dx >= dy)
- {
- p = (dy << 1) - dx;
- c1 = dy << 1;
- c2 = (dy - dx) << 1;
- for (i = 0; i <= dx; i++)
- {
- for (j = (w >> 1); j > 0; j--)
- {
- UI_smooth_pixel(x, y - j, c);
- UI_smooth_pixel(x, y + j, c);
- }
- UI_smooth_pixel(x, y, c);
- if (p < 0)
- {
- p += c1;
- }
- else
- {
- p += c2;
- y += yinc;
- }
- x += xinc;
- }
- }
- else
- {
- p = (dx << 1) - dy;
- c1 = dx << 1;
- c2 = (dx - dy) << 1;
- for (i = 0; i <= dy; i++)
- {
- for (j = (w >> 1); j > 0; j--)
- {
- UI_smooth_pixel(x + j, y, c);
- UI_smooth_pixel(x - j, y, c);
- }
- UI_smooth_pixel(x, y, c);
- if (p < 0)
- {
- p += c1;
- }
- else
- {
- p += c2;
- x += xinc;
- }
- y += yinc;
- }
- }
- }
- /* Wu antialiased line drawing algorithm */
- /* Uses fixed point math */
- #define _ALINE_SWAP(a,b)
- { S32 temp=a;
- a=b;
- b=temp;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_antialiased_line
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_antialiased_line(S32 x1, S32 y1, S32 x2, S32 y2, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x, y, x_inc, y_inc, dx, dy, px, py;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- dx = x2 - x1;
- dy = y2 - y1;
- /* PMT HIMANSHU START 20050625 */
- #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
- if (dx == 0 && dy == 0)
- {
- return;
- }
- #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- /* PMT HIMANSHU END */
- if (abs(dx) > abs(dy))
- {
- if (dx < 0)
- {
- dx = -dx;
- dy = -dy;
- _ALINE_SWAP(x1, x2);
- _ALINE_SWAP(y1, y2);
- }
- x = x1 << 16;
- y = y1 << 16;
- x_inc = 1 << 16;
- y_inc = (dy * 65536) / dx;
- while (1)
- {
- px = x >> 16;
- py = y >> 16;
- if (px >= x2)
- {
- break;
- }
- #ifndef __MMI_ALPHA_LAYER_SUPPORT__//070306 Alpha layer
- c.alpha = (U8) ((~y >> 8) & 0xff);
- #endif
- UI_putpixel_alpha(px, py, c);
- #ifndef __MMI_ALPHA_LAYER_SUPPORT__//070306 Alpha layer
- c.alpha = ((U8) (y >> 8) & 0xff);
- #endif
- UI_putpixel_alpha(px, py + 1, c);
- x += x_inc;
- y += y_inc;
- }
- }
- else
- {
- if (dy < 0)
- {
- dx = -dx;
- dy = -dy;
- _ALINE_SWAP(x1, x2);
- _ALINE_SWAP(y1, y2);
- }
- x = x1 << 16;
- y = y1 << 16;
- x_inc = (dx * 65536) / dy;
- y_inc = 1 << 16;
- while (1)
- {
- px = x >> 16;
- py = y >> 16;
- if (py >= y2)
- {
- break;
- }
- #ifndef __MMI_ALPHA_LAYER_SUPPORT__//070306 Alpha layer
- c.alpha = (U8) ((~x >> 8) & 0xff);
- #endif
- UI_putpixel_alpha(px, py, c);
- #ifndef __MMI_ALPHA_LAYER_SUPPORT__//070306 Alpha layer
- c.alpha = (U8) ((x >> 8) & 0xff);
- #endif
- UI_putpixel_alpha(px + 1, py, c);
- x += x_inc;
- y += y_inc;
- }
- }
- }
- /* Horizontal line drawing routine */
- /*****************************************************************************
- * FUNCTION
- * flat_triangle_horizontal_line
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * x2 [IN]
- * y [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void flat_triangle_horizontal_line(S32 x1, S32 x2, S32 y, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (x2 < x1)
- {
- _ALINE_SWAP(x1, x2);
- }
- for (x = x1 + 1; x <= x2; x++)
- {
- gui_putpixel(x, y, c);
- }
- }
- /* Flat polygon (triangle) fill routine */
- /*****************************************************************************
- * FUNCTION
- * flat_triangle_fill
- * DESCRIPTION
- *
- * PARAMETERS
- * vertices [?]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void flat_triangle_fill(polygon_vertex vertices[], color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 tx, ty;
- S32 bx, by;
- S32 mx, my;
- S32 y;
- float m1, m2;
- float x1, x2;
- color color_value = c;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (vertices[0].y < vertices[1].y)
- {
- tx = vertices[0].x;
- ty = vertices[0].y;
- bx = vertices[1].x;
- by = vertices[1].y;
- }
- else
- {
- tx = vertices[1].x;
- ty = vertices[1].y;
- bx = vertices[0].x;
- by = vertices[0].y;
- }
- if (vertices[2].y < ty)
- {
- mx = tx;
- my = ty;
- tx = vertices[2].x;
- ty = vertices[2].y;
- }
- else if (vertices[2].y > by)
- {
- mx = bx;
- my = by;
- bx = vertices[2].x;
- by = vertices[2].y;
- }
- else
- {
- mx = vertices[2].x;
- my = vertices[2].y;
- }
- m1 = ((float)(mx - tx)) / ((float)(my - ty));
- m2 = ((float)(bx - tx)) / ((float)(by - ty));
- x1 = (float)tx;
- x2 = (float)tx;
- if (mx < bx)
- {
- for (y = ty; y < my; y++)
- {
- flat_triangle_horizontal_line((S32) x1, (S32) x2, y, color_value);
- x1 = (float)x1 + (float)m1;
- x2 = (float)x2 + (float)m2;
- }
- x1 = (float)mx;
- m1 = ((float)(bx - mx)) / ((float)(by - my));
- for (y = my; y < by; y++)
- {
- flat_triangle_horizontal_line((S32) x1, (S32) x2, y, color_value);
- x1 = (float)x1 + (float)m1;
- x2 = (float)x2 + (float)m2;
- }
- }
- else
- {
- for (y = ty; y < my; y++)
- {
- flat_triangle_horizontal_line((S32) x2, (S32) x1, y, color_value);
- x1 = (float)x1 + (float)m1;
- x2 = (float)x2 + (float)m2;
- }
- x1 = (float)mx;
- m1 = ((float)(bx - mx)) / ((float)(by - my));
- for (y = my; y < by; y++)
- {
- flat_triangle_horizontal_line((S32) x2, (S32) x1, y, color_value);
- x1 = (float)x1 + (float)m1;
- x2 = (float)x2 + (float)m2;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * polygon_draw
- * DESCRIPTION
- *
- * PARAMETERS
- * vertices [?]
- * n_vertices [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void polygon_draw(polygon_vertex vertices[], S32 n_vertices, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (n_vertices < 3)
- {
- return;
- }
- for (i = 0; i < (n_vertices - 1); i++)
- {
- UI_antialiased_line(vertices[i].x, vertices[i].y, vertices[i + 1].x, vertices[i + 1].y, c);
- }
- UI_antialiased_line(vertices[i].x, vertices[i].y, vertices[0].x, vertices[0].y, c);
- }
- /* MTK Elvis */
- #define ARROW_HEIGHT 10 /* 8 */
- #define ARROW_WIDTH 5 /* 6//4 */
- /*****************************************************************************
- * FUNCTION
- * draw_arrow
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * arrow_type [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void draw_arrow(S32 x, S32 y, U8 arrow_type, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- polygon_vertex v[3];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (arrow_type)
- {
- case 0: /* Left */
- v[0].x = x + 0;
- v[0].y = y + (ARROW_HEIGHT >> 1);
- v[1].x = x + ARROW_WIDTH;
- v[1].y = y + 0;
- v[2].x = x + ARROW_WIDTH;
- v[2].y = y + ARROW_HEIGHT;
- flat_triangle_fill(v, c);
- break;
- case 1: /* Right */
- v[0].x = x + ARROW_WIDTH;
- v[0].y = y + (ARROW_HEIGHT >> 1);
- v[1].x = x + 0;
- v[1].y = y + 0;
- v[2].x = x + 0;
- v[2].y = y + ARROW_HEIGHT;
- flat_triangle_fill(v, c);
- break;
- case 2: /* Up */
- v[0].x = x + (ARROW_WIDTH >> 1);
- v[0].y = y + 0;
- v[1].x = x;
- v[1].y = y + ARROW_HEIGHT;
- v[2].x = x + ARROW_WIDTH;
- v[2].y = y + ARROW_HEIGHT;
- flat_triangle_fill(v, c);
- break;
- case 3: /* Down */
- v[0].x = x + (ARROW_WIDTH >> 1);
- v[0].y = y + ARROW_HEIGHT;
- v[1].x = x + 0;
- v[1].y = y + 0;
- v[2].x = x + ARROW_WIDTH;
- v[2].y = y + 0;
- flat_triangle_fill(v, c);
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * draw_resizeable_arrow
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * arrow_type [IN]
- * c [IN]
- * width [IN]
- * height [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void draw_resizeable_arrow(S32 x, S32 y, U8 arrow_type, color c, S32 width, S32 height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- polygon_vertex v[3];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (arrow_type)
- {
- case 0: /* Left */
- v[0].x = x + 0;
- v[0].y = y + (height >> 1);
- v[1].x = x + width;
- v[1].y = y + 0;
- v[2].x = x + width;
- v[2].y = y + height;
- flat_triangle_fill(v, c);
- break;
- case 1: /* Right */
- v[0].x = x + width;
- v[0].y = y + (height >> 1);
- v[1].x = x + 0;
- v[1].y = y + 0;
- v[2].x = x + 0;
- v[2].y = y + height;
- flat_triangle_fill(v, c);
- break;
- case 2: /* Up */
- v[0].x = x + (width >> 1);
- v[0].y = y + 0;
- v[1].x = x;
- v[1].y = y + height;
- v[2].x = x + width;
- v[2].y = y + height;
- flat_triangle_fill(v, c);
- break;
- case 3: /* Down */
- v[0].x = x + (width >> 1);
- v[0].y = y + height;
- v[1].x = x + 0;
- v[1].y = y + 0;
- v[2].x = x + width;
- v[2].y = y + 0;
- flat_triangle_fill(v, c);
- break;
- }
- }
- /* MTK end */
- /************************************************************************/
- /* UnUsed Code - designed change, these might be removed in the future */
- /************************************************************************/
- #define TEST_SUB_LCD_GRAPHICS_CONTEXT(gc) (((gc)==&sub_LCD_device_bitmap)?(1):(0))
- #define TEST_MAIN_LCD_GRAPHICS_CONTEXT(gc) (((gc)==&main_LCD_device_bitmap)?(1):(0))
- #define SWITCH_GRAPHICS_CONTEXT(gc, flag)
- { flag=0;
- if(current_LCD_device_bitmap!=gc)
- { flag=1;
- current_saved_LCD_device_bitmap=current_LCD_device_bitmap;
- if(gc==&sub_LCD_device_bitmap) UI_set_sub_LCD_graphics_context();
- else UI_set_main_LCD_graphics_context();
- }
- }
- #define RESTORE_GRAPHICS_CONTEXT(flag)
- { if(flag)
- { if(current_saved_LCD_device_bitmap==&sub_LCD_device_bitmap)
- UI_set_sub_LCD_graphics_context();
- else
- UI_set_main_LCD_graphics_context();
- }
- }
- #define GET_GRAPHICS_CONTEXT(gc) (gc)=(bitmap*)(current_LCD_device_bitmap);
- /************************************************************************/
- /* Usable Code */
- /************************************************************************/
- void (*_ui_text_putpixel) (S32 x, S32 y, color c);
- void (*_ui_text_putpixel_unconditional) (S32 x, S32 y, color c);
- /* This functions is extern by pixcomFontEngine.c */
- /* It set the actual draw color before calling ShowChar() */
- /*****************************************************************************
- * FUNCTION
- * UI_set_current_text_color
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_current_text_color(color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_current_text_color = c;
- }
- /************************************************************************/
- /* Primitive Drawing */
- /************************************************************************/
- /* Pixtel's Draw Primitive Function */
- /*****************************************************************************
- * FUNCTION
- * UI_putpixel
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_putpixel(S32 x, S32 y, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_draw_point(x, y, gdi_act_color_from_rgb(UI_translate_gui_alpha_to_gdi_alpha(c.alpha), c.r, c.g, c.b));
- }
- /*****************************************************************************
- * FUNCTION
- * UI_putpixel_alpha
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_putpixel_alpha(S32 x, S32 y, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_draw_point(x, y, gdi_act_color_from_rgb(UI_translate_gui_alpha_to_gdi_alpha(c.alpha), c.r, c.g, c.b));
- }
- /*****************************************************************************
- * FUNCTION
- * UI_draw_vertical_line
- * DESCRIPTION
- *
- * PARAMETERS
- * y1 [IN]
- * y2 [IN]
- * x [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_vertical_line(S32 y1, S32 y2, S32 x, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_draw_line(x, y1, x, y2, gdi_act_color_from_rgb(UI_translate_gui_alpha_to_gdi_alpha(c.alpha), c.r, c.g, c.b));
- }
- /*****************************************************************************
- * FUNCTION
- * UI_draw_horizontal_line
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * x2 [IN]
- * y [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_horizontal_line(S32 x1, S32 x2, S32 y, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_draw_line(x1, y, x2, y, gdi_act_color_from_rgb(UI_translate_gui_alpha_to_gdi_alpha(c.alpha), c.r, c.g, c.b));
- }
- /* MTK ISSUE 30 */
- /*****************************************************************************
- * FUNCTION
- * UI_draw_dotted_horizontal_line
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * x2 [IN]
- * y [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_dotted_horizontal_line(S32 x1, S32 x2, S32 y, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = x1; i <= x2; i = i + 3)
- {
- UI_putpixel(i, y, c);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_draw_dotted_vertical_line
- * DESCRIPTION
- *
- * PARAMETERS
- * y1 [IN]
- * y2 [IN]
- * x [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_dotted_vertical_line(S32 y1, S32 y2, S32 x, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* if (y1>y2) */
- for (i = y1; i <= y2; i = i + 3)
- {
- UI_putpixel(x, i, c);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_draw_dashed_horizontal_line
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * x2 [IN]
- * y [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_dashed_horizontal_line(S32 x1, S32 x2, S32 y, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = x1; i <= x2; i = i + 6)
- {
- UI_putpixel(i, y, c);
- if ((i + 1) > x2)
- {
- return;
- }
- UI_putpixel(i + 1, y, c);
- if ((i + 2) > x2)
- {
- return;
- }
- UI_putpixel(i + 2, y, c);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_draw_dashed_vertical_line
- * DESCRIPTION
- *
- * PARAMETERS
- * y1 [IN]
- * y2 [IN]
- * x [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_dashed_vertical_line(S32 y1, S32 y2, S32 x, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = y1; i <= y2; i = i + 6)
- {
- UI_putpixel(x, i, c);
- if ((i + 1) > y2)
- {
- return;
- }
- UI_putpixel(x, i + 1, c);
- if ((i + 2) > y2)
- {
- return;
- }
- UI_putpixel(x, i + 2, c);
- }
- }
- //MTK ISSUE 30 END
- //MTK ISSUE 30
- /*****************************************************************************
- * FUNCTION
- * UI_draw_dotted_rectangle
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_dotted_rectangle(S32 x1, S32 y1, S32 x2, S32 y2, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_draw_dotted_horizontal_line(x1, x2, y1, c);
- UI_draw_dotted_horizontal_line(x1, x2, y2, c);
- UI_draw_dotted_vertical_line(y1, y2, x1, c);
- UI_draw_dotted_vertical_line(y1, y2, x2, c);
- UI_putpixel(x2, y2, c);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_draw_dashed_rectangle
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_dashed_rectangle(S32 x1, S32 y1, S32 x2, S32 y2, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_draw_dashed_horizontal_line(x1, x2, y1, c);
- UI_draw_dashed_horizontal_line(x1, x2, y2, c);
- UI_draw_dashed_vertical_line(y1, y2, x1, c);
- UI_draw_dashed_vertical_line(y1, y2, x2, c);
- UI_putpixel(x2, y2, c);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_draw_horizontal_line_type
- * DESCRIPTION
- *
- * PARAMETERS
- * y1 [IN]
- * y2 [IN]
- * x [IN]
- * c [IN]
- * type_line [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_horizontal_line_type(S32 y1, S32 y2, S32 x, color c, S32 type_line)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type_line)
- {
- case 0: /* NORMAL */
- UI_draw_horizontal_line(y1, y2, x, c);
- break;
- case 1: /* DOTTED */
- UI_draw_dotted_horizontal_line(y1, y2, x, c);
- break;
- case 2: /* DASHED */
- UI_draw_dashed_horizontal_line(y1, y2, x, c);
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_draw_vertical_line_type
- * DESCRIPTION
- *
- * PARAMETERS
- * y1 [IN]
- * y2 [IN]
- * x [IN]
- * c [IN]
- * type_line [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_vertical_line_type(S32 y1, S32 y2, S32 x, color c, S32 type_line)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type_line)
- {
- case 0: /* NORMAL */
- UI_draw_vertical_line(y1, y2, x, c);
- break;
- case 1: /* DOTTED */
- UI_draw_dotted_vertical_line(y1, y2, x, c);
- break;
- case 2: /* DASHED */
- UI_draw_dashed_vertical_line(y1, y2, x, c);
- break;
- }
- }
- void UI_draw_rectangle(S32 x1, S32 y1, S32 x2, S32 y2, color c);
- /*****************************************************************************
- * FUNCTION
- * UI_draw_rectangle_type
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * type_line [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_rectangle_type(S32 x1, S32 y1, S32 x2, S32 y2, color c, S32 type_line)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type_line)
- {
- case 0:
- UI_draw_rectangle(x1, y1, x2, y2, c);
- break;
- case 1: /* dottted */
- UI_draw_dotted_rectangle(x1, y1, x2, y2, c);
- break;
- case 2: /* dashed */
- UI_draw_dashed_rectangle(x1, y1, x2, y2, c);
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_fill_rectangle
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_fill_rectangle(S32 x1, S32 y1, S32 x2, S32 y2, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_draw_solid_rect(x1, y1, x2, y2, gdi_act_color_from_rgb(UI_translate_gui_alpha_to_gdi_alpha(c.alpha), c.r, c.g, c.b));
- }
- /*****************************************************************************
- * FUNCTION
- * UI_draw_rectangle
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_draw_rectangle(S32 x1, S32 y1, S32 x2, S32 y2, color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_draw_rect(x1, y1, x2, y2, gdi_act_color_from_rgb(UI_translate_gui_alpha_to_gdi_alpha(c.alpha), c.r, c.g, c.b));
- }
- /*****************************************************************************
- * FUNCTION
- * UI_set_text_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_text_clip(S32 x1, S32 y1, S32 x2, S32 y2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* set clip region */
- gdi_layer_set_text_clip(x1, y1, x2, y2);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_set_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_clip(S32 x1, S32 y1, S32 x2, S32 y2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_set_clip(x1, y1, x2, y2);
- gdi_layer_get_clip(&x1, &y1, &x2, &y2);
- /* still keep UI_clip info for pixtel show image for file
- this shall be remove when integrate font into gdi_font */
- UI_clip_x1 = x1;
- UI_clip_y1 = y1;
- UI_clip_x2 = x2;
- UI_clip_y2 = y2;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_set_clip_with_bounding_box
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * bx1 [IN]
- * by1 [IN]
- * bx2 [IN]
- * by2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_clip_with_bounding_box(S32 x1, S32 y1, S32 x2, S32 y2, S32 bx1, S32 by1, S32 bx2, S32 by2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (x1 < bx1)
- {
- x1 = bx1;
- }
- if (y1 < by1)
- {
- y1 = by1;
- }
- if (x2 > bx2)
- {
- x2 = bx2;
- }
- if (y2 > by2)
- {
- y2 = by2;
- }
- UI_set_clip(x1, y1, x2, y2);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_reset_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_reset_clip(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_reset_clip();
- UI_clip_x1 = 0;
- UI_clip_y1 = 0;
- UI_clip_x2 = UI_device_width - 1;
- UI_clip_y2 = UI_device_height - 1;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_reset_text_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_reset_text_clip(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_reset_text_clip();
- }
- /*****************************************************************************
- * FUNCTION
- * UI_get_text_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [?]
- * y1 [?]
- * x2 [?]
- * y2 [?]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_get_text_clip(S32 *x1, S32 *y1, S32 *x2, S32 *y2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_get_text_clip(x1, y1, x2, y2);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_get_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [?]
- * y1 [?]
- * x2 [?]
- * y2 [?]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_get_clip(S32 *x1, S32 *y1, S32 *x2, S32 *y2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_get_clip(x1, y1, x2, y2);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_push_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_push_clip(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_push_clip();
- }
- /*****************************************************************************
- * FUNCTION
- * UI_pop_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_pop_clip(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_pop_clip();
- }
- /*****************************************************************************
- * FUNCTION
- * UI_push_text_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_push_text_clip(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_push_text_clip();
- }
- /*****************************************************************************
- * FUNCTION
- * UI_pop_text_clip
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_pop_text_clip(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_pop_text_clip();
- }
- /*****************************************************************************
- * FUNCTION
- * _read_image_length
- * DESCRIPTION
- *
- * PARAMETERS
- * image [?]
- * RETURNS
- *
- *****************************************************************************/
- S32 _read_image_length(U8 *image)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 rvalue = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (image == NULL)
- {
- return ((S32) 0);
- }
- else
- {
- rvalue |= (U32) (image[2]);
- rvalue |= (U32) ((U32) image[3] << 8);
- rvalue |= (U32) ((U32) image[4] << 16);
- rvalue |= (U32) ((U32) image[5] << 24);
- return ((S32) rvalue);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_set_text_clip_preset
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_text_clip_preset(S32 x1, S32 y1, S32 x2, S32 y2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 prev_x1, prev_y1, prev_x2, prev_y2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_get_text_clip(&prev_x1, &prev_y1, &prev_x2, &prev_y2);
- if (x1 > prev_x1)
- {
- prev_x1 = x1;
- }
- if (y1 > prev_y1)
- {
- prev_y1 = y1;
- }
- if (x2 < prev_x2)
- {
- prev_x2 = x2;
- }
- if (y2 < prev_y2)
- {
- prev_y2 = y2;
- }
- gdi_layer_set_text_clip(prev_x1, prev_y1, prev_x2, prev_y2);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_set_clip_preset
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_clip_preset(S32 x1, S32 y1, S32 x2, S32 y2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 prev_x1, prev_y1, prev_x2, prev_y2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_get_clip(&prev_x1, &prev_y1, &prev_x2, &prev_y2);
- if (x1 > prev_x1)
- {
- prev_x1 = x1;
- }
- if (y1 > prev_y1)
- {
- prev_y1 = y1;
- }
- if (x2 < prev_x2)
- {
- prev_x2 = x2;
- }
- if (y2 < prev_y2)
- {
- prev_y2 = y2;
- }
- gdi_layer_set_clip(prev_x1, prev_y1, prev_x2, prev_y2);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_set_font
- * DESCRIPTION
- *
- * PARAMETERS
- * f [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_font(UI_font_type f)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* Let UI_font point to &static_font instead of input parameter */
- static stFontAttribute static_font;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- static_font = *f;
- UI_font = &static_font;
- SetFont(static_font, 0);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_printf
- * DESCRIPTION
- *
- * PARAMETERS
- * format [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_printf(const S8 *format, ...)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 rvalue;
- U8 temp_buffer[1024];
- va_list l;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- va_start(l, format);
- rvalue = vsprintf((S8*) temp_buffer + (sizeof(temp_buffer) / 2) /* UI_printf_buffer */ , format, l);
- AnsiiToUnicodeString((S8*) temp_buffer, (S8*) temp_buffer + (sizeof(temp_buffer) / 2) /* UI_printf_buffer */ );
- UI_set_current_text_color(UI_text_color);
- ShowString(UI_text_x, UI_text_y, *UI_font, 0, (U8*) temp_buffer, UI_text_height);
- return (rvalue);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_sprintf
- * DESCRIPTION
- *
- * PARAMETERS
- * s [IN]
- * format [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_sprintf(UI_string_type s, const S8 *format, ...)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 rvalue;
- U8 temp_buffer[1024];
- va_list l;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- va_start(l, format);
- rvalue = vsprintf((S8*) temp_buffer, format, l);
- AnsiiToUnicodeString((S8*) s, (S8*) temp_buffer);
- return (rvalue);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_print_text
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_print_text(UI_string_type text)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (text == NULL)
- {
- return;
- }
- UI_set_current_text_color(UI_text_color);
- ShowString(UI_text_x, UI_text_y, *UI_font, 0, (U8*) text, UI_text_height);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_print_bordered_text
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_print_bordered_text(UI_string_type text)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (text == NULL)
- {
- return;
- }
- /* MTK Justin added to optimize the speed of bordered text */
- UI_set_current_text_color(UI_text_color);
- ShowStringBordered(UI_text_x, UI_text_y, *UI_font, 0, (U8*) text, UI_text_height);
- /* MTK Justin end */
- }
- /* MTK Terry Add to Support print n characters */
- /*****************************************************************************
- * FUNCTION
- * UI_print_text_n
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * n [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_print_text_n(UI_string_type text, int n)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (text == NULL)
- {
- return;
- }
- UI_set_current_text_color(UI_text_color);
- ShowString_n(UI_text_x, UI_text_y, *UI_font, 0, (U8*) text, n, UI_text_height);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_print_bordered_text_n
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * n [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_print_bordered_text_n(UI_string_type text, int n)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (text == NULL)
- {
- return;
- }
- UI_set_current_text_color(UI_text_color);
- ShowStringBordered_n(UI_text_x, UI_text_y, *UI_font, 0, (U8*) text, n, UI_text_height);
- }
- /* MTK end */
- /* MTK Leo add for bordered_character */
- /*****************************************************************************
- * FUNCTION
- * UI_print_bordered_character
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_print_bordered_character(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- //////////////////////////////////////
- //MTK Add By Elvis---2003/06/06 03:52? //
- //////////////////////////////////////
- U8 temp_buffer[4];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- temp_buffer[0] = (U8) c;
- temp_buffer[1] = (U8) (c >> 8);
- temp_buffer[2] = ' ';
- temp_buffer[3] = 0;
- UI_current_text_color = UI_text_color;
- ShowStringBordered(UI_text_x, UI_text_y, *UI_font, 0, (U8*) temp_buffer, 0);
- }
- /* MTK Leo end */
- /*****************************************************************************
- * FUNCTION
- * UI_print_character
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_print_character(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- //////////////////////////////////////
- //MTK Add By Elvis---2003/06/06 03:52? //
- //////////////////////////////////////
- U8 temp_buffer[4];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- temp_buffer[0] = (U8) c;
- temp_buffer[1] = (U8) (c >> 8);
- temp_buffer[2] = ' ';
- temp_buffer[3] = 0;
- UI_current_text_color = UI_text_color;
- ShowString(UI_text_x, UI_text_y, *UI_font, 0, (U8*) temp_buffer, 0);
- /* MTK end // */
- }
- /* MTK Elvis for stacked character */
- /*****************************************************************************
- * FUNCTION
- * UI_print_stacked_character
- * DESCRIPTION
- *
- * PARAMETERS
- * curCh [IN]
- * pre2Ch [IN]
- * preCh [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_print_stacked_character(UI_character_type curCh, UI_character_type pre2Ch, UI_character_type preCh)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_current_text_color = UI_text_color;
- ShowStackedChar(UI_text_x, UI_text_y, *UI_font, 0, curCh, 0, 0, pre2Ch, preCh);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_print_bordered_stacked_character
- * DESCRIPTION
- *
- * PARAMETERS
- * curCh [IN]
- * pre2Ch [IN]
- * preCh [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_print_bordered_stacked_character(UI_character_type curCh, UI_character_type pre2Ch, UI_character_type preCh)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_current_text_color = UI_text_color;
- ShowStackedChar(UI_text_x, UI_text_y, *UI_font, 0, curCh, 0, 1, pre2Ch, preCh);
- }
- /* MTK end */
- /*****************************************************************************
- * FUNCTION
- * UI_move_text_cursor
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_move_text_cursor(S32 x, S32 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_text_x = x;
- UI_text_y = y;
- UI_text_height = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_set_line_height
- * DESCRIPTION
- *
- * PARAMETERS
- * height [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_line_height(S32 height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_text_height = height;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_set_text_color
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_text_color(color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_text_color = c;
- UI_current_text_color = UI_text_color;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_set_text_border_color
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_set_text_border_color(color c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_text_border_color = c;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_malloc
- * DESCRIPTION
- *
- * PARAMETERS
- * size [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void *UI_malloc(size_t size)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (OslMalloc(size));
- }
- /*****************************************************************************
- * FUNCTION
- * UI_free
- * DESCRIPTION
- *
- * PARAMETERS
- * ptr [?]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_free(void *ptr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ptr != NULL)
- {
- OslMfree(ptr);
- }
- }
- /* MTK Leo add 1220 */
- /*****************************************************************************
- * FUNCTION
- * UI_get_font_height
- * DESCRIPTION
- *
- * PARAMETERS
- * f [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_get_font_height(UI_font_type f)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (Get_FontHeight(*f, (U8) gCurrLangIndex));
- }
- /*****************************************************************************
- * FUNCTION
- * UI_get_character_width
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_get_character_width(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 w, h;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_CharWidthHeight(c, &w, &h);
- return (w);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_get_character_height
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_get_character_height(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (Get_CharHeight());
- }
- /*****************************************************************************
- * FUNCTION
- * UI_measure_character
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * width [?]
- * height [?]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_measure_character(UI_character_type c, S32 *width, S32 *height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_CharWidthHeight(c, width, height);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_get_string_width
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_get_string_width(UI_string_type text)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 w, h;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_StringWidthHeight((U8*) text, &w, &h);
- return (w);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_get_string_height
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_get_string_height(UI_string_type text)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_UNUSED_PARAMETER(text);
- return (Get_CharHeight());
- }
- /*****************************************************************************
- * FUNCTION
- * UI_measure_string
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * width [?]
- * height [?]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_measure_string(UI_string_type text, S32 *width, S32 *height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_StringWidthHeight((U8*) text, width, height);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_get_string_width_n
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * n [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_get_string_width_n(UI_string_type text, S32 n)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 w, h;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_StringWidthHeight_n((U8*) text, n, &w, &h);
- return (w);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_get_string_width_w
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * w [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_get_string_width_w(UI_string_type text, S32 w)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 sw, sh;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_StringWidthHeight_w((U8*) text, w, &sw, &sh);
- return (sw);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_get_string_width_wn
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * w [IN]
- * n [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_get_string_width_wn(UI_string_type text, S32 w, S32 n)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 sw, sh;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_StringWidthHeight_wn((U8*) text, w, n, &sw, &sh);
- return (sw);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_measure_string_n
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * n [IN]
- * width [?]
- * height [?]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_measure_string_n(UI_string_type text, S32 n, S32 *width, S32 *height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_StringWidthHeight_n((U8*) text, n, width, height);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_measure_string_w
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * w [IN]
- * width [?]
- * height [?]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_measure_string_w(UI_string_type text, S32 w, S32 *width, S32 *height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_StringWidthHeight_w((U8*) text, w, width, height);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_measure_string_wn
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * w [IN]
- * n [IN]
- * width [?]
- * height [?]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_measure_string_wn(UI_string_type text, S32 w, S32 n, S32 *width, S32 *height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Get_StringWidthHeight_wn((U8*) text, w, n, width, height);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_strlen
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_strlen(UI_string_type text)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (text == NULL)
- {
- return (0);
- }
- else
- {
- return (UCS2Strlen((S8*) text));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_strcpy
- * DESCRIPTION
- *
- * PARAMETERS
- * text1 [IN]
- * text2 [IN]
- * RETURNS
- *
- *****************************************************************************/
- UI_string_type UI_strcpy(UI_string_type text1, UI_string_type text2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((text1 == NULL) || (text2 == NULL))
- {
- return (NULL);
- }
- else
- {
- return ((UI_string_type) UCS2Strcpy((S8*) text1, (S8*) text2));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_strncpy
- * DESCRIPTION
- *
- * PARAMETERS
- * text1 [IN]
- * text2 [IN]
- * n [IN]
- * RETURNS
- *
- *****************************************************************************/
- UI_string_type UI_strncpy(UI_string_type text1, UI_string_type text2, S32 n)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((text1 == NULL) || (text2 == NULL))
- {
- return (NULL);
- }
- else
- {
- return ((UI_string_type) UCS2Strncpy((S8*) text1, (S8*) text2, n));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_strcat
- * DESCRIPTION
- *
- * PARAMETERS
- * text1 [IN]
- * text2 [IN]
- * RETURNS
- *
- *****************************************************************************/
- UI_string_type UI_strcat(UI_string_type text1, UI_string_type text2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((text1 == NULL) || (text2 == NULL))
- {
- return (NULL);
- }
- else
- {
- return ((UI_string_type) UCS2Strcat((S8*) text1, (S8*) text2));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_strcmp
- * DESCRIPTION
- *
- * PARAMETERS
- * text1 [IN]
- * text2 [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_strcmp(UI_string_type text1, UI_string_type text2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((text1 == NULL) || (text2 == NULL))
- {
- return (-1);
- }
- else
- {
- return (UCS2Strcmp((S8*) text1, (S8*) text2));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_strncmp
- * DESCRIPTION
- *
- * PARAMETERS
- * text1 [IN]
- * text2 [IN]
- * n [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_strncmp(UI_string_type text1, UI_string_type text2, S32 n)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((text1 == NULL) || (text2 == NULL))
- {
- return (-1);
- }
- else
- {
- return (UCS2Strncmp((S8*) text1, (S8*) text2, n));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_memcpy
- * DESCRIPTION
- *
- * PARAMETERS
- * d [?]
- * s [IN]
- * n [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void *UI_memcpy(void *d, const void *s, S32 n)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (memcpy(d, s, n));
- }
- /*****************************************************************************
- * FUNCTION
- * HW_itoa
- * DESCRIPTION
- *
- * PARAMETERS
- * value [IN]
- * s [?]
- * radix [IN]
- * RETURNS
- *
- *****************************************************************************/
- S8 *HW_itoa(S32 value, S8 *s, S32 radix)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (s == NULL)
- {
- return (NULL);
- }
- else
- {
- /* JL/Pluto */
- #define LEN 20
- U8 *temp;
- U32 rem;
- static U8 rev[LEN + 1];
- rev[LEN] = 0;
- if (value == 0)
- {
- (s)[0] = '0';
- ++(s);
- (s)[0] = ' ';
- return s;
- }
- temp = &rev[LEN];
- while (value)
- {
- rem = value % radix;
- if (rem < 10)
- {
- *--temp = (U8) (rem + '0');
- }
- else if (radix == 16)
- {
- *--temp = "abcdef"[rem - 10];
- }
- value /= radix;
- }
- while (*temp)
- {
- (s)[0] = *temp++;
- ++(s);
- }
- (s)[0] = ' ';
- return s;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_itoa
- * DESCRIPTION
- *
- * PARAMETERS
- * value [IN]
- * s [IN]
- * radix [IN]
- * RETURNS
- *
- *****************************************************************************/
- UI_string_type UI_itoa(S32 value, UI_string_type s, S32 radix)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (s == NULL)
- {
- return (NULL);
- }
- else
- {
- S8 ts[32];
- HW_itoa(value, ts, radix);
- AnsiiToUnicodeString((S8*) s, (S8*) ts);
- return (s);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * hw_atoi
- * DESCRIPTION
- *
- * PARAMETERS
- * s [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 hw_atoi(const S8 *s)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 n = 0;
- S32 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (s[i] != ' ')
- {
- n *= 10;
- n += s[i] - '0';
- i++;
- }
- return n;
- }
- /*****************************************************************************
- * FUNCTION
- * HW_atoi
- * DESCRIPTION
- *
- * PARAMETERS
- * s [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 HW_atoi(const S8 *s)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 n = 0;
- S32 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (s[i] != ' ')
- {
- n *= 10;
- n += s[i] - '0';
- i++;
- }
- return n;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_atoi
- * DESCRIPTION
- *
- * PARAMETERS
- * s [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 UI_atoi(UI_string_type s)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 ts[32];
- S32 conv;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (s == NULL)
- {
- return (0);
- }
- else
- {
- UnicodeToAnsii(ts, (S8*) s);
- conv = HW_atoi((S8*) ts);
- return (conv);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * UI_transparent_color
- * DESCRIPTION
- *
- * PARAMETERS
- * r [IN]
- * g [IN]
- * b [IN]
- * RETURNS
- *
- *****************************************************************************/
- UI_transparent_color_type UI_transparent_color(U8 r, U8 g, U8 b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/