/usr/include/d/gtkd-3/gdk/Cairo.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gdk.Cairo;
private import cairo.Context;
private import cairo.Region;
private import cairo.Surface;
private import gdk.Color;
private import gdk.DrawingContext;
private import gdk.RGBA;
private import gdk.Window;
private import gdk.c.functions;
public import gdk.c.types;
private import gdkpixbuf.Pixbuf;
private import gobject.ObjectG;
public import gtkc.gdktypes;
/** */
/**
* Creates a Cairo context for drawing to @window.
*
* Note that calling cairo_reset_clip() on the resulting #cairo_t will
* produce undefined results, so avoid it at all costs.
*
* Typically, this function is used to draw on a #GdkWindow out of the paint
* cycle of the toolkit; this should be avoided, as it breaks various assumptions
* and optimizations.
*
* If you are drawing on a native #GdkWindow in response to a %GDK_EXPOSE event
* you should use gdk_window_begin_draw_frame() and gdk_drawing_context_get_cairo_context()
* instead. GTK will automatically do this for you when drawing a widget.
*
* Deprecated: Use gdk_window_begin_draw_frame() and
* gdk_drawing_context_get_cairo_context() instead
*
* Params:
* window = a #GdkWindow
*
* Returns: A newly created Cairo context. Free with
* cairo_destroy() when you are done drawing.
*
* Since: 2.8
*/
public Context createContext(Window window)
{
auto p = gdk_cairo_create((window is null) ? null : window.getWindowStruct());
if(p is null)
{
return null;
}
return new Context(cast(cairo_t*) p);
}
/**
* This is the main way to draw GL content in GTK+. It takes a render buffer ID
* (@source_type == #GL_RENDERBUFFER) or a texture id (@source_type == #GL_TEXTURE)
* and draws it onto @cr with an OVER operation, respecting the current clip.
* The top left corner of the rectangle specified by @x, @y, @width and @height
* will be drawn at the current (0,0) position of the cairo_t.
*
* This will work for *all* cairo_t, as long as @window is realized, but the
* fallback implementation that reads back the pixels from the buffer may be
* used in the general case. In the case of direct drawing to a window with
* no special effects applied to @cr it will however use a more efficient
* approach.
*
* For #GL_RENDERBUFFER the code will always fall back to software for buffers
* with alpha components, so make sure you use #GL_TEXTURE if using alpha.
*
* Calling this may change the current GL context.
*
* Params:
* cr = a cairo context
* window = The window we're rendering for (not necessarily into)
* source = The GL ID of the source buffer
* sourceType = The type of the @source
* bufferScale = The scale-factor that the @source buffer is allocated for
* x = The source x position in @source to start copying from in GL coordinates
* y = The source y position in @source to start copying from in GL coordinates
* width = The width of the region to draw
* height = The height of the region to draw
*
* Since: 3.16
*/
public void drawFromGl(Context cr, Window window, int source, int sourceType, int bufferScale, int x, int y, int width, int height)
{
gdk_cairo_draw_from_gl((cr is null) ? null : cr.getContextStruct(), (window is null) ? null : window.getWindowStruct(), source, sourceType, bufferScale, x, y, width, height);
}
/**
* This is a convenience function around cairo_clip_extents().
* It rounds the clip extents to integer coordinates and returns
* a boolean indicating if a clip area exists.
*
* Params:
* cr = a cairo context
* rect = return location for the clip, or %NULL
*
* Returns: %TRUE if a clip rectangle exists, %FALSE if all of @cr is
* clipped and all drawing can be skipped
*/
public bool getClipRectangle(Context cr, out GdkRectangle rect)
{
return gdk_cairo_get_clip_rectangle((cr is null) ? null : cr.getContextStruct(), &rect) != 0;
}
/**
* Adds the given rectangle to the current path of @cr.
*
* Params:
* cr = a cairo context
* rectangle = a #GdkRectangle
*
* Since: 2.8
*/
public void rectangle(Context cr, GdkRectangle* rectangle)
{
gdk_cairo_rectangle((cr is null) ? null : cr.getContextStruct(), rectangle);
}
/**
* Adds the given region to the current path of @cr.
*
* Params:
* cr = a cairo context
* region = a #cairo_region_t
*
* Since: 2.8
*/
public void region(Context cr, Region region)
{
gdk_cairo_region((cr is null) ? null : cr.getContextStruct(), (region is null) ? null : region.getRegionStruct());
}
/**
* Creates region that describes covers the area where the given
* @surface is more than 50% opaque.
*
* This function takes into account device offsets that might be
* set with cairo_surface_set_device_offset().
*
* Params:
* surface = a cairo surface
*
* Returns: A #cairo_region_t; must be freed with cairo_region_destroy()
*/
public Region regionCreateFromSurface(Surface surface)
{
auto p = gdk_cairo_region_create_from_surface((surface is null) ? null : surface.getSurfaceStruct());
if(p is null)
{
return null;
}
return new Region(cast(cairo_region_t*) p);
}
/**
* Sets the specified #GdkColor as the source color of @cr.
*
* Deprecated: Use gdk_cairo_set_source_rgba() instead
*
* Params:
* cr = a cairo context
* color = a #GdkColor
*
* Since: 2.8
*/
public void setSourceColor(Context cr, Color color)
{
gdk_cairo_set_source_color((cr is null) ? null : cr.getContextStruct(), (color is null) ? null : color.getColorStruct());
}
/**
* Sets the given pixbuf as the source pattern for @cr.
*
* The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
* so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y.
*
* Params:
* cr = a cairo context
* pixbuf = a #GdkPixbuf
* pixbufX = X coordinate of location to place upper left corner of @pixbuf
* pixbufY = Y coordinate of location to place upper left corner of @pixbuf
*
* Since: 2.8
*/
public void setSourcePixbuf(Context cr, Pixbuf pixbuf, double pixbufX, double pixbufY)
{
gdk_cairo_set_source_pixbuf((cr is null) ? null : cr.getContextStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct(), pixbufX, pixbufY);
}
/**
* Sets the specified #GdkRGBA as the source color of @cr.
*
* Params:
* cr = a cairo context
* rgba = a #GdkRGBA
*
* Since: 3.0
*/
public void setSourceRgba(Context cr, RGBA rgba)
{
gdk_cairo_set_source_rgba((cr is null) ? null : cr.getContextStruct(), (rgba is null) ? null : rgba.getRGBAStruct());
}
/**
* Sets the given window as the source pattern for @cr.
*
* The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
* so that the origin of @window is @x, @y. The window contains all its
* subwindows when rendering.
*
* Note that the contents of @window are undefined outside of the
* visible part of @window, so use this function with care.
*
* Params:
* cr = a cairo context
* window = a #GdkWindow
* x = X coordinate of location to place upper left corner of @window
* y = Y coordinate of location to place upper left corner of @window
*
* Since: 2.24
*/
public void setSourceWindow(Context cr, Window window, double x, double y)
{
gdk_cairo_set_source_window((cr is null) ? null : cr.getContextStruct(), (window is null) ? null : window.getWindowStruct(), x, y);
}
/**
* Creates an image surface with the same contents as
* the pixbuf.
*
* Params:
* pixbuf = a #GdkPixbuf
* scale = the scale of the new surface, or 0 to use same as @window
* forWindow = The window this will be drawn to, or %NULL
*
* Returns: a new cairo surface, must be freed with cairo_surface_destroy()
*
* Since: 3.10
*/
public Surface surfaceCreateFromPixbuf(Pixbuf pixbuf, int scale, Window forWindow)
{
auto p = gdk_cairo_surface_create_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct(), scale, (forWindow is null) ? null : forWindow.getWindowStruct());
if(p is null)
{
return null;
}
return new Surface(cast(cairo_surface_t*) p);
}
/**
* Retrieves the #GdkDrawingContext that created the Cairo
* context @cr.
*
* Params:
* cr = a Cairo context
*
* Returns: a #GdkDrawingContext, if any is set
*
* Since: 3.22
*/
public DrawingContext getDrawingContext(Context cr)
{
auto p = gdk_cairo_get_drawing_context((cr is null) ? null : cr.getContextStruct());
if(p is null)
{
return null;
}
return ObjectG.getDObject!(DrawingContext)(cast(GdkDrawingContext*) p);
}
|