2010-10-18 15:34:08 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
/*
|
|
|
|
* MetaShadowFactory:
|
|
|
|
*
|
|
|
|
* Create and cache shadow textures for arbitrary window shapes
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-11 20:42:06 -05:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2010-10-18 15:34:08 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __META_SHADOW_FACTORY_H__
|
|
|
|
#define __META_SHADOW_FACTORY_H__
|
|
|
|
|
2015-07-06 03:02:13 -04:00
|
|
|
#include <cairo.h>
|
2018-07-10 04:36:24 -04:00
|
|
|
|
|
|
|
#include "clutter/clutter.h"
|
2018-11-08 16:32:13 -05:00
|
|
|
#include "cogl/cogl.h"
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "meta/meta-window-shape.h"
|
2015-07-06 03:02:13 -04:00
|
|
|
|
2019-01-22 21:25:35 -05:00
|
|
|
META_EXPORT
|
2015-07-06 03:29:23 -04:00
|
|
|
GType meta_shadow_get_type (void) G_GNUC_CONST;
|
2010-10-18 15:34:08 -04:00
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
/**
|
|
|
|
* MetaShadowParams:
|
|
|
|
* @radius: the radius (gaussian standard deviation) of the shadow
|
|
|
|
* @top_fade: if >= 0, the shadow doesn't extend above the top
|
|
|
|
* of the shape, and fades out over the given number of pixels
|
|
|
|
* @x_offset: horizontal offset of the shadow with respect to the
|
|
|
|
* shape being shadowed, in pixels
|
|
|
|
* @y_offset: vertical offset of the shadow with respect to the
|
|
|
|
* shape being shadowed, in pixels
|
|
|
|
* @opacity: opacity of the shadow, from 0 to 255
|
2013-02-15 13:42:08 -05:00
|
|
|
*
|
|
|
|
* The #MetaShadowParams structure holds information about how to draw
|
|
|
|
* a particular style of shadow.
|
2010-11-11 16:24:43 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _MetaShadowParams MetaShadowParams;
|
|
|
|
|
|
|
|
struct _MetaShadowParams
|
|
|
|
{
|
|
|
|
int radius;
|
|
|
|
int top_fade;
|
|
|
|
int x_offset;
|
|
|
|
int y_offset;
|
|
|
|
guint8 opacity;
|
|
|
|
};
|
|
|
|
|
2018-10-31 06:47:17 -04:00
|
|
|
#define META_TYPE_SHADOW_FACTORY (meta_shadow_factory_get_type ())
|
2019-01-22 21:25:35 -05:00
|
|
|
|
|
|
|
META_EXPORT
|
2018-10-31 06:47:17 -04:00
|
|
|
G_DECLARE_FINAL_TYPE (MetaShadowFactory,
|
|
|
|
meta_shadow_factory,
|
|
|
|
META, SHADOW_FACTORY,
|
|
|
|
GObject)
|
2010-11-04 17:26:24 -04:00
|
|
|
|
2010-10-18 15:34:08 -04:00
|
|
|
/**
|
|
|
|
* MetaShadowFactory:
|
2013-02-15 13:42:08 -05:00
|
|
|
*
|
2010-10-18 15:34:08 -04:00
|
|
|
* #MetaShadowFactory is used to create window shadows. It caches shadows internally
|
|
|
|
* so that multiple shadows created for the same shape with the same radius will
|
|
|
|
* share the same MetaShadow.
|
|
|
|
*/
|
2019-01-22 21:25:35 -05:00
|
|
|
META_EXPORT
|
2010-10-18 15:34:08 -04:00
|
|
|
MetaShadowFactory *meta_shadow_factory_get_default (void);
|
|
|
|
|
2019-01-22 21:25:35 -05:00
|
|
|
META_EXPORT
|
2010-11-11 16:24:43 -05:00
|
|
|
void meta_shadow_factory_set_params (MetaShadowFactory *factory,
|
|
|
|
const char *class_name,
|
|
|
|
gboolean focused,
|
|
|
|
MetaShadowParams *params);
|
2019-01-22 21:25:35 -05:00
|
|
|
|
|
|
|
META_EXPORT
|
2010-11-11 16:24:43 -05:00
|
|
|
void meta_shadow_factory_get_params (MetaShadowFactory *factory,
|
|
|
|
const char *class_name,
|
|
|
|
gboolean focused,
|
|
|
|
MetaShadowParams *params);
|
|
|
|
|
2015-07-06 03:02:13 -04:00
|
|
|
/**
|
|
|
|
* MetaShadow:
|
|
|
|
* #MetaShadow holds a shadow texture along with information about how to
|
|
|
|
* apply that texture to draw a window texture. (E.g., it knows how big the
|
|
|
|
* unscaled borders are on each side of the shadow texture.)
|
|
|
|
*/
|
|
|
|
typedef struct _MetaShadow MetaShadow;
|
|
|
|
|
2019-01-22 21:25:35 -05:00
|
|
|
META_EXPORT
|
2015-07-06 03:02:13 -04:00
|
|
|
MetaShadow *meta_shadow_ref (MetaShadow *shadow);
|
2019-01-22 21:25:35 -05:00
|
|
|
|
|
|
|
META_EXPORT
|
2015-07-06 03:02:13 -04:00
|
|
|
void meta_shadow_unref (MetaShadow *shadow);
|
2019-01-22 21:25:35 -05:00
|
|
|
|
|
|
|
META_EXPORT
|
2015-07-06 03:02:13 -04:00
|
|
|
void meta_shadow_paint (MetaShadow *shadow,
|
2018-11-08 16:32:13 -05:00
|
|
|
CoglFramebuffer *framebuffer,
|
2015-07-06 03:02:13 -04:00
|
|
|
int window_x,
|
|
|
|
int window_y,
|
|
|
|
int window_width,
|
|
|
|
int window_height,
|
|
|
|
guint8 opacity,
|
|
|
|
cairo_region_t *clip,
|
|
|
|
gboolean clip_strictly);
|
2019-01-22 21:25:35 -05:00
|
|
|
|
|
|
|
META_EXPORT
|
2015-07-06 03:02:13 -04:00
|
|
|
void meta_shadow_get_bounds (MetaShadow *shadow,
|
|
|
|
int window_x,
|
|
|
|
int window_y,
|
|
|
|
int window_width,
|
|
|
|
int window_height,
|
|
|
|
cairo_rectangle_int_t *bounds);
|
|
|
|
|
2019-01-22 21:25:35 -05:00
|
|
|
META_EXPORT
|
2015-07-06 03:02:13 -04:00
|
|
|
MetaShadowFactory *meta_shadow_factory_new (void);
|
|
|
|
|
2019-01-22 21:25:35 -05:00
|
|
|
META_EXPORT
|
2015-07-06 03:02:13 -04:00
|
|
|
MetaShadow *meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
|
|
|
|
MetaWindowShape *shape,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
const char *class_name,
|
|
|
|
gboolean focused);
|
|
|
|
|
2010-10-18 15:34:08 -04:00
|
|
|
#endif /* __META_SHADOW_FACTORY_H__ */
|