Dear all,
I have been trying to use ugui library (used in RePhone Kit default application) with Arduino. First thing I need is a function that draws a point, so I wrapped method Lcd.draw_point from library LDisplay, but it doesn’t work.
After some research I discovered that drawing code in LDisplay/utility/Display.cpp
is commented out!
boolean lcd_draw_point(void* user_data)
{
point_info_struct* data = (point_info_struct*) user_data;
//vm_graphic_point_t frame_position[1] = {0, 0};
/*
vm_graphic_color_argb_t color;
color.a = 0;
color.r = ((data->PCulValue >> 16) & 0xff);
color.g = ((data->PCulValue >> 8) & 0xff);
color.b = (data->PCulValue & 0xff);
vm_graphic_set_color(color);
vm_graphic_draw_point(&g_frame, data->ulX, data->ulY);
*/
VMUINT16 *pbuf = (VMUINT16 *)g_frame.buffer;
pbuf += data->ulY * 240 + data->ulX;
*pbuf = ((data->PCulValue >> 8) & (0x1F << 11)) | ((data->PCulValue >> 5) & (0x3F << 5)) | ((data->PCulValue >> 3) & 0x1F);
vm_graphic_rotate_frame(&g_rotated_frame, &g_frame, VM_GRAPHIC_ROTATE_180);
//vm_graphic_blt_frame(g_frame_blt_group, frame_position, (VMINT)1);
return true;
}
I uncommented the central part and commented lines with “pbuf”, that I don’t now what they do, and now it works (warning: a call to Lcd.draw_updata() is needed after drawing points):
boolean lcd_draw_point(void* user_data)
{
point_info_struct* data = (point_info_struct*) user_data;
//vm_graphic_point_t frame_position[1] = {0, 0};
vm_graphic_color_argb_t color;
color.a = 0;
color.r = ((data->PCulValue >> 16) & 0xff);
color.g = ((data->PCulValue >> 8) & 0xff);
color.b = (data->PCulValue & 0xff);
vm_graphic_set_color(color);
vm_graphic_draw_point(&g_frame, data->ulX, data->ulY);
/*
VMUINT16 *pbuf = (VMUINT16 *)g_frame.buffer;
pbuf += data->ulY * 240 + data->ulX;
*pbuf = ((data->PCulValue >> 8) & (0x1F << 11)) | ((data->PCulValue >> 5) & (0x3F << 5)) | ((data->PCulValue >> 3) & 0x1F);
*/
vm_graphic_rotate_frame(&g_rotated_frame, &g_frame, VM_GRAPHIC_ROTATE_180);
//vm_graphic_blt_frame(g_frame_blt_group, frame_position, (VMINT)1);
return true;
}
Is it a real bug or I have missed something?
Best regards.