Bug 26758 - language bindings guide: clarify mapping for cairo_pattern_create_rgb[a]
Summary: language bindings guide: clarify mapping for cairo_pattern_create_rgb[a]
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.9.7
Hardware: Other All
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-25 12:25 UTC by Owen Taylor
Modified: 2010-05-13 02:09 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch as described (1.56 KB, patch)
2010-02-25 12:25 UTC, Owen Taylor
Details | Splinter Review

Description Owen Taylor 2010-02-25 12:25:07 UTC
Created attachment 33570 [details] [review]
Patch as described

Clarify that cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
should be be overloaded as a single constructor for SolidPattern, but
instead should be static methods.

===
<otaylor> cworth: any opinion whether 'new Cairo.SolidPattern(1, 0, 0)', 'new Cairo.SolidPattern(1, 0, 0, 0)' is a good overload, or whether it should be Cairo.SolidPattern.createRGB(1, 0,0)' ?
<cworth> otaylor: Not really. I find almost all class hierarchies entirely inscrutable.
<cworth> otaylor: Oh, actually, I may have an opinion here.
<otaylor> cworth: fair enough. I guess the question is whether you consider it likely that there will be cairo_pattern_create_cmyk() in the future, and if there is, whether you would consider it an equal-peer to create_rgb() or something rare and corner case
<cworth> Having RGB and RGBA explicit in the names does lead to more readable code. Like, which one is the alpha channel? (recalling that we have an enum with "ARGB" in it for example).
<jdahlin> but what should the default sold pattern constructor be mapped to? or should it not be a default constructor?
<otaylor> jdahlin: then we wouldn't have a default constructor
<otaylor> (Note that solid patterns are sort of rare beasts to create explicitly, so it doesn't matter if it's a bit clunky)
===

Opposite approach would be to add the two functions to the list of approved overloads elsewhere in the language bindings guide.
Comment 1 Chris Wilson 2010-05-13 02:09:03 UTC
Finally pushed, thanks Owen.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.