Some questions
Hubert Figuiere
hub at figuiere.net
Tue Jan 22 21:54:52 PST 2008
On Tue, 2008-01-22 at 20:30 +0100, Vladimir Nadvornik wrote:
> 1. Is this an optimal way of writing and reading an array of floats?
>
> xmp_delete_property(xmp, NS_UFRAW, "ChannelMultipliers");
> for (i = 0; i < 4; i++) {
> sprintf(tmp, "%f", c->chanMul[i]);
> xmp_append_array_item(xmp, NS_UFRAW, "ChannelMultipliers", XMP_PROP_ARRAY_IS_ORDERED, tmp, 0);
> }
Careful, sprintf will format according to the locale. So for example in
fr_FR 1.0 will be 1,0.
Otherwise it is not much different from what happen behind the scenes
using the method below.
>
> [...]
>
> for (i = 0; i < 4; i++) {
> sprintf(tmp, "ChannelMultipliers[%d]", i + 1);
> if (!xmp_get_property_float(xmp, NS_UFRAW, tmp, &c->chanMul[i], 0))
> c->chanMul[i] = 0.0;
> }
That works too. However I realize that i didn't provide the API to
compose path yet (to make things easier). No biggie if you know the
syntax (like here).
> 2. Can I write sidecar xmp files with xmp_files functions or it must
> be handled separately?
You have to serialize and write yourself in the file. And unlike the way
UFRaw write the ID file (with the output file), the XMP files should be
written next to the RAW file.
Hub
More information about the Exempi-devel
mailing list