static void view_show_prompt (view_t *view, const char *prompt) { ply_boot_splash_plugin_t *plugin; int x, y; int entry_width, entry_height; assert (view != NULL); plugin = view->plugin; if (ply_entry_is_hidden (view->entry)) { unsigned long screen_width, screen_height; screen_width = ply_pixel_display_get_width (view->display); screen_height = ply_pixel_display_get_height (view->display); view->box_area.width = ply_image_get_width (plugin->box_image); view->box_area.height = ply_image_get_height (plugin->box_image); view->box_area.x = screen_width / 2.0 - view->box_area.width / 2.0; view->box_area.y = screen_height / 2.0 - view->box_area.height / 2.0; view->lock_area.width = ply_image_get_width (plugin->lock_image); view->lock_area.height = ply_image_get_height (plugin->lock_image); entry_width = ply_entry_get_width (view->entry); entry_height = ply_entry_get_height (view->entry); x = screen_width / 2.0 - (view->lock_area.width + entry_width) / 2.0 + view->lock_area.width; y = screen_height / 2.0 - entry_height / 2.0; view->lock_area.x = screen_width / 2.0 - (view->lock_area.width + entry_width) / 2.0; view->lock_area.y = screen_height / 2.0 - view->lock_area.height / 2.0; ply_entry_show (view->entry, plugin->loop, view->display, x, y); } if (prompt != NULL) { int label_width, label_height; ply_label_set_text (view->label, prompt); label_width = ply_label_get_width (view->label); label_height = ply_label_get_height (view->label); x = view->box_area.x + view->lock_area.width / 2; y = view->box_area.y + view->box_area.height; ply_label_show (view->label, view->display, x, y); } }
static void view_start_animation (view_t *view) { ply_boot_splash_plugin_t *plugin; unsigned long screen_width, screen_height; long width, height; long x,y; int number_of_frames; int yoffset = 0; assert (view != NULL); plugin = view->plugin; assert (plugin != NULL); assert (plugin->loop != NULL); screen_width = ply_pixel_display_get_width (view->display); screen_height = ply_pixel_display_get_height (view->display); ply_pixel_display_draw_area (view->display, 0, 0, screen_width, screen_height); if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN && plugin->shutdown_font != NULL && plugin->shutdown_text != NULL) { ply_label_set_text (view->shutdown_label, plugin->shutdown_text); ply_label_set_font (view->shutdown_label, plugin->shutdown_font); ply_label_set_color(view->shutdown_label, ((plugin->shutdown_color >> 16) & 0xff) / 255.0f, ((plugin->shutdown_color >> 8) & 0xff) / 255.0f, (plugin->shutdown_color & 0xff) / 255.0f, 1.0f); int label_width = screen_width; ply_label_set_width (view->shutdown_label, label_width); ply_label_set_alignment (view->shutdown_label, PLY_LABEL_ALIGN_CENTER); x = 0; y = screen_height / 2; ply_label_show (view->shutdown_label, view->display, x, y); yoffset = ply_label_get_height(view->shutdown_label) * 2; }
static void show_message (ply_boot_splash_plugin_t *plugin, const char *message) { ply_trace ("Showing message '%s'", message); ply_list_node_t *node; node = ply_list_get_first_node (plugin->views); while (node != NULL) { ply_list_node_t *next_node; view_t *view; view = ply_list_node_get_data (node); next_node = ply_list_get_next_node (plugin->views, node); ply_label_set_text (view->message_label, message); ply_label_show (view->message_label, view->display, 10, 10); ply_pixel_display_draw_area (view->display, 10, 10, ply_label_get_width (view->message_label), ply_label_get_height (view->message_label)); node = next_node; } }
void ply_entry_draw_area (ply_entry_t *entry, ply_pixel_buffer_t *pixel_buffer, long x, long y, unsigned long width, unsigned long height) { ply_rectangle_t bullet_area; ply_rectangle_t clip_area; ply_pixel_buffer_t *bullet_buffer, *text_field_buffer; int i, number_of_visible_bullets; if (entry->is_hidden) return; text_field_buffer = ply_image_get_buffer (entry->text_field_image); ply_pixel_buffer_fill_with_buffer (pixel_buffer, text_field_buffer, entry->area.x, entry->area.y); if (entry->is_password) { bullet_buffer = ply_image_get_buffer (entry->bullet_image); ply_pixel_buffer_get_size (bullet_buffer, &bullet_area); if (entry->number_of_bullets <= entry->max_number_of_visible_bullets) { number_of_visible_bullets = entry->number_of_bullets; } else { number_of_visible_bullets = entry->max_number_of_visible_bullets; /* We've got more bullets than we can show in the available space, so * draw a little half bullet to indicate some bullets are offscreen */ bullet_area.x = entry->area.x - bullet_area.width / 2.0; bullet_area.y = entry->area.y + entry->area.height / 2.0 - bullet_area.height / 2.0; clip_area = bullet_area; clip_area.x = entry->area.x; ply_pixel_buffer_fill_with_buffer_with_clip (pixel_buffer, bullet_buffer, bullet_area.x, bullet_area.y, &clip_area); } for (i = 0; i < number_of_visible_bullets; i++) { bullet_area.x = entry->area.x + i * bullet_area.width + bullet_area.width / 2.0; bullet_area.y = entry->area.y + entry->area.height / 2.0 - bullet_area.height / 2.0; ply_pixel_buffer_fill_with_buffer (pixel_buffer, bullet_buffer, bullet_area.x, bullet_area.y); } } else { ply_label_set_text (entry->label, entry->text); ply_label_show (entry->label, NULL, entry->area.x, entry->area.y + entry->area.height / 2 - ply_label_get_height (entry->label) / 2); ply_label_draw_area (entry->label, pixel_buffer, entry->area.x, entry->area.y, entry->area.width, entry->area.height); } }