Ejemplo n.º 1
0
/* Static parser helper functions */
char *avs_serialize_retrieve_palette_from_preset_section (char *section, VisParamEntry *param)
{
	int i;
	VisPalette pal;

	visual_palette_allocate_colors (&pal, AVS_SERIALIZE_GET_BYTE (section));

	AVS_SERIALIZE_SKIP_INT (section);

	for (i = 0; i < pal.ncolors; i++) {
		pal.colors[i].r = AVS_SERIALIZE_GET_BYTE (section);
		AVS_SERIALIZE_SKIP_BYTE (section);
		pal.colors[i].g = AVS_SERIALIZE_GET_BYTE (section);
		AVS_SERIALIZE_SKIP_BYTE (section);
		pal.colors[i].b = AVS_SERIALIZE_GET_BYTE (section);
		AVS_SERIALIZE_SKIP_BYTE (section);

		AVS_SERIALIZE_SKIP_BYTE (section);
	}

	visual_param_entry_set_palette (param, &pal);

	visual_palette_free_colors (&pal);

	return section;
}
Ejemplo n.º 2
0
/**
 * Copies the value of the src param into the param. Also sets the param to the type of which the
 * source param is.
 *
 * @param param Pointer to the VisParamEntry to which a parameter is set.
 * @param src Pointer to the VisParamEntry from which the value is retrieved.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL, -VISUAL_ERROR_PARAM_INVALID_TYPE on failure.
 */
int visual_param_entry_set_from_param (VisParamEntry *param, VisParamEntry *src)
{
	visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL);
	visual_log_return_val_if_fail (src != NULL, -VISUAL_ERROR_PARAM_NULL);

	switch (src->type) {
		case VISUAL_PARAM_ENTRY_TYPE_NULL:

			break;

		case VISUAL_PARAM_ENTRY_TYPE_STRING:
			visual_param_entry_set_string (param, visual_param_entry_get_string (src));
			break;

		case VISUAL_PARAM_ENTRY_TYPE_INTEGER:
			visual_param_entry_set_integer (param, visual_param_entry_get_integer (src));
			
			break;

		case VISUAL_PARAM_ENTRY_TYPE_FLOAT:
			visual_param_entry_set_float (param, visual_param_entry_get_float (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_DOUBLE:
			visual_param_entry_set_double (param, visual_param_entry_get_double (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_COLOR:
			visual_param_entry_set_color_by_color (param, visual_param_entry_get_color (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_PALETTE:
			visual_param_entry_set_palette (param, visual_param_entry_get_palette (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_OBJECT:
			visual_param_entry_set_object (param, visual_param_entry_get_object (src));

			break;
		
		default:
			visual_log (VISUAL_LOG_CRITICAL, _("param type is not valid"));

			return -VISUAL_ERROR_PARAM_INVALID_TYPE;

			break;
	}
	
	return VISUAL_OK;
}