evas: let loader specify there prefered color space.

This commit is contained in:
Cedric BAIL 2014-03-17 14:52:47 +09:00 committed by Cedric BAIL
parent b56d7bba60
commit 05239d8dd2
7 changed files with 30 additions and 22 deletions

View File

@ -177,23 +177,6 @@ typedef enum _Evas_Font_Hinting_Flags
EVAS_FONT_HINTING_BYTECODE /**< Bytecode font hinting */
} Evas_Font_Hinting_Flags; /**< Flags for Font Hinting */
/**
* Colorspaces for pixel data supported by Evas
* @ingroup Evas_Object_Image
*/
typedef enum _Evas_Colorspace
{
EVAS_COLORSPACE_ARGB8888, /**< ARGB 32 bits per pixel, high-byte is Alpha, accessed 1 32bit word at a time */
/* these are not currently supported - but planned for the future */
EVAS_COLORSPACE_YCBCR422P601_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
EVAS_COLORSPACE_YCBCR422P709_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-709 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
EVAS_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 bits of the 8 being used per alpha byte */
EVAS_COLORSPACE_GRY8, /**< 8bit grayscale */
EVAS_COLORSPACE_YCBCR422601_PL, /**< YCbCr 4:2:2, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to line of Y,Cb,Y,Cr bytes */
EVAS_COLORSPACE_YCBCR420NV12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb,Cr rows. */
EVAS_COLORSPACE_YCBCR420TM12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of tiled row pointer, pointing to the Y rows, then the Cb,Cr rows. */
} Evas_Colorspace; /**< Colorspaces for pixel data supported by Evas */
/**
* How to pack items into cells in a table.
* @ingroup Evas_Object_Table

View File

@ -146,17 +146,38 @@ typedef enum _Evas_Image_Scale_Hint
EVAS_IMAGE_SCALE_HINT_STATIC = 2 /**< Image is not being re-scaled over time, thus turning scaling cache @b on for its data */
} Evas_Image_Scale_Hint; /**< How an image's data is to be treated by Evas, with regard to scaling cache */
/**
* Colorspaces for pixel data supported by Evas
* @ingroup Evas_Object_Image
*/
typedef enum _Evas_Colorspace
{
EVAS_COLORSPACE_ARGB8888, /**< ARGB 32 bits per pixel, high-byte is Alpha, accessed 1 32bit word at a time */
/* these are not currently supported - but planned for the future */
EVAS_COLORSPACE_YCBCR422P601_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
EVAS_COLORSPACE_YCBCR422P709_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-709 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
EVAS_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 bits of the 8 being used per alpha byte */
EVAS_COLORSPACE_GRY8, /**< 8bit grayscale */
EVAS_COLORSPACE_YCBCR422601_PL, /**< YCbCr 4:2:2, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to line of Y,Cb,Y,Cr bytes */
EVAS_COLORSPACE_YCBCR420NV12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb,Cr rows. */
EVAS_COLORSPACE_YCBCR420TM12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of tiled row pointer, pointing to the Y rows, then the Cb,Cr rows. */
EVAS_COLORSPACE_ETC1, /**< OpenGL ETC1 encoding of RGB texture @since 1.10 */
} Evas_Colorspace; /**< Colorspaces for pixel data supported by Evas */
struct _Evas_Image_Property
{
unsigned int w;
unsigned int h;
unsigned char scale;
Eina_Bool rotated;
Eina_Bool alpha;
Eina_Bool premul;
Eina_Bool alpha_sparse;
const Evas_Colorspace *cspaces; /**< Specify the color space handled by the loader @since 1.10 */
Evas_Colorspace cspace; /**< Specify the color space handle by the engine @since 1.10 */
};
struct _Evas_Image_Animated

View File

@ -139,7 +139,7 @@ EAPI void evas_cache_image_surface_alloc(Image_Entry *im, un
EAPI DATA32* evas_cache_image_pixels(Image_Entry *im);
EAPI Image_Entry* evas_cache_image_copied_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace);
EAPI Image_Entry* evas_cache_image_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace);
EAPI void evas_cache_image_colorspace(Image_Entry *im, int cspace);
EAPI void evas_cache_image_colorspace(Image_Entry *im, Evas_Colorspace cspace);
EAPI Image_Entry* evas_cache_image_empty(Evas_Cache_Image *cache);
EAPI Image_Entry* evas_cache_image_size_set(Image_Entry *im, unsigned int w, unsigned int h);

View File

@ -1368,7 +1368,7 @@ evas_cache_image_empty(Evas_Cache_Image *cache)
}
EAPI void
evas_cache_image_colorspace(Image_Entry *im, int cspace)
evas_cache_image_colorspace(Image_Entry *im, Evas_Colorspace cspace)
{
if (im->space == cspace) return;
im->space = cspace;

View File

@ -113,7 +113,7 @@ evas_common_rgba_image_size_set(Image_Entry *ie_dst, const Image_Entry *ie_im, u
}
int
evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, int cspace)
evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, Evas_Colorspace cspace)
{
RGBA_Image *dst = (RGBA_Image *) ie_dst;
Eina_Bool change = (dst->cache_entry.space != cspace);

View File

@ -225,6 +225,8 @@ _evas_image_file_header(Evas_Module *em, Image_Entry *ie, int *error)
ie->h = property.h;
ie->scale = property.scale;
ie->flags.alpha = property.alpha;
if (property.cspaces)
ie->cspaces = property.cspaces;
if (ie->load_opts.orientation &&
ie->load_opts.degree != 0)
ie->flags.rotated = EINA_TRUE;
@ -413,6 +415,7 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
property.rotated = ie->flags.rotated;
property.premul = EINA_FALSE;
property.alpha_sparse = EINA_FALSE;
property.cspace = ie->space;
evas_cache_image_surface_alloc(ie, ie->w, ie->h);

View File

@ -593,7 +593,8 @@ struct _Image_Entry
#endif
Evas_Image_Load_Opts load_opts;
int space;
Evas_Colorspace space;
const Evas_Colorspace *cspaces; // owned by the loader, live as long as the loader
unsigned int w;
unsigned int h;