how to properly store a curve in XML

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to properly store a curve in XML

Marcel Wiesweg
Hi,

when a curves filter is applied, we need to store the curves in the
FilterAction written to metadata.
Now, the problem is that the CurvesFilter has five polygon each holding
potentially 65536 values - this is not very suitable for writing to XML.

I see two other places where a curve is saved:
- CurvesWidget::saveCurve
- ImageCurves::saveCurvesToGimpCurvesFile.

Are digikam curves Bezier curves? Then we could encode them in SVG style:
http://apike.ca/prog_svg_paths.html

Which would be the best way to store curves efficiently and correctly?

Marcel
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to properly store a curve in XML

Johannes Wienke-2
On 11/10/2010 03:42 PM, Marcel Wiesweg wrote:

> when a curves filter is applied, we need to store the curves in the
> FilterAction written to metadata.
> Now, the problem is that the CurvesFilter has five polygon each holding
> potentially 65536 values - this is not very suitable for writing to XML.
>
> I see two other places where a curve is saved:
> - CurvesWidget::saveCurve
> - ImageCurves::saveCurvesToGimpCurvesFile.
>
> Are digikam curves Bezier curves? Then we could encode them in SVG style:
> http://apike.ca/prog_svg_paths.html
>
> Which would be the best way to store curves efficiently and correctly?

Every curve is defined by keypoints by the user. Why not simply store
these keypoints?

Johannes
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to properly store a curve in XML

Gilles Caulier-4
2010/11/10 Johannes Wienke <[hidden email]>:

> On 11/10/2010 03:42 PM, Marcel Wiesweg wrote:
>> when a curves filter is applied, we need to store the curves in the
>> FilterAction written to metadata.
>> Now, the problem is that the CurvesFilter has five polygon each holding
>> potentially 65536 values - this is not very suitable for writing to XML.
>>
>> I see two other places where a curve is saved:
>> - CurvesWidget::saveCurve
>> - ImageCurves::saveCurvesToGimpCurvesFile.
>>
>> Are digikam curves Bezier curves?

The curves can be designed dot by dot or with a Beziers curve, using
approximation.

>Then we could encode them in SVG style:
>> http://apike.ca/prog_svg_paths.html
>>
>> Which would be the best way to store curves efficiently and correctly?
>

Yes, it's a good solution. but in Beziers mode, only 16 dots are used
to draw curve. Why not to use these values as well ?

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to properly store a curve in XML

Marcel Wiesweg
In reply to this post by Johannes Wienke-2

> Every curve is defined by keypoints by the user. Why not simply store
> these keypoints?

Yes, that would be the way to go. Most tools pass the curves points.
But not all: The problem is the "free curve" mode of CurvesSettings
(AdjustCurves and BQM tool) and the BWSepiaSettings.

These always store the "curve values", 256/65536, in the CurvesContainer.
In smooth curve mode, couldn't they only pass the 17 points?

Leaves the true "free curve". It seems acceptable to store an 8bit curve,
which is base64-encoded 344 bytes. It's not pleasant to read this XML then,
but it should work. We lose 16-bit precision for the curve, but that should be
acceptable.

Marcel
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel