11 #include <tqpainter.h>
13 #include "kpixmapeffect.h"
15 #include "kimageeffect.h"
25 const TQColor &cb, GradientType eff,
int ncols)
27 if(pixmap.depth() > 8 &&
28 (eff == VerticalGradient || eff == HorizontalGradient)) {
30 int rDiff, gDiff, bDiff;
35 rDiff = ( cb.red()) - (rca = ca.red());
36 gDiff = ( cb.green()) - (gca = ca.green());
37 bDiff = ( cb.blue()) - (bca = ca.blue());
43 int rcdelta = ((1<<16) / (eff == VerticalGradient ? pixmap.height() : pixmap.width())) * rDiff;
44 int gcdelta = ((1<<16) / (eff == VerticalGradient ? pixmap.height() : pixmap.width())) * gDiff;
45 int bcdelta = ((1<<16) / (eff == VerticalGradient ? pixmap.height() : pixmap.width())) * bDiff;
52 case VerticalGradient:
53 for ( y = 0; y < pixmap.height(); y++ ) {
58 p.setPen(TQColor(rl>>16, gl>>16, bl>>16));
59 p.drawLine(0, y, pixmap.width()-1, y);
62 case HorizontalGradient:
63 for( x = 0; x < pixmap.width(); x++) {
68 p.setPen(TQColor(rl>>16, gl>>16, bl>>16));
69 p.drawLine(x, 0, x, pixmap.height()-1);
89 const TQColor &cb, GradientType eff,
int xfactor,
int yfactor,
94 xfactor, yfactor, ncols);
111 TQImage image = pixmap.convertToImage();
122 RGBComponent channel)
124 TQImage image = pixmap.convertToImage();
141 const TQColor &bgnd, GradientType eff,
142 bool anti_dir,
int ncols)
145 TQImage image = pixmap.convertToImage();
146 if (image.depth() <=8)
147 image = image.convertDepth(32);
154 if(pixmap.depth() <= 8 ) {
155 if ( ncols < 2 || ncols > 256 )
157 TQColor *dPal =
new TQColor[ncols];
158 for (
int i=0; i<ncols; i++) {
159 tmp = 0 + 255 * i / ( ncols - 1 );
160 dPal[i].setRgb ( tmp, tmp, tmp );
180 unsigned int spacing,
int ncols)
182 TQImage image = pixmap.convertToImage();
187 if(pixmap.depth() <= 8 ) {
188 if ( ncols < 2 || ncols > 256 )
190 TQColor *dPal =
new TQColor[ncols];
191 for (
int i=0; i<ncols; i++) {
192 tmp = 0 + 255 * i / ( ncols - 1 );
193 dPal[i].setRgb ( tmp, tmp, tmp );
214 const TQColor &cb,
unsigned pat[8])
216 TQImage img =
pattern(pixmap.size(), ca, cb, pat);
224 const TQColor &ca,
const TQColor &cb,
int ncols)
226 if (pmtile.depth() > 8)
229 TQImage img = pmtile.convertToImage();
245 p.drawTiledPixmap(0, 0, size.width(), size.height(), pixmap);
259 TQImage img = pixmap.convertToImage();
270 TQImage img = pixmap.convertToImage();
280 TQImage img = pixmap.convertToImage();
289 TQImage img = pixmap.convertToImage();
305 TQImage img = pixmap.convertToImage();
320 TQImage img = pix.convertToImage();