sources:
cgapplication.cpp (3.6k)
cgapplication.h (4.1k)
cgmidpoint.cpp (4.0k)
cgmidpoint.h (1024 bytes)
cgraster.cpp (2.2k)
cgraster.h (713 bytes)


website:
more info here


screenshot:
studies/grafik/Computergrafik-Code3/cgmidpoint.h
download file

  1 // Computergraphik I
  2 // Prof. Dr. Juergen Doellner
  3 // Sommersemester 2001
  4 //
  5 // Rahmenprogramm fuer Aufgabenzettel 3
  6
  7 // Stephan Brumme, 702544
  8 // last changes: May 12, 2001
  9
 10 #ifndef CG_BRESENHAM_H
 11 #define CG_BRESENHAM_H
 12
 13 #include "cgapplication.h"
 14 #include "cgraster.h"
 15
 16 class CGMidpoint : public CGApplication {
 17 public:
 18     CGMidpoint(int width, int height);
 19
 20     virtual void onInit();
 21     virtual void onDraw();
 22     virtual void onSize(unsigned int newWidth,unsigned  int newHeight);
 23
 24     virtual void onButton(MouseButton button, MouseButtonEvent event, int x, int y);
 25     virtual void onMove(MouseButton button, int x, int y);
 26
 27 private:
 28     // zeichenen der Linie in das Raster raster_
 29     void drawLine(int x1, int y1, int x2, int y2);
 30
 31     // interne Raster-Klasse
 32     CGRaster raster_;
 33
 34     // Fenstergroesse speichern
 35     int winWidth_;
 36     int winHeight_;
 37
 38     // Linienanfangspunkt und Endpunkt
 39     int xBegin_;
 40     int yBegin_;
 41     int xEnd_;
 42     int yEnd_;
 43     bool First_;
 44 };
 45
 46 #endif // CG_BRESENHAM_H
 47
 48