babl: format comparison
Vom: Sat, 21 May 2011 22:37:41 +0000
Hi,
what would be the best-practice to check if two BablFormats are the
same? I would need something like:
Babl *format1 = babl_format("R'G'B' u8");
Babl *format2 = babl_format("CIE Lab float");
if(is_same_format(format1, format2))
if (format1 == format2)
{ ... } else { ... }
But do note that internally babl will provide you with a memcpy
instead of a conversion if the passed in formats are the same; thus
yep, i've seen that.
this should only be neccesary if direct access with no copies
whatsoever is an option where used.
I don't quite understand. Without (my own) copies of the babl object?
Maybe types would be a better example. If I understand you right I can
do this:
Babl *format = babl_format("R'G'B' u8");
...
if(babl_format_get_type(format) == babl_type("u8"))
{
/* u8 type */
}
else
{
/* no u8 type */
}
BablFishes never change their source nor destination formats, and at
the moment the source and destination formats of fishes are not
exposed bu the publicly installed headers for babl.
Then it looks like I have to remember the formats of all created fish
myself :(
best regards