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/>.
27
#include <glitz-glx.h>
28
#include <cairo-glitz.h>
31
#include "cairo-dock-icons.h"
32
#include "cairo-dock-load.h"
33
#include "cairo-dock-surface-factory.h"
34
#include "cairo-dock-log.h"
35
#include "cairo-dock-internal-icons.h"
36
#include "cairo-dock-dock-factory.h"
37
#include "cairo-dock-separator-factory.h"
40
cairo_surface_t *cairo_dock_create_separator_surface (cairo_t *pSourceContext, double fMaxScale, gboolean bIsHorizontal, gboolean bDirectionUp, double *fWidth, double *fHeight)
42
g_return_val_if_fail (cairo_status (pSourceContext) == CAIRO_STATUS_SUCCESS, NULL);
44
cairo_surface_t *pNewSurface = NULL;
45
if (myIcons.cSeparatorImage == NULL)
47
*fWidth = myIcons.tIconAuthorizedWidth[CAIRO_DOCK_SEPARATOR12];
48
*fHeight = myIcons.tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR12];
49
pNewSurface = _cairo_dock_create_blank_surface (pSourceContext,
50
ceil (*fWidth * fMaxScale),
51
ceil (*fHeight * fMaxScale));
55
gchar *cImagePath = cairo_dock_generate_file_path (myIcons.cSeparatorImage);
56
double fRotationAngle; // on est oblig� de faire la rotation maintenant plutot que pendant le dessin, a cause du reflet a charger en cairo.
57
if (! myIcons.bRevolveSeparator)
59
else if (bIsHorizontal)
63
fRotationAngle = G_PI;
66
fRotationAngle = -G_PI/2;
68
fRotationAngle = G_PI/2;
70
pNewSurface = cairo_dock_create_surface_from_image (cImagePath,
73
myIcons.tIconAuthorizedWidth[CAIRO_DOCK_SEPARATOR12],
74
myIcons.tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR12],
75
CAIRO_DOCK_FILL_SPACE,
79
if (fRotationAngle != 0) /// le faire pendant le dessin ...
81
cairo_surface_t *pNewSurfaceRotated = cairo_dock_rotate_surface (pNewSurface, pSourceContext, *fWidth * fMaxScale, *fHeight * fMaxScale, fRotationAngle);
82
cairo_surface_destroy (pNewSurface);
83
pNewSurface = pNewSurfaceRotated;
93
Icon *cairo_dock_create_separator_icon (cairo_t *pSourceContext, int iSeparatorType, CairoDock *pDock)
95
//g_print ("%s ()\n", __func__);
96
if ((iSeparatorType & 1) && ! myIcons.iSeparateIcons)
99
//\____________ On cree l'icone.
100
Icon *icon = g_new0 (Icon, 1);
101
icon->iType = iSeparatorType;
103
//\____________ On remplit ses buffers.
104
cairo_dock_fill_icon_buffers_for_dock (icon, pSourceContext, pDock);
105
///cairo_dock_fill_one_icon_buffer (icon, pSourceContext, 1 + myIcons.fAmplitude, pDock->container.bIsHorizontal, pDock->container.bDirectionUp);