static ply_boot_splash_plugin_t * create_plugin (ply_key_file_t *key_file) { ply_boot_splash_plugin_t *plugin; char *image_dir, *image_path; srand ((int) ply_get_timestamp ()); plugin = calloc (1, sizeof(ply_boot_splash_plugin_t)); plugin->start_time = 0.0; plugin->logo_image = ply_image_new (PLYMOUTH_LOGO_FILE); image_dir = ply_key_file_get_value (key_file, "fade-throbber", "ImageDir"); asprintf (&image_path, "%s/star.png", image_dir); plugin->star_image = ply_image_new (image_path); free (image_path); asprintf (&image_path, "%s/lock.png", image_dir); plugin->lock_image = ply_image_new (image_path); free (image_path); plugin->image_dir = image_dir; plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL; plugin->views = ply_list_new (); return plugin; }
static ply_boot_splash_plugin_t * create_plugin (ply_key_file_t *key_file) { ply_boot_splash_plugin_t *plugin; char *image_dir, *image_path; srand ((int) ply_get_timestamp ()); plugin = calloc (1, sizeof (ply_boot_splash_plugin_t)); plugin->logo_image = ply_image_new (PLYMOUTH_LOGO_FILE); image_dir = ply_key_file_get_value (key_file, "throbgress", "ImageDir"); asprintf (&image_path, "%s/lock.png", image_dir); plugin->lock_image = ply_image_new (image_path); free (image_path); asprintf (&image_path, "%s/box.png", image_dir); plugin->box_image = ply_image_new (image_path); free (image_path); plugin->image_dir = image_dir; plugin->views = ply_list_new (); return plugin; }
ply_entry_t * ply_entry_new (const char *image_dir) { ply_entry_t *entry; char *image_path; assert (image_dir != NULL); entry = calloc (1, sizeof (ply_entry_t)); image_path = NULL; asprintf (&image_path, "%s/entry.png", image_dir); entry->text_field_image = ply_image_new (image_path); free (image_path); image_path = NULL; asprintf (&image_path, "%s/bullet.png", image_dir); entry->bullet_image = ply_image_new (image_path); free (image_path); entry->label = ply_label_new (); entry->number_of_bullets = 0; entry->text = strdup(""); entry->is_hidden = true; entry->is_password = true; return entry; }
static ply_boot_splash_plugin_t * create_plugin (ply_key_file_t *key_file) { ply_boot_splash_plugin_t *plugin; char *image_dir, *image_path; char *color; srand ((int) ply_get_timestamp ()); plugin = calloc (1, sizeof(ply_boot_splash_plugin_t)); plugin->logo_image = ply_image_new (PLYMOUTH_LOGO_FILE); image_dir = ply_key_file_get_value (key_file, "throbgress", "ImageDir"); asprintf (&image_path, "%s/lock.png", image_dir); plugin->lock_image = ply_image_new (image_path); free (image_path); asprintf (&image_path, "%s/box.png", image_dir); plugin->box_image = ply_image_new (image_path); free (image_path); plugin->image_dir = image_dir; plugin->views = ply_list_new (); color = ply_key_file_get_value (key_file, "throbgress", "BackgroundStartColor"); if (color != NULL) plugin->background_start_color = strtol (color, NULL, 0); else plugin->background_start_color = PLYMOUTH_BACKGROUND_START_COLOR; free (color); color = ply_key_file_get_value (key_file, "throbgress", "BackgroundEndColor"); if (color != NULL) plugin->background_end_color = strtol (color, NULL, 0); else plugin->background_end_color = PLYMOUTH_BACKGROUND_END_COLOR; free (color); return plugin; }
ply_image_t * ply_image_resize (ply_image_t *image, long width, long height) { ply_image_t *new_image; new_image = ply_image_new (image->filename); new_image->buffer = ply_pixel_buffer_resize (image->buffer, width, height); return new_image; }
ply_image_t * ply_image_rotate (ply_image_t *image, long center_x, long center_y, double theta_offset) { ply_image_t *new_image; new_image = ply_image_new (image->filename); new_image->buffer = ply_pixel_buffer_rotate (image->buffer, center_x, center_y, theta_offset); return new_image; }
static bool ply_progress_animation_add_frame (ply_progress_animation_t *progress_animation, const char *filename) { ply_image_t *image; image = ply_image_new (filename); if (!ply_image_load (image)) { ply_image_free (image); return false; } ply_array_add_pointer_element (progress_animation->frames, image); progress_animation->area.width = MAX (progress_animation->area.width, (size_t) ply_image_get_width (image)); progress_animation->area.height = MAX (progress_animation->area.height, (size_t) ply_image_get_height (image)); return true; }
static bool ply_throbber_add_frame (ply_throbber_t *throbber, const char *filename) { ply_image_t *image; image = ply_image_new (filename); if (!ply_image_load (image)) { ply_image_free (image); return false; } ply_array_add_element (throbber->frames, image); throbber->width = MAX (throbber->width, ply_image_get_width (image)); throbber->height = MAX (throbber->height, ply_image_get_height (image)); return true; }
static bool ply_animation_add_frame (ply_animation_t *animation, const char *filename) { ply_image_t *image; image = ply_image_new (filename); if (!ply_image_load (image)) { ply_image_free (image); return false; } ply_array_add_element (animation->frames, image); animation->width = MAX (animation->width, ply_image_get_width (image)); animation->height = MAX (animation->height, ply_image_get_height (image)); return true; }
static bool ply_throbber_add_frame (ply_throbber_t *throbber, const char *filename) { ply_image_t *image; ply_pixel_buffer_t *frame; image = ply_image_new (filename); if (!ply_image_load (image)) { ply_image_free (image); return false; } frame = ply_image_convert_to_pixel_buffer (image); ply_array_add_pointer_element (throbber->frames, frame); throbber->width = MAX (throbber->width, (long) ply_pixel_buffer_get_width (frame)); throbber->height = MAX (throbber->height, (long) ply_pixel_buffer_get_height (frame)); return true; }
static ply_boot_splash_plugin_t * create_plugin (ply_key_file_t *key_file) { ply_boot_splash_plugin_t *plugin; char *image_dir, *image_path; char *alignment; char *transition; char *transition_duration; char *color; srand ((int) ply_get_timestamp ()); plugin = calloc (1, sizeof (ply_boot_splash_plugin_t)); image_dir = ply_key_file_get_value (key_file, "two-step", "ImageDir"); asprintf (&image_path, "%s/lock.png", image_dir); plugin->lock_image = ply_image_new (image_path); free (image_path); asprintf (&image_path, "%s/box.png", image_dir); plugin->box_image = ply_image_new (image_path); free (image_path); asprintf (&image_path, "%s/corner-image.png", image_dir); plugin->corner_image = ply_image_new (image_path); free (image_path); plugin->animation_dir = image_dir; alignment = ply_key_file_get_value (key_file, "two-step", "HorizontalAlignment"); if (alignment != NULL) plugin->animation_horizontal_alignment = strtod (alignment, NULL); else plugin->animation_horizontal_alignment = .5; free (alignment); alignment = ply_key_file_get_value (key_file, "two-step", "VerticalAlignment"); if (alignment != NULL) plugin->animation_vertical_alignment = strtod (alignment, NULL); else plugin->animation_vertical_alignment = .5; free (alignment); plugin->transition = PLY_PROGRESS_ANIMATION_TRANSITION_NONE; transition = ply_key_file_get_value (key_file, "two-step", "Transition"); if (transition != NULL) { if (strcmp (transition, "fade-over") == 0) plugin->transition = PLY_PROGRESS_ANIMATION_TRANSITION_FADE_OVER; else if (strcmp (transition, "cross-fade") == 0) plugin->transition = PLY_PROGRESS_ANIMATION_TRANSITION_CROSS_FADE; else if (strcmp (transition, "merge-fade") == 0) plugin->transition = PLY_PROGRESS_ANIMATION_TRANSITION_MERGE_FADE; } free (transition); transition_duration = ply_key_file_get_value (key_file, "two-step", "TransitionDuration"); if (transition_duration != NULL) plugin->transition_duration = strtod (transition_duration, NULL); else plugin->transition_duration = 0.0; free (transition_duration); color = ply_key_file_get_value (key_file, "two-step", "BackgroundStartColor"); if (color != NULL) plugin->background_start_color = strtol (color, NULL, 0); else plugin->background_start_color = PLYMOUTH_BACKGROUND_START_COLOR; free (color); color = ply_key_file_get_value (key_file, "two-step", "BackgroundEndColor"); if (color != NULL) plugin->background_end_color = strtol (color, NULL, 0); else plugin->background_end_color = PLYMOUTH_BACKGROUND_END_COLOR; free (color); plugin->views = ply_list_new (); return plugin; }