1 // ----------------------------------------------------------------
3 // kscience - screen saver for KDE
5 // copyright (c) Rene Beutler 1998
14 #include <QPaintEvent>
16 #include <kscreensaver.h>
23 typedef signed int T32bit
;
27 class KPreviewWidget
: public QWidget
31 KPreviewWidget( QWidget
*parent
);
32 void paintEvent( QPaintEvent
*event
);
33 void notifySaver( KScienceSaver
*s
= 0 );
40 class KScienceSaver
: public KScreenSaver
44 KScienceSaver( WId id
, bool setup
=false, bool gP
=false);
45 virtual ~KScienceSaver();
47 void do_refresh( const QRect
& rect
);
48 void setMode ( int mode
);
49 void setMoveX ( signed int s
);
50 void setMoveY ( signed int s
);
51 void setMove ( bool s
);
52 void setSize ( signed int s
);
53 void setIntensity ( signed int s
);
54 void setSpeed ( signed int s
);
55 void setInverse ( bool b
);
56 void setGravity ( bool b
);
57 void setHideBG ( bool b
);
59 void myAssert( bool term
, const char *sMsg
);
66 void (KScienceSaver::*applyLens
)(int xs
, int ys
, int xd
, int yd
, int w
, int h
);
72 void grabRootWindow();
73 void grabPreviewWidget();
75 void initSphereLens();
76 void initExponentialLens();
78 void initCurvatureLens();
79 void blackPixel( int x
, int y
);
80 void blackPixelUndo( int x
, int y
);
81 void applyLens8bpp( int xs
, int ys
, int xd
, int yd
, int w
, int h
);
82 void applyLens16bpp(int xs
, int ys
, int xd
, int yd
, int w
, int h
);
83 void applyLens24bpp(int xs
, int ys
, int xd
, int yd
, int w
, int h
);
84 void applyLens32bpp(int xs
, int ys
, int xd
, int yd
, int w
, int h
);
90 bool inverse
[MAX_MODES
];
91 bool gravity
[MAX_MODES
];
92 bool hideBG
[MAX_MODES
];
93 signed int size
[MAX_MODES
];
94 signed int moveX
[MAX_MODES
];
95 signed int moveY
[MAX_MODES
];
96 signed int speed
[MAX_MODES
];
97 signed int intensity
[MAX_MODES
];
100 signed int bpp
, side
;
101 int border
, radius
, diam
, origin
;
103 char blackRestore
[4];
108 class KScienceSetup
: public KDialog
112 KScienceSetup(QWidget
*parent
=0, const char *name
=0);
115 void updateSettings();
119 void slotMode( int );
123 void slotMoveX( int );
124 void slotMoveY( int );
125 void slotSize( int );
126 void slotIntensity( int );
127 void slotSliderPressed();
128 void slotSliderReleased();
129 void slotSpeed( int );
134 KPreviewWidget
*preview
;
135 KScienceSaver
*saver
;
136 QSlider
*slideSize
, *slideSpeed
, *slideIntensity
;
137 QSlider
*slideMoveX
, *slideMoveY
;
138 QCheckBox
*checkInverse
, *checkGravity
, *checkHideBG
;
141 bool inverse
[MAX_MODES
];
142 bool gravity
[MAX_MODES
];
143 bool hideBG
[MAX_MODES
];
144 int moveX
[MAX_MODES
];
145 int moveY
[MAX_MODES
];
146 int size
[MAX_MODES
];
147 int intensity
[MAX_MODES
];
148 int speed
[MAX_MODES
];