var bitmap:TBitmap;
Name,cssElement,cssFilename:string;
i:integer;
r,r1,r2,g,g1,g2,b,b1,b2:integer;
Color1,Color2,Color:Tcolor;
Liste:TstringList;
begin
// on va préparer notre image en dégradé de couleurs
bitmap := TBitmap.create;
bitmap.width := 10;
bitmap.height:= 384;
color1 := GetParam('FirstColor','clBlack');
color2 := GetParam('LastColor','clWhite');
GetRGB(color1,r1,g1,b1);
GetRGB(Color2,r2,g2,b2);
R := R1;
G := G1;
B := B1;
for i:=0 to 192 do
begin
bitmap.pen.color := '$'+IntToHex(RGB(r,g,b),6);
bitmap.canvas.moveto(0,2*i);
bitmap.canvas.lineto(10,2*i);
bitmap.canvas.moveto(0,2*i+1);
bitmap.canvas.lineto(10,2*i+1);
R := R + (R2 - R1) div 192;
G := G + (G2 - G1) div 192;
B := B + (b2 - b1) div 192;
end;
// on sauve l'image
Name := GetParam('Name','Backgroundfade')+'.bmp';
bitmap.savetofile(name);
bitmap.free;
// on la fait connaître d'help&web
AddBitmapFile(Name);
cssElement := GetParam('cssElement','body');
if GetParam('cssInline','false')='false' then
begin
Liste:=TstringList.create;
// récupérer la liste des fichiers css pour l'écran
GetListCssFilename(Liste,'screen');
// s'il y a des fichiers css externes utiliser le premier, sinon en déclarer un
if Liste.count>0 then cssFilename := Liste.strings[0] else cssFilename := GetProjet+'_hw.css';
Liste.free;
// modifier les propriétés background-image et background-repeat de notre element
SetCss(cssFilename,cssElement,'Background-color',ColorToHtml(GetParam( 'FirstColor','clWhite')));
SetCss(cssFilename,cssElement,'Background-image','url('+getWebImage(Name)+')');
SetCss(cssFilename,cssElement,'Background-repeat','repeat-x');
SetCss(cssFilename,cssElement,'Background-attachment','fixed');
SetCss(cssFilename,cssElement,'Background-position','bottom left');
end else begin
// modifier les propriétés background-image et background-repeat de notre element
SetInlineCss(GetNom,cssElement,'Background-color',ColorToHtml(GetParam( 'FirstColor','clWhite')));
SetInlineCss(GetNom,cssElement,'Background-image','url('+getWebImage(Name)+')');
SetInlineCss(GetNom,cssElement,'Background-repeat','repeat-x');
SetInlineCss(GetNom,cssElement,'Background-attachment','fixed');
SetInlineCss(GetNom,cssElement,'Background-position','bottom left');
end;
end;
end.
Name,cssElement,cssFilename:string;
i:integer;
r,r1,r2,g,g1,g2,b,b1,b2:integer;
Color1,Color2,Color:Tcolor;
Liste:TstringList;
begin
// on va préparer notre image en dégradé de couleurs
bitmap := TBitmap.create;
bitmap.width := 10;
bitmap.height:= 384;
color1 := GetParam('FirstColor','clBlack');
color2 := GetParam('LastColor','clWhite');
GetRGB(color1,r1,g1,b1);
GetRGB(Color2,r2,g2,b2);
R := R1;
G := G1;
B := B1;
for i:=0 to 192 do
begin
bitmap.pen.color := '$'+IntToHex(RGB(r,g,b),6);
bitmap.canvas.moveto(0,2*i);
bitmap.canvas.lineto(10,2*i);
bitmap.canvas.moveto(0,2*i+1);
bitmap.canvas.lineto(10,2*i+1);
R := R + (R2 - R1) div 192;
G := G + (G2 - G1) div 192;
B := B + (b2 - b1) div 192;
end;
// on sauve l'image
Name := GetParam('Name','Backgroundfade')+'.bmp';
bitmap.savetofile(name);
bitmap.free;
// on la fait connaître d'help&web
AddBitmapFile(Name);
cssElement := GetParam('cssElement','body');
if GetParam('cssInline','false')='false' then
begin
Liste:=TstringList.create;
// récupérer la liste des fichiers css pour l'écran
GetListCssFilename(Liste,'screen');
// s'il y a des fichiers css externes utiliser le premier, sinon en déclarer un
if Liste.count>0 then cssFilename := Liste.strings[0] else cssFilename := GetProjet+'_hw.css';
Liste.free;
// modifier les propriétés background-image et background-repeat de notre element
SetCss(cssFilename,cssElement,'Background-color',ColorToHtml(GetParam( 'FirstColor','clWhite')));
SetCss(cssFilename,cssElement,'Background-image','url('+getWebImage(Name)+')');
SetCss(cssFilename,cssElement,'Background-repeat','repeat-x');
SetCss(cssFilename,cssElement,'Background-attachment','fixed');
SetCss(cssFilename,cssElement,'Background-position','bottom left');
end else begin
// modifier les propriétés background-image et background-repeat de notre element
SetInlineCss(GetNom,cssElement,'Background-color',ColorToHtml(GetParam( 'FirstColor','clWhite')));
SetInlineCss(GetNom,cssElement,'Background-image','url('+getWebImage(Name)+')');
SetInlineCss(GetNom,cssElement,'Background-repeat','repeat-x');
SetInlineCss(GetNom,cssElement,'Background-attachment','fixed');
SetInlineCss(GetNom,cssElement,'Background-position','bottom left');
end;
end;
end.