4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>Overloading and optional arguments</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
7
<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
<link rel="start" href="index.html" title="Cairo: A Vector Graphics Library">
8
8
<link rel="up" href="language-bindings.html" title="Appendix A. Creating a language binding for cairo">
9
9
<link rel="prev" href="bindings-return-values.html" title="Multiple return values">
10
10
<link rel="next" href="bindings-streams.html" title="Streams and File I/O">
11
11
<meta name="generator" content="GTK-Doc V1.10 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="chapter" href="Drawing.html" title="Drawing">
14
<link rel="chapter" href="Fonts.html" title="Fonts">
15
<link rel="chapter" href="Surfaces.html" title="Surfaces">
16
<link rel="chapter" href="Support.html" title="Utilities">
17
<link rel="index" href="ix01.html" title="Index">
13
<link rel="chapter" href="cairo-drawing.html" title="Drawing">
14
<link rel="chapter" href="cairo-fonts.html" title="Fonts">
15
<link rel="chapter" href="cairo-surfaces.html" title="Surfaces">
16
<link rel="chapter" href="cairo-support.html" title="Utilities">
17
<link rel="index" href="index-all.html" title="Index">
18
18
<link rel="index" href="index-1.2.html" title="Index of new symbols in 1.2">
19
19
<link rel="index" href="index-1.4.html" title="Index of new symbols in 1.4">
20
20
<link rel="index" href="index-1.6.html" title="Index of new symbols in 1.6">
43
43
overloading. What may seem like an obvious overload now may
44
44
turn out to be strange with future additions to cairo.
45
45
It might seem logical to make
46
<a class="link" href="cairo-cairo-t.html#cairo-set-source-rgb" title="cairo_set_source_rgb ()"><code class="function">cairo_set_source_rgb()</code></a>
46
<a class="link" href="cairo-context.html#cairo-set-source-rgb" title="cairo_set_source_rgb ()"><code class="function">cairo_set_source_rgb()</code></a>
47
47
an overload of <code class="function">cairo_set_source()</code>, but future plans to add
48
48
<code class="function">cairo_set_source_rgb_premultiplied()</code>,
49
49
which will also take three doubles make this a bad idea. For
101
101
Note that there are cases where all constructors for a type
102
102
aren't overloaded together. For example
103
<a class="link" href="cairo-PNG-Support.html#cairo-image-surface-create-from-png" title="cairo_image_surface_create_from_png ()"><code class="function">cairo_image_surface_create_from_png()</code></a>
103
<a class="link" href="cairo-png-functions.html#cairo-image-surface-create-from-png" title="cairo_image_surface_create_from_png ()"><code class="function">cairo_image_surface_create_from_png()</code></a>
104
104
should <span class="emphasis"><em>not</em></span> be overloaded together with
105
<a class="link" href="cairo-Image-Surfaces.html#cairo-image-surface-create" title="cairo_image_surface_create ()"><code class="function">cairo_image_surface_create()</code></a>.
105
<a class="link" href="cairo-image-surface.html#cairo-image-surface-create" title="cairo_image_surface_create ()"><code class="function">cairo_image_surface_create()</code></a>.
106
106
In such cases, the remaining constructors will typically need to
107
107
be bound as static methods. In Java, for example, we might have: