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/>.
20
/******************************************************************************
22
This file is a part of the cairo-dock program,
23
released under the terms of the GNU General Public License.
25
Written by Fabrice Rey (for any bug report, please mail me to fabounet@users.berlios.de)
27
******************************************************************************/
32
#include "applet-struct.h"
33
#include "applet-draw.h"
36
void cd_xeyes_render_to_texture (CairoDockModuleInstance *myApplet, int iWidth, int iHeight)
38
CD_APPLET_START_DRAWING_MY_ICON_OR_RETURN ();
40
_cairo_dock_enable_texture ();
41
_cairo_dock_set_blend_alpha ();
42
_cairo_dock_set_alpha (1.);
44
if (myData.bWink && myData.iEyelidTexture)
46
_cairo_dock_apply_texture_at_size (myData.iToonTexture,
50
_cairo_dock_set_blend_pbuffer ();
53
glTranslatef (-.5*iWidth + myData.iXeyelid + .5*myData.iEyelidWidth,
54
.5*iHeight - myData.iYeyelid - .5*myData.iEyelidHeight,
56
_cairo_dock_apply_texture_at_size (myData.iEyelidTexture,
58
myData.iEyelidHeight);
63
if (myData.iBgTexture)
65
_cairo_dock_set_blend_source ();
67
glTranslatef (-.5*iWidth + myData.iXbg + .5*myData.iBgWidth,
68
.5*iHeight - myData.iYbg - .5*myData.iBgHeight,
70
_cairo_dock_apply_texture_at_size (myData.iBgTexture,
75
_cairo_dock_set_blend_alpha ();
77
for (i = 0; i < 2; i ++)
79
if (myData.iPupilTexture[i] != 0)
82
glTranslatef (-.5*iWidth + myData.fXpupil[i],
83
.5*iHeight - myData.fYpupil[i],
85
_cairo_dock_apply_texture_at_size (myData.iPupilTexture[i],
86
myData.iPupilWidth[i],
87
myData.iPupilHeight[i]);
91
_cairo_dock_set_blend_pbuffer ();
92
_cairo_dock_apply_texture_at_size (myData.iToonTexture,
97
_cairo_dock_disable_texture ();
99
CD_APPLET_FINISH_DRAWING_MY_ICON;
103
void cd_xeyes_render_to_surface (CairoDockModuleInstance *myApplet, int iWidth, int iHeight)
105
cairo_dock_erase_cairo_context (myDrawContext);
107
if (myData.bWink && myData.pEyelidSurface)
109
cairo_set_source_surface (myDrawContext,
111
.5*(iWidth - myData.iToonWidth),
112
.5*(iHeight - myData.iToonHeight));
113
cairo_paint (myDrawContext);
115
cairo_set_source_surface (myDrawContext,
116
myData.pEyelidSurface,
119
cairo_paint (myDrawContext);
123
if (myData.pBgSurface)
125
cairo_set_source_surface (myDrawContext,
129
cairo_paint (myDrawContext);
133
for (i = 0; i < 2; i ++)
135
if (myData.pPupilSurface[i])
137
cairo_set_source_surface (myDrawContext,
138
myData.pPupilSurface[i],
139
myData.fXpupil[i] - .5*myData.iPupilWidth[i],
140
myData.fYpupil[i] - .5*myData.iPupilHeight[i]);
141
cairo_paint (myDrawContext);
144
cairo_set_source_surface (myDrawContext,
146
.5*(iWidth - myData.iToonWidth),
147
.5*(iHeight - myData.iToonHeight));
150
cairo_paint (myDrawContext);
152
CD_APPLET_UPDATE_REFLECT_ON_MY_ICON;