2008-07-01 22:57:50 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
1997-11-24 22:37:52 +00:00
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2004-11-21 16:24:01 +00:00
|
|
|
#include <math.h>
|
2005-03-17 01:54:40 +00:00
|
|
|
#include <pango/pangocairo.h>
|
2010-06-26 05:06:30 +00:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2005-05-14 07:19:48 +00:00
|
|
|
#include "gdkcairo.h"
|
1999-10-01 23:18:30 +00:00
|
|
|
#include "gdkdrawable.h"
|
2000-03-28 01:40:57 +00:00
|
|
|
#include "gdkinternals.h"
|
1999-10-03 22:12:41 +00:00
|
|
|
#include "gdkwindow.h"
|
2002-04-25 22:29:14 +00:00
|
|
|
#include "gdkscreen.h"
|
2002-01-04 05:58:01 +00:00
|
|
|
#include "gdkpixbuf.h"
|
2010-07-09 00:34:45 +00:00
|
|
|
|
2002-01-04 05:58:01 +00:00
|
|
|
|
2006-05-14 03:58:06 +00:00
|
|
|
G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT)
|
1999-11-08 20:14:59 +00:00
|
|
|
|
2000-10-24 00:15:14 +00:00
|
|
|
static void
|
|
|
|
gdk_drawable_class_init (GdkDrawableClass *klass)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-04-04 14:02:03 +00:00
|
|
|
static void
|
|
|
|
gdk_drawable_init (GdkDrawable *drawable)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-12-15 01:46:41 +00:00
|
|
|
/**
|
|
|
|
* gdk_drawable_get_clip_region:
|
|
|
|
* @drawable: a #GdkDrawable
|
|
|
|
*
|
|
|
|
* Computes the region of a drawable that potentially can be written
|
|
|
|
* to by drawing primitives. This region will not take into account
|
|
|
|
* the clip region for the GC, and may also not take into account
|
|
|
|
* other factors such as if the window is obscured by other windows,
|
|
|
|
* but no area outside of this region will be affected by drawing
|
|
|
|
* primitives.
|
|
|
|
*
|
2010-06-28 12:54:37 +00:00
|
|
|
* Returns: a #cairo_region_t. This must be freed with cairo_region_destroy()
|
2005-05-08 05:47:52 +00:00
|
|
|
* when you are done.
|
2000-12-15 01:46:41 +00:00
|
|
|
**/
|
2010-06-28 12:54:37 +00:00
|
|
|
cairo_region_t *
|
2000-12-15 01:46:41 +00:00
|
|
|
gdk_drawable_get_clip_region (GdkDrawable *drawable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
|
|
|
|
|
|
|
return GDK_DRAWABLE_GET_CLASS (drawable)->get_clip_region (drawable);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_drawable_get_visible_region:
|
2005-05-08 05:47:52 +00:00
|
|
|
* @drawable: a #GdkDrawable
|
2000-12-15 01:46:41 +00:00
|
|
|
*
|
|
|
|
* Computes the region of a drawable that is potentially visible.
|
|
|
|
* This does not necessarily take into account if the window is
|
|
|
|
* obscured by other windows, but no area outside of this region
|
|
|
|
* is visible.
|
|
|
|
*
|
2010-06-28 12:54:37 +00:00
|
|
|
* Returns: a #cairo_region_t. This must be freed with cairo_region_destroy()
|
2005-05-08 05:47:52 +00:00
|
|
|
* when you are done.
|
2000-12-15 01:46:41 +00:00
|
|
|
**/
|
2010-06-28 12:54:37 +00:00
|
|
|
cairo_region_t *
|
2000-12-15 01:46:41 +00:00
|
|
|
gdk_drawable_get_visible_region (GdkDrawable *drawable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
|
|
|
|
|
|
|
return GDK_DRAWABLE_GET_CLASS (drawable)->get_visible_region (drawable);
|
|
|
|
}
|
|
|
|
|
2005-02-03 23:29:02 +00:00
|
|
|
/**
|
2005-03-17 01:54:40 +00:00
|
|
|
* _gdk_drawable_ref_cairo_surface:
|
2005-02-03 23:29:02 +00:00
|
|
|
* @drawable: a #GdkDrawable
|
|
|
|
*
|
2005-03-17 01:54:40 +00:00
|
|
|
* Obtains a #cairo_surface_t for the given drawable. If a
|
|
|
|
* #cairo_surface_t for the drawable already exists, it will be
|
|
|
|
* referenced, otherwise a new surface will be created.
|
|
|
|
*
|
|
|
|
* Return value: a newly referenced #cairo_surface_t that points
|
|
|
|
* to @drawable. Unref with cairo_surface_destroy()
|
|
|
|
**/
|
|
|
|
cairo_surface_t *
|
|
|
|
_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
|
|
|
|
|
|
|
return GDK_DRAWABLE_GET_CLASS (drawable)->ref_cairo_surface (drawable);
|
|
|
|
}
|
|
|
|
|
2004-11-21 16:24:01 +00:00
|
|
|
/************************************************************************/
|
|
|
|
|
2008-12-15 14:50:41 +00:00
|
|
|
cairo_surface_t *
|
|
|
|
_gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
|
|
|
return GDK_DRAWABLE_GET_CLASS (drawable)->create_cairo_surface (drawable,
|
|
|
|
width, height);
|
|
|
|
}
|