sources:


website:
more info here


screenshot:
studies/grafik/Computergrafik-Code2/Aufgabe5/cgairbrush.h
download file

  1 // Computergrafik I
  2 // Prof. Dr. Juergen Doellner
  3 // Sommersemester 2001
  4 //
  5 // Programmrahmen fuer Aufgabe 5
  6
  7 // Stephan Brumme, 702544
  8 // last changes: May 01, 2001
  9
 10 #ifndef CG_BRUSH_H
 11 #define CG_BRUSH_H
 12
 13 #include "cgapplication.h"
 14
 15 class CGAirbrush : public CGApplication {
 16 public:
 17     CGAirbrush(unsigned int brushPatternSize);
 18     virtual ~CGAirbrush();
 19
 20     // Auf folgende Ereignisse soll reagiert werden:
 21     virtual void onInit();
 22     virtual void onDraw();
 23     virtual void onSize(unsigned int newWidth, unsigned int newHeight);
 24     virtual void onButton(MouseButton button, int x, int y);
 25     virtual void onMove(int x, int y);
 26     virtual void onKey(unsigned char key);
 27
 28     void setArbitraryPattern();
 29     void setConstantPattern(float fOpacity);
 30     void setRadialPattern();
 31     void setColor(GLfloat red, GLfloat green, GLfloat blue);
 32
 33 private:
 34     // Eine Hilfsklasse, die eine Farbe als
 35     // Tupel (r, g, b, alpha) darstellt.
 36     struct Color {
 37         GLfloat r;
 38         GLfloat g;
 39         GLfloat b;
 40         GLfloat alpha;
 41     };
 42
 43     // Speichert die Groesse der Schablone.
 44     // Die Schablone ist quadratisch.
 45     unsigned int m_brushPatternSize;
 46
 47     // Enthaelt die Farbinformationen der einzelnen Pixel
 48     // der Schablone.
 49     Color*       m_brushPattern;
 50 };
 51
 52 #endif // CG_BRUSH_H
 53
 54