~ubuntu-branches/ubuntu/oneiric/cairo-dock/oneiric

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: (18.1.1 cairo-dock) (19.1.1 cairo-dock)
  • 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-surface-factory.h"
28
 
G_BEGIN_DECLS
29
 
 
30
 
/**
31
 
*@file cairo-dock-load.h This class defines a simple image loader interface.
32
 
* It also handles the main image buffers of the dock.
33
 
* 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.
34
 
* Use \ref cairo_dock_free_image_buffer to destroy it or \ref cairo_dock_unload_image_buffer to unload and reset it to 0.
35
 
*/
36
 
 
37
 
/// Definition of a Desktop Background Buffer. It has a reference count so that it can be shared across all the lib.
38
 
struct _CairoDockDesktopBackground {
39
 
        cairo_surface_t *pSurface;
40
 
        GLuint iTexture;
41
 
        guint iSidDestroyBg;
42
 
        gint iRefCount;
43
 
        } ;
44
 
 
45
 
/// Definition of an Image Buffer. It provides an unified interface for a cairo/opengl image buffer.
46
 
struct _CairoDockImageBuffer {
47
 
        cairo_surface_t *pSurface;
48
 
        GLuint iTexture;
49
 
        gint iWidth;
50
 
        gint iHeight;
51
 
        } ;
52
 
 
53
 
void cairo_dock_free_label_description (CairoDockLabelDescription *pTextDescription);
54
 
void cairo_dock_copy_label_description (CairoDockLabelDescription *pDestTextDescription, CairoDockLabelDescription *pOrigTextDescription);
55
 
CairoDockLabelDescription *cairo_dock_duplicate_label_description (CairoDockLabelDescription *pOrigTextDescription);
56
 
 
57
 
/** Say if 2 strings differ, taking into account NULL strings.
58
 
*/
59
 
#define cairo_dock_strings_differ(s1, s2) ((s1 && ! s2) || (! s1 && s2) || (s1 && s2 && strcmp (s1, s2)))
60
 
/** Say if 2 RGBA colors differ.
61
 
*/
62
 
#define cairo_dock_colors_rvb_differ(c1, c2) ((c1[0] != c2[0]) || (c1[1] != c2[1]) || (c1[2] != c2[2]))
63
 
/** Say if 2 RGB colors differ.
64
 
*/
65
 
#define cairo_dock_colors_differ(c1, c2) (cairo_dock_colors_rvb_differ (c1, c2) || (c1[3] != c2[3]))
66
 
 
67
 
/** Generate a complete path from a file name. '~' is handled, and files are supposed to be in the root folder of the current theme.
68
 
*@param cImageFile a file name or path. If it's already a path, it will just be duplicated.
69
 
*@return the path of the file.
70
 
*/
71
 
gchar *cairo_dock_generate_file_path (const gchar *cImageFile);
72
 
 
73
 
 
74
 
void cairo_dock_load_image_buffer_full (CairoDockImageBuffer *pImage, const gchar *cImageFile, int iWidth, int iHeight, CairoDockLoadImageModifier iLoadModifier, double fAlpha);
75
 
 
76
 
#define cairo_dock_load_image_buffer(pImage, cImageFile, iWidth, iHeight, iLoadModifier) cairo_dock_load_image_buffer_full (pImage, cImageFile, iWidth, iHeight, iLoadModifier, 1.)
77
 
 
78
 
void cairo_dock_load_image_buffer_from_surface (CairoDockImageBuffer *pImage, cairo_surface_t *pSurface, int iWidth, int iHeight);
79
 
 
80
 
CairoDockImageBuffer *cairo_dock_create_image_buffer (const gchar *cImageFile, int iWidth, int iHeight, CairoDockLoadImageModifier iLoadModifier);
81
 
 
82
 
void cairo_dock_unload_image_buffer (CairoDockImageBuffer *pImage);
83
 
 
84
 
void cairo_dock_free_image_buffer (CairoDockImageBuffer *pImage);
85
 
 
86
 
/* Cree la surface de reflection d'une icone (pour cairo).
87
 
*@param pSourceContext le contexte de dessin lie a la surface de l'icone; n'est pas altere par la fonction.
88
 
*@param pIcon l'icone.
89
 
*@param pContainer le container de l'icone.
90
 
*/
91
 
void cairo_dock_add_reflection_to_icon (cairo_t *pSourceContext, Icon *pIcon, CairoContainer *pContainer);
92
 
 
93
 
/**Fill the image buffer (surface & texture) of a given icon, according to its type. Set its size accordingly, and fills the reflection buffer for cairo.
94
 
*@param icon the icon.
95
 
*@param pSourceContext a drawing context, not modified.
96
 
*@param fMaxScale maximum zoom.
97
 
*@param bIsHorizontal TRUE if the icon will be in a horizontal container (needed for the cairo reflect).
98
 
*@param bDirectionUp TRUE if the icon will be in a up container (needed for the cairo reflect).
99
 
*/
100
 
void cairo_dock_fill_one_icon_buffer (Icon *icon, cairo_t* pSourceContext, gdouble fMaxScale, gboolean bIsHorizontal, gboolean bDirectionUp);
101
 
 
102
 
/**Cut an UTF-8 or ASCII string to n characters, and add '...' to the end in cas it was effectively cut. If n is negative, it will remove the last |n| characters. It manages correctly UTF-8 strings.
103
 
*@param cString the string.
104
 
*@param iNbCaracters the maximum number of characters wished, or the number of characters to remove if negative.
105
 
*@return the newly allocated string.
106
 
*/
107
 
gchar *cairo_dock_cut_string (const gchar *cString, int iNbCaracters);
108
 
 
109
 
/**Fill the label buffer (surface & texture) of a given icon, according to a text description.
110
 
*@param icon the icon.
111
 
*@param pSourceContext a drawing context, not modified.
112
 
*@param pTextDescription desctiption of the text rendering.
113
 
*/
114
 
void cairo_dock_fill_one_text_buffer (Icon *icon, cairo_t* pSourceContext, CairoDockLabelDescription *pTextDescription);
115
 
 
116
 
/**Fill the quick-info buffer (surface & texture) of a given icon, according to a text description.
117
 
*@param icon the icon.
118
 
*@param pSourceContext a drawing context, not modified.
119
 
*@param pTextDescription desctiption of the text rendering.
120
 
*@param fMaxScale maximum zoom.
121
 
*/
122
 
void cairo_dock_fill_one_quick_info_buffer (Icon *icon, cairo_t* pSourceContext, CairoDockLabelDescription *pTextDescription, double fMaxScale);
123
 
 
124
 
void cairo_dock_fill_icon_buffers (Icon *icon, cairo_t *pSourceContext, double fMaxScale, gboolean bIsHorizontal, gboolean bDirectionUp);
125
 
#define cairo_dock_fill_icon_buffers_for_desklet(pIcon, pSourceContext) cairo_dock_fill_icon_buffers (pIcon, pSourceContext, 1, CAIRO_DOCK_HORIZONTAL, TRUE)
126
 
#define cairo_dock_fill_icon_buffers_for_dock(pIcon, pSourceContext, pDock) cairo_dock_fill_icon_buffers (pIcon, pSourceContext, 1 + myIcons.fAmplitude, pDock->container.bIsHorizontal, pDock->container.bDirectionUp)
127
 
 
128
 
/** Fill all the buffers (surfaces & textures) of a given icon, according to its type. Set its size accordingly, and fills the reflection buffer for cairo. Label and quick-info are loaded with the current global text description.
129
 
*@param pIcon the icon.
130
 
*@param pContainer its container.
131
 
*/
132
 
void cairo_dock_load_one_icon_from_scratch (Icon *pIcon, CairoContainer *pContainer);
133
 
 
134
 
void cairo_dock_reload_buffers_in_dock (gchar *cDockName, CairoDock *pDock, gpointer data);
135
 
#define cairo_dock_load_buffers_in_one_dock(pDock) cairo_dock_reload_buffers_in_dock (NULL, pDock, GINT_TO_POINTER (TRUE))
136
 
 
137
 
#define cairo_dock_reload_one_icon_buffer_in_dock_full(icon, pDock, pCairoContext) do {\
138
 
        icon->fWidth /= pDock->container.fRatio;\
139
 
        icon->fHeight /= pDock->container.fRatio;\
140
 
        cairo_dock_fill_one_icon_buffer (icon, pCairoContext, 1 + myIcons.fAmplitude, pDock->container.bIsHorizontal, pDock->container.bDirectionUp);\
141
 
        icon->fWidth *= pDock->container.fRatio;\
142
 
        icon->fHeight *= pDock->container.fRatio; } while (0)
143
 
 
144
 
void cairo_dock_reload_one_icon_buffer_in_dock (Icon *icon, CairoDock *pDock);
145
 
 
146
 
 
147
 
 
148
 
void cairo_dock_load_visible_zone (CairoDock *pDock, gchar *cVisibleZoneImageFile, int iVisibleZoneWidth, int iVisibleZoneHeight, double fVisibleZoneAlpha);
149
 
 
150
 
void cairo_dock_update_background_decorations_if_necessary (CairoDock *pDock, int iNewDecorationsWidth, int iNewDecorationsHeight);
151
 
 
152
 
void cairo_dock_load_background_decorations (CairoDock *pDock);
153
 
 
154
 
void cairo_dock_load_icons_background_surface (const gchar *cImagePath, double fMaxScale);
155
 
 
156
 
void cairo_dock_load_box_surface (double fMaxScale);
157
 
 
158
 
 
159
 
CairoDockDesktopBackground *cairo_dock_get_desktop_background (gboolean bWithTextureToo);
160
 
 
161
 
void cairo_dock_destroy_desktop_background (CairoDockDesktopBackground *pDesktopBg);
162
 
 
163
 
cairo_surface_t *cairo_dock_get_desktop_bg_surface (CairoDockDesktopBackground *pDesktopBg);
164
 
 
165
 
GLuint cairo_dock_get_desktop_bg_texture (CairoDockDesktopBackground *pDesktopBg);
166
 
 
167
 
void cairo_dock_reload_desktop_background (void);
168
 
 
169
 
 
170
 
void cairo_dock_load_task_indicator (const gchar *cIndicatorImagePath, double fMaxScale, double fIndicatorRatio);
171
 
 
172
 
void cairo_dock_load_active_window_indicator (const gchar *cImagePath, double fMaxScale, double fCornerRadius, double fLineWidth, double *fActiveColor);
173
 
 
174
 
void cairo_dock_load_class_indicator (const gchar *cIndicatorImagePath, double fMaxScale);
175
 
 
176
 
 
177
 
void cairo_dock_unload_additionnal_textures (void);
178
 
 
179
 
 
180
 
G_END_DECLS
181
 
#endif