Program Realisation 2 http://www.win.tue.nl/˜hemerik/2IP20/ Lecture 9 Kees Hemerik Tom Verhoeff Technische Universiteit Eindhoven Faculteit Wiskunde en Informatica Software Engineering & Technology Feedback to T.Verhoeff@TUE.NL
c 2006, T. Verhoeff @ TUE.NL 1 Program Realization 2: Lecture 9
Today’s Topics
- Pixels, coordinates, and rectangles in Delphi
- Event mechanism in Delphi
- Memory leaks, dangling references
- UML: Unified Modeling Language
- (Automated unit testing)
- Conclusion
c 2006, T. Verhoeff @ TUE.NL 2 Program Realization 2: Lecture 9
Pixels and coordinates
x=0 1 2 3 y=0 1 2 y=0 1 2 3 x=0 1 2 3 4
- Pixels are not points, but little squares
- Coordinate options:
through pixel centers , between pixels
- For many purposes, coordinates between pixels are preferred
c 2006, T. Verhoeff @ TUE.NL 3 Program Realization 2: Lecture 9
Rectangles
- FillRect(XL, YL, XH, YH) colors the points x, y such that
XL ≤ x < XH ∧ YL ≤ y < YH
- It has width XH - XL and height YH - YL
- FillRect(X0, YL, X1, YH) and FillRect(X1, YL, X2, YH) are horizon-
tally adjacent: they touch, but do not overlap
- FillRect(X, YL, X, YH) is empty
- Scales well: FillRect(0, 0, XH, YH) vs. FillRect(0, 0, 2*XH, 2*YH)
- Edsger W. Dijkstra. Why numbering should start at zero. EWD 831,
- Aug. 1982
c 2006, T. Verhoeff @ TUE.NL 4 Program Realization 2: Lecture 9