2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
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.
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/>.
21
#ifndef __CAIRO_DOCK_LOAD__
22
#define __CAIRO_DOCK_LOAD__
26
#include "cairo-dock-struct.h"
27
#include "cairo-dock-icon-loader.h"
28
#include "cairo-dock-surface-factory.h"
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.
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;
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;
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);
61
/** Say if 2 strings differ, taking into account NULL strings.
63
#define cairo_dock_strings_differ(s1, s2) ((s1 && ! s2) || (! s1 && s2) || (s1 && s2 && strcmp (s1, s2)))
64
/** Say if 2 RGBA colors differ.
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.
69
#define cairo_dock_colors_differ(c1, c2) (cairo_dock_colors_rvb_differ (c1, c2) || (c1[3] != c2[3]))
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.
75
gchar *cairo_dock_generate_file_path (const gchar *cImageFile);
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)
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
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
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.
109
CairoDockImageBuffer *cairo_dock_create_image_buffer (const gchar *cImageFile, int iWidth, int iHeight, CairoDockLoadImageModifier iLoadModifier);
111
/** Reset an ImageBuffer's ressources. It can be used to load another image then.
112
*@param pImage an ImageBuffer.
114
void cairo_dock_unload_image_buffer (CairoDockImageBuffer *pImage);
115
/** Reset and free an ImageBuffer.
116
*@param pImage an ImageBuffer.
118
void cairo_dock_free_image_buffer (CairoDockImageBuffer *pImage);
121
///void cairo_dock_update_background_decorations_if_necessary (CairoDock *pDock, int iNewDecorationsWidth, int iNewDecorationsHeight);
123
void cairo_dock_load_dock_background (CairoDock *pDock);
124
void cairo_dock_trigger_load_dock_background (CairoDock *pDock);
127
CairoDockDesktopBackground *cairo_dock_get_desktop_background (gboolean bWithTextureToo);
129
void cairo_dock_destroy_desktop_background (CairoDockDesktopBackground *pDesktopBg);
131
cairo_surface_t *cairo_dock_get_desktop_bg_surface (CairoDockDesktopBackground *pDesktopBg);
133
GLuint cairo_dock_get_desktop_bg_texture (CairoDockDesktopBackground *pDesktopBg);
135
void cairo_dock_reload_desktop_background (void);
138
void cairo_dock_unload_additionnal_textures (void);