⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 miscfunctions.c

📁 MTK6226修改平台UI的文件介绍
💻 C
📖 第 1 页 / 共 5 页
字号:
/* PMT HIMANSHU END 20050721 */
/* offset to (0,0)   */
polygon_vertex analog_clock_hour_hand_vertices[] = { {-0, 0},
{+0, 0},
{0, -ANALOG_CLOCK_HOURS_HAND_LENGTH},
};

/* offset to (0,0)   */
polygon_vertex analog_clock_minute_hand_vertices[] = { {-0, 0},
{+0, 0},
{0, -ANALOG_CLOCK_MINUTES_HAND_LENGTH},
};

/* PMT HIMANSHU START 20050721 */
#elif defined(__MMI_MAINLCD_240X320__)
/* offset to (0,0)   */
polygon_vertex analog_clock_hour_hand_vertices[] = { {-2, 0},
{+2, 0},
{0, -ANALOG_CLOCK_HOURS_HAND_LENGTH},
};

/* offset to (0,0)   */
polygon_vertex analog_clock_minute_hand_vertices[] = { {-1, 0},
{+1, 0},
{0, -ANALOG_CLOCK_MINUTES_HAND_LENGTH},
};
#endif 
/* PMT HIMANSHU END 20050721 */
#else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
/* PMT HIMANSHU END */
/* offset to (0,0)   */
polygon_vertex analog_clock_hour_hand_vertices[] = 
{
    {-3, 0},
    {+3, 0},
    {0, -ANALOG_CLOCK_HOURS_HAND_LENGTH},
};

/* offset to (0,0)   */
polygon_vertex analog_clock_minute_hand_vertices[] = 
{
    {-2, 0},
    {+2, 0},
    {0, -ANALOG_CLOCK_MINUTES_HAND_LENGTH},
};

/* PMT HIMANSHU START 20050625 */
#endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
/* PMT HIMANSHU END */

#ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
/* offset to (0,0)   */
polygon_vertex sub_analog_clock_hour_hand_vertices[] = 
{
    {-2, +1},
    {+2, +1},
    {0, -SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH},
};

/* offset to (0,0)   */
polygon_vertex sub_analog_clock_minute_hand_vertices[] = 
{
    {-2, 0},
    {+2, 0},
    {0, -SUB_ANALOG_CLOCK_MINUTES_HAND_LENGTH},
};
#endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 

/* Rotate about (0,0)   */


/*****************************************************************************
 * FUNCTION
 *  rotate_analog_clock_hand
 * DESCRIPTION
 *  
 * PARAMETERS
 *  vertices        [?]         
 *  minute          [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void rotate_analog_clock_hand(polygon_vertex vertices[], S32 minute)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    float cosa, sina, x, y;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    minute += 15;
    if (minute >= 60)
    {
        minute = minute - 60;
    }
    cosa = (float)acm_cosine_table[minute];
    sina = (float)acm_sine_table[minute];
    x = (float)vertices[0].x;
    y = (float)vertices[0].y;
    vertices[0].x = (S32) (x * cosa - y * sina);
    vertices[0].y = (S32) (x * sina + y * cosa);
    x = (float)vertices[1].x;
    y = (float)vertices[1].y;
    vertices[1].x = (S32) (x * cosa - y * sina);
    vertices[1].y = (S32) (x * sina + y * cosa);
    x = (float)vertices[2].x;
    y = (float)vertices[2].y;
    vertices[2].x = (S32) (x * cosa - y * sina);
    vertices[2].y = (S32) (x * sina + y * cosa);
}


/*****************************************************************************
 * FUNCTION
 *  analog_clock_draw_hand
 * DESCRIPTION
 *  
 * PARAMETERS
 *  type        [IN]        
 *  minute      [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void analog_clock_draw_hand(S32 type, S32 minute)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 radius;
    S32 x1 = ANALOG_CLOCK_CENTER_X;
    S32 y1 = ANALOG_CLOCK_CENTER_Y;
    S32 x2, y2;

#if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
    polygon_vertex vertices[3];
#endif 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
    if (GDI_LCD->act_handle == GDI_LCD_SUB_LCD_HANDLE)
    {
        x1 = SUB_ANALOG_CLOCK_CENTER_X;
        y1 = SUB_ANALOG_CLOCK_CENTER_Y;
        radius = SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH;
    }
    else
#endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
    {
        x1 = ANALOG_CLOCK_CENTER_X;
        y1 = ANALOG_CLOCK_CENTER_Y;
        radius = ANALOG_CLOCK_HOURS_HAND_LENGTH;
    }

    switch (type)
    {
        case 0:
        {
            color c = ANALOG_CLOCK_HOURS_HAND_COLOR;

        #if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
        #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
            if (GDI_LCD->act_handle == GDI_LCD_SUB_LCD_HANDLE)
            {
                vertices[0] = sub_analog_clock_hour_hand_vertices[0];
                vertices[1] = sub_analog_clock_hour_hand_vertices[1];
                vertices[2] = sub_analog_clock_hour_hand_vertices[2];
            }
            else
        #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
            {
                vertices[0] = analog_clock_hour_hand_vertices[0];
                vertices[1] = analog_clock_hour_hand_vertices[1];
                vertices[2] = analog_clock_hour_hand_vertices[2];
            }
            rotate_analog_clock_hand(vertices, minute);
            vertices[0].x += x1;
            vertices[0].y += y1;
            vertices[1].x += x1;
            vertices[1].y += y1;
            vertices[2].x += x1;
            vertices[2].y += y1;
            flat_triangle_fill(vertices, c);
            polygon_draw(vertices, 3, c);
        #elif(ANALOG_CLOCK_SMOOTHEN_LINES)
            x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
            y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
            UI_antialiased_line(x1, y1, x2, y2, c);
            UI_antialiased_line(x1 + 1, y1 + 1, x2 + 1, y2 + 1, c);
        #else 
            x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
            y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
            gui_wline(x1, y1, x2, y2, c, 3);
        #endif 
        }
            break;
        case 1:
        {
            color c = ANALOG_CLOCK_MINUTES_HAND_COLOR;

        #if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
        #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
            if (GDI_LCD->act_handle == GDI_LCD_SUB_LCD_HANDLE)
            {
                vertices[0] = sub_analog_clock_minute_hand_vertices[0];
                vertices[1] = sub_analog_clock_minute_hand_vertices[1];
                vertices[2] = sub_analog_clock_minute_hand_vertices[2];
            }
            else
        #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
            {
                vertices[0] = analog_clock_minute_hand_vertices[0];
                vertices[1] = analog_clock_minute_hand_vertices[1];
                vertices[2] = analog_clock_minute_hand_vertices[2];
            }
            rotate_analog_clock_hand(vertices, minute);
            vertices[0].x += x1;
            vertices[0].y += y1;
            vertices[1].x += x1;
            vertices[1].y += y1;
            vertices[2].x += x1;
            vertices[2].y += y1;
            flat_triangle_fill(vertices, c);
            polygon_draw(vertices, 3, c);
        #elif(ANALOG_CLOCK_SMOOTHEN_LINES)
            x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
            y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
            UI_antialiased_line(x1, y1, x2, y2, c);
        #else 
            x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
            y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
            gui_wline(x1, y1, x2, y2, c, 1);
        #endif 
        }
            break;
        case 2:
        {
            color c = ANALOG_CLOCK_SECONDS_HAND_COLOR;

        #if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
            x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
            y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
            gui_line(x1, y1, x2, y2, c);
        #elif(ANALOG_CLOCK_SMOOTHEN_LINES)
            x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
            y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
            UI_antialiased_line(x1, y1, x2, y2, c);
        #else 
            x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
            y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
            gui_line(x1, y1, x2, y2, c);
        #endif 
        }
            break;
    }
}

S32 analog_clock_hours_hand_counter = 0;
S32 analog_clock_minutes_hand_counter = 0;


/*****************************************************************************
 * FUNCTION
 *  show_analog_clock_dial
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void show_analog_clock_dial(void)
{   /* For removing warning
       S32   x1=ANALOG_CLOCK_DIAL_X;
       S32 y1=ANALOG_CLOCK_DIAL_Y;
       S32   x2=ANALOG_CLOCK_DIAL_X+ANALOG_CLOCK_DIAL_WIDTH-1;
       S32 y2=ANALOG_CLOCK_DIAL_Y+ANALOG_CLOCK_DIAL_HEIGHT-1; */
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* PMT HIMANSHU START 20050625 */
#ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
    gui_push_clip();
    gui_set_clip(
        ANALOG_BACKGROUND_X,
        ANALOG_BACKGROUND_Y,
        ANALOG_BACKGROUND_X + ANALOG_BACKGROUND_WIDTH - 1,
        ANALOG_BACKGROUND_Y + MMI_IDLESCREEN_BAR_HEIGHT - 1);
    //gui_show_image((ANALOG_CLOCK_DIAL_X), (ANALOG_CLOCK_DIAL_Y), get_image(IMG_TECHNO_ANALOG_CLOCK));
    gui_show_image(0, (ANALOG_BACKGROUND_Y), get_image(IMG_TECHNO_ANALOG_CLOCK));//070306 Alpha layer
#else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
    gui_reset_clip();
#endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 

    analog_clock_draw_hand(0, analog_clock_hours_hand_counter);
    analog_clock_draw_hand(1, analog_clock_minutes_hand_counter);

#if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
    if (GDI_LCD->act_handle == GDI_LCD_MAIN_LCD_HANDLE)
        /* PMT HIMANSHU START 20050625 */
#ifndef __MMI_UI_TECHNO_IDLESCREEN_BAR__
        gdi_image_draw_id(
            ANALOG_CLOCK_CENTER_X - 4,
            ANALOG_CLOCK_CENTER_Y - 4,
            NULL
            /*GUI_CLOCK_DOT_IMAGE_ID*/);    //zhangyan modified 20070522
#endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
    /* PMT HIMANSHU END */
#ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
    else
#if defined(__MMI_SUBLCD_COLOR__)
        gdi_image_draw_id(
            SUB_ANALOG_CLOCK_CENTER_X - 4,
            SUB_ANALOG_CLOCK_CENTER_Y - 4,
            GUI_CLOCK_DOT_IMAGE_ID);
#else /* defined(__MMI_SUBLCD_COLOR__) */ 
        gdi_draw_round_rect(
            SUB_ANALOG_CLOCK_CENTER_X - 3,
            SUB_ANALOG_CLOCK_CENTER_Y - 3,
            SUB_ANALOG_CLOCK_CENTER_X + 3,
            SUB_ANALOG_CLOCK_CENTER_Y + 3,
            GDI_COLOR_BLACK,
            GDI_COLOR_BLACK,
            2);
#endif /* defined(__MMI_SUBLCD_COLOR__) */ 
#endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
#endif /* (ANALOG_CLOCK_DRAW_POLYGON_HANDS) */ 

#ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
    gui_pop_clip();
#endif 
    /* PMT HIMANSHU END */
#if 0
/* under construction !*/
#endif /* 0 */ 
}


/*****************************************************************************
 * FUNCTION
 *  show_analog_clock
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void show_analog_clock(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    show_analog_clock_dial();
}


/*****************************************************************************
 * FUNCTION
 *  analog_clock_initialize
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void analog_clock_initialize(void)
{
    /*-----------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -