~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-load.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This file is a part of the Cairo-Dock project
 
3
*
 
4
* Copyright : (C) see the 'copyright' file.
 
5
* E-mail    : see the 'copyright' file.
 
6
*
 
7
* This program is free software; you can redistribute it and/or
 
8
* modify it under the terms of the GNU General Public License
 
9
* as published by the Free Software Foundation; either version 3
 
10
* of the License, or (at your option) any later version.
 
11
*
 
12
* This program is distributed in the hope that it will be useful,
 
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
* GNU General Public License for more details.
 
16
* You should have received a copy of the GNU General Public License
 
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
*/
 
19
 
 
20
 
 
21
#ifndef __CAIRO_DOCK_LOAD__
 
22
#define  __CAIRO_DOCK_LOAD__
 
23
 
 
24
#include <glib.h>
 
25
 
 
26
#include "cairo-dock-struct.h"
 
27
#include "cairo-dock-icon-loader.h"
 
28
#include "cairo-dock-surface-factory.h"
 
29
G_BEGIN_DECLS
 
30
 
 
31
/**
 
32
*@file cairo-dock-load.h This class defines a simple image loader interface.
 
33
* It also handles the main image buffers of the dock.
 
34
* Use \ref cairo_dock_create_image_buffer to create an immage buffer from a file, or \ref cairo_dock_load_image_buffer to load an image into an existing immage buffer.
 
35
* Use \ref cairo_dock_free_image_buffer to destroy it or \ref cairo_dock_unload_image_buffer to unload and reset it to 0.
 
36
* If you just want to load an image into a mere cairo_surface, use the functions of the surface-factory.
 
37
*/
 
38
 
 
39
/// Definition of a Desktop Background Buffer. It has a reference count so that it can be shared across all the lib.
 
40
struct _CairoDockDesktopBackground {
 
41
        cairo_surface_t *pSurface;
 
42
        GLuint iTexture;
 
43
        guint iSidDestroyBg;
 
44
        gint iRefCount;
 
45
        } ;
 
46
 
 
47
/// Definition of an Image Buffer. It provides an unified interface for a cairo/opengl image buffer.
 
48
struct _CairoDockImageBuffer {
 
49
        cairo_surface_t *pSurface;
 
50
        GLuint iTexture;
 
51
        gint iWidth;
 
52
        gint iHeight;
 
53
        gdouble fZoomX;
 
54
        gdouble fZoomY;
 
55
        } ;
 
56
 
 
57
void cairo_dock_free_label_description (CairoDockLabelDescription *pTextDescription);
 
58
void cairo_dock_copy_label_description (CairoDockLabelDescription *pDestTextDescription, CairoDockLabelDescription *pOrigTextDescription);
 
59
CairoDockLabelDescription *cairo_dock_duplicate_label_description (CairoDockLabelDescription *pOrigTextDescription);
 
60
 
 
61
/** Say if 2 strings differ, taking into account NULL strings.
 
62
*/
 
63
#define cairo_dock_strings_differ(s1, s2) ((s1 && ! s2) || (! s1 && s2) || (s1 && s2 && strcmp (s1, s2)))
 
64
/** Say if 2 RGBA colors differ.
 
65
*/
 
66
#define cairo_dock_colors_rvb_differ(c1, c2) ((c1[0] != c2[0]) || (c1[1] != c2[1]) || (c1[2] != c2[2]))
 
67
/** Say if 2 RGB colors differ.
 
68
*/
 
69
#define cairo_dock_colors_differ(c1, c2) (cairo_dock_colors_rvb_differ (c1, c2) || (c1[3] != c2[3]))
 
70
 
 
71
/** Generate a complete path from a file name. '~' is handled, and files are supposed to be in the root folder of the current theme.
 
72
*@param cImageFile a file name or path. If it's already a path, it will just be duplicated.
 
73
*@return the path of the file.
 
74
*/
 
75
gchar *cairo_dock_generate_file_path (const gchar *cImageFile);
 
76
 
 
77
 
 
78
/** Load an image into an ImageBuffer with a given transparency. If the image is given by its sole name, it is taken in the root folder of the current theme.
 
79
*@param pImage an ImageBuffer.
 
80
*@param cImageFile name of a file
 
81
*@param iWidth width it should be loaded.
 
82
*@param iHeight height it should be loaded.
 
83
*@param iLoadModifier modifier
 
84
*@param fAlpha transparency (1:fully opaque)
 
85
*/
 
86
void cairo_dock_load_image_buffer_full (CairoDockImageBuffer *pImage, const gchar *cImageFile, int iWidth, int iHeight, CairoDockLoadImageModifier iLoadModifier, double fAlpha);
 
87
/** Load an image into an ImageBuffer. If the image is given by its sole name, it is taken in the root folder of the current theme.
 
88
*@param pImage an ImageBuffer.
 
89
*@param cImageFile name of a file
 
90
*@param iWidth width it should be loaded. The resulting width can be different depending on the modifier.
 
91
*@param iHeight height it should be loaded. The resulting width can be different depending on the modifier.
 
92
*@param iLoadModifier modifier
 
93
*/
 
94
#define cairo_dock_load_image_buffer(pImage, cImageFile, iWidth, iHeight, iLoadModifier) cairo_dock_load_image_buffer_full (pImage, cImageFile, iWidth, iHeight, iLoadModifier, 1.)
 
95
/** Load a surface into an ImageBuffer.
 
96
*@param pImage an ImageBuffer.
 
97
*@param pSurface a cairo surface
 
98
*@param iWidth width of the surface
 
99
*@param iHeight height of the surface
 
100
*/
 
101
void cairo_dock_load_image_buffer_from_surface (CairoDockImageBuffer *pImage, cairo_surface_t *pSurface, int iWidth, int iHeight);
 
102
/** Create and load an image into an ImageBuffer. If the image is given by its sole name, it is taken in the root folder of the current theme.
 
103
*@param cImageFile name of a file
 
104
*@param iWidth width it should be loaded.
 
105
*@param iHeight height it should be loaded.
 
106
*@param iLoadModifier modifier
 
107
*@return a newly allocated ImageBuffer.
 
108
*/
 
109
CairoDockImageBuffer *cairo_dock_create_image_buffer (const gchar *cImageFile, int iWidth, int iHeight, CairoDockLoadImageModifier iLoadModifier);
 
110
 
 
111
/** Reset an ImageBuffer's ressources. It can be used to load another image then.
 
112
*@param pImage an ImageBuffer.
 
113
*/
 
114
void cairo_dock_unload_image_buffer (CairoDockImageBuffer *pImage);
 
115
/** Reset and free an ImageBuffer.
 
116
*@param pImage an ImageBuffer.
 
117
*/
 
118
void cairo_dock_free_image_buffer (CairoDockImageBuffer *pImage);
 
119
 
 
120
 
 
121
///void cairo_dock_update_background_decorations_if_necessary (CairoDock *pDock, int iNewDecorationsWidth, int iNewDecorationsHeight);
 
122
 
 
123
void cairo_dock_load_dock_background (CairoDock *pDock);
 
124
void cairo_dock_trigger_load_dock_background (CairoDock *pDock);
 
125
 
 
126
 
 
127
CairoDockDesktopBackground *cairo_dock_get_desktop_background (gboolean bWithTextureToo);
 
128
 
 
129
void cairo_dock_destroy_desktop_background (CairoDockDesktopBackground *pDesktopBg);
 
130
 
 
131
cairo_surface_t *cairo_dock_get_desktop_bg_surface (CairoDockDesktopBackground *pDesktopBg);
 
132
 
 
133
GLuint cairo_dock_get_desktop_bg_texture (CairoDockDesktopBackground *pDesktopBg);
 
134
 
 
135
void cairo_dock_reload_desktop_background (void);
 
136
 
 
137
 
 
138
void cairo_dock_unload_additionnal_textures (void);
 
139
 
 
140
 
 
141
G_END_DECLS
 
142
#endif