Re: cairo Digest, Vol 117, Issue 15

Elvis Teixeira <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAAzZR=iT9ZWm1_i=yMCrtqS4dEAuq-x-tV8wjjCJWCMWaeorEQ@mail.gmail.com>
Thank you very much for your comments Lawrence, although PySlope is just a
effort in learning python, so I know that there shoud be many
misundertandings :) And I am not sure if it was time to put it in the repo.

2015-04-18 16:00 GMT-03:00 <[email protected]>:

> Send cairo mailing list submissions to
>         [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.cairographics.org/mailman/listinfo/cairo
> or, via email, send a message with subject or body 'help' to
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of cairo digest..."
>
>
> Today's Topics:
>
>    1. Re: A new charting library (Lawrence D'Oliveiro)
>    2. Creating A Cairo Context Seems Quite Quick (Lawrence D'Oliveiro)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 18 Apr 2015 08:48:54 +1200
> From: Lawrence D'Oliveiro <[email protected]>
> To: [email protected]
> Subject: Re: [cairo] A new charting library
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=UTF-8
>
> On Fri, 17 Apr 2015 09:10:19 -0300, Elvis Teixeira wrote:
>
> > PROJECT INFO:
> > name: slope
> > type: Charting library
> > author: Elvis Teixeira (Brazil)
> > license: LGPL
> > link: https://github.com/elvismt/slope
>
> I was going to say this was a natural job for Python, and then I saw
> you were ahead of me. :)
>
> Some random comments:
>
> In PySlope/data.py, why not shorten Data.set_visible to
>
>     def set_visible(self, on):
>         c.slope_data_set_visible(self.cobj, on)
>
> Similarly for XyData.set_antialias in PySlope/xydata.py.
>
> Where you have a lot of instance attributes (e.g. XyChart, in
> PySlope/simple_charts.py), it can be a good idea to list these in a
> __slots__ class attribute. This way, when you try to assign to the wrong
> one, Python reports “no such attribute” rather than silently creating a
> new one. This helps prevent typos.
>
> In that same source file, how about shortening XyChart.axis to
>
>     def axis(self, name):
>         return \
>             self._metrics.get_axis \
>               (
>                 {
>                     'top' : xymetrics.LEFT_AXIS,
>                     'left' : xymetrics.TOP_AXIS,
>                     'bottom' : xymetrics.BOTTOM_AXIS,
>                     'right' : xymetrics.RIGHT_AXIS,
>                 }[name]
>               )
>
> You could even use enums, but that restricts you to Python 3.4 and
> later.
>
>
> ------------------------------
>
> Message: 2
> Date: Sat, 18 Apr 2015 22:30:58 +1200
> From: Lawrence D'Oliveiro <[email protected]>
> To: [email protected]
> Subject: [cairo] Creating A Cairo Context Seems Quite Quick
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=UTF-8
>
> I just added methods to my Path and Path.Segment types in Qahirah
> <https://github.com/ldo/qahirah> to compute extents and return
> flattened versions. These create a temporary Cairo context so I can use
> its append_path and copy_path_flat calls to do all the work. The
> overhead of this doesn’t seem too bad.
>
> As a baseline (on an already-created Cairo context), the Python sequence
>
>     ctx.new_path().append_path(path).copy_path_flat()
>
> takes 140µs for a simple rectangular path on my Core i7 (averaged over
> 100,000 iterations using the Python timeit module), while
>
>     ctx.new_path().append_path(path).path_extents
>
> takes 59µs. For the new methods I have added, which create a new context
> on every call,
>
>     path.flatten()
>
> takes 162µs, while
>
>     path.extents
>
> takes 83µs. So the overhead in the former is about 16%, in the latter
> about 40%. Well short of the order-of-magnitude-or-more I was
> expecting/fearing...
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> cairo mailing list
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
>
> ------------------------------
>
> End of cairo Digest, Vol 117, Issue 15
> **************************************
>

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.