Slideshow
Slideshow
program Slideshow;
uses Types, QuickDraw, Events, GSOS, CTIUtils, MiscTool;
const
MAX = 7;
var
tick: LongInt;
title: Integer;
titles: array[0..MAX] of String;
{ Load Image }
procedure loadImage(path: string);
var
openRec: OpenRecGS;
ioRec: IORecGS;
closeRec: RefNumRecGS;
pathNameGS: GSstring255;
begin
{ Open image }
p2GSstring(path, pathNameGS);
openRec.pCount := 2;
openRec.pathName := @pathNameGS;
openGS(openRec);
{ Read into memory }
if _ToolErr = 0 then begin
ioRec.pCount := 4;
ioRec.refNum := openRec.refNum;
ioRec.dataBuffer := ptr($E12000);
ioRec.requestCount := 32768;
readGS(ioRec);
closeRec.pCount := 1;
closeRec.refNum := openRec.refNum;
closeGS(closeRec);
end;
end;
{ Fade screen }
procedure fade;
var
i, j, k, color, cbit: Integer;
begin
cbit := 256;
for i := 1 to 3 do begin
for j := 0 to 15 do begin
for k := 0 to 15 do begin
color := getColorEntry(0, k) - cbit;
if color < 0 then color := 0;
setColorEntry(0, k, color);
end;
repeat until getTick > tick;
tick := getTick;
end;
cbit := cbit div 16;
end;
end;
begin
graphics(320);
hideCursor;
{ Setup }
title := 0;
titles[0] := 'Pam.pic';
titles[1] := 'Girl.pic';
titles[2] := ‘RedHood.pic’;
titles[3] := 'Clown.pic';
titles[4] := 'Fruits.pic';
titles[5] := 'Flower.pic';
titles[6] := 'Taj.pic';
titles[7] := 'Dragon.pic';
repeat
tick := getTick;
loadImage(titles[title]);
repeat
if button(0) then begin
fade;
exit;
end;
until getTick - tick > 200;
tick := getTick;
inc(title);
if title > MAX then title := 0;
fade;
until button(0);
end.
A slideshow program for the beautiful pictures in graphics gallery,
This program shows how to load a 320x200 Super Hires picture on screen, then fade off. The loadImage procedure can be used as a black box in any program to load a Super Hires image. The fading of the screen is done by reducing the intensity of red, green, blue components of all the colors in the palette.