- 4.37.2.23. -
Table of Contents
4. Standard Units
4.37. Graph - Graph unit
4.37.2. Graph Unit Procedures and Functions
4.37.2.23. FlipImageOY procedure
4.37.2.23. FlipImageOY procedure
Targets: MS-DOS, Win32
Graph Unit
Flips an image (BitMap) top to bottom.
Declaration:
procedure FlipImageOY(var BitMap);
Example:
uses Graph, CRT;
var
P: Pointer;
i, j, dx, dy: DWORD;
begin
(* Set SVGA mode 640x480x256.
You can set ANY supported mode *)
SetSVGAMode(640, 480, 8, LfbOrBanked);
if GraphResult <> grOk then begin
ClrScr;
Writeln(GraphErrorMsg(GraphResult));
exit;
end;
dx := (GetMaxX + 1) div 2;
dy := (GetMaxY + 1) div 2;
for i := 0 to dx do
for j := 0 to dy do
PutPixel(i, j, i * j div dx);
SetTextJustify(CenterText, BottomText);
OutTextXY(dx, dy + dy div 2, 'Press any key...');
ReadKey;
GetMem(P, ImageSize(0, 0, dx - 1, dy - 1));
GetImage(0, 0, dx - 1 , dy - 1, P^);
FlipImageOX(P^);
PutImage(dx, 0, P^);
FlipImageOY(P^);
PutImage(dx, dy, P^);
FlipImageOX(P^);
PutImage(0, dy, P^);
ReadKey;
FreeMem(P, ImageSize(0, 0, dx - 1, dy - 1));
RestoreCrtMode;
end.
- 4.37.2.23. -