BMP files

Note: in many instances the bit map is stored inverted if inverted biHeight is positive if not inverted it is negative
Blitter (some allow scaling and rotation) with directx must have hardware support for rotation no hardware support needed for scaling
Color keying ~P360
Source key color keying (prevalent way of doing color keying) – blit setting color key using setColorKey( ) allows a range of colors to be transparent
Destination key color keying – works in theory but not many people use it… i.e. doesn’t work as well
Scaling – 1x4 pixel rectangle
0 20
1 5
2 12
3 86
Array || color code
1x8 pixel rectangle
0 20
1 20
2 5
3 5
4 12
5 12
6 86
7 86
When scaled you now have 2x as many à starts to distort
When you scale the other direction you start losing information
Scale down to 1x2
0 20
1 2
we lost the color 5 and 86 oops
Crude filter
Source height = 4
Destination height = 3
Sample = 4/3 = 1.33 algorithm is on Page371
Based on the ratio of the heights you pick up more information
Demo 7.14 shows the scaling effects
Simulated animation with blinking lights
Algorithm for shifting P380

SetEntries( );
getEntries( );
Mixing GDI with directx – cooperative level is set to full screen and exclusive
Why do this? GDI is much better at drawing text menu’s dialog boxes etc.
3 choices
P384
2D raster graphics or vector graphics (Asteroids/battle zone)
Advantages of vector graphics –
Disadvantage of vector graphics
Advantages of using raster graphics
Disadvantage of raster graphics
2D graphics
Drawing lines – problem making a chain of pixels to come up with the picture
![]()
Breghems algorithm Chapter 8 P403
Clipping
![]()
Cohen-Sutherland algorithm P428 – see book

accept
P0 + P1 = 0
reject
P0 & P2 != 0
Polygons
Required data to draw polygons
Position the object
Motion/transformation
![]()
X0 = x0 * 5x
Y0 = y0 * 5y
X1 = x0 * cos (q) – y0sin (q)
Y1 = y0 * cos (q) + x0sin (q)

Matrix operations
Translations º [x y 1] … treats point as a row vector
|
|
Transformation matrix |
||||||||||||
|
|
Scaling matrix |
||||||||||||
|
|
Rotation matrix |