Como instalar el componente tProeffectimage

Continuando con el post de ayer

http://delphimagic.blogspot.com/2011/05/programa-para-generar-efectos-graficos.html

a continuación os muestro cómo instalarlo en Windows XP:



Instalación en Delphi 7:



1) Abrimos el archivo dclusr.dpk que está en

c:\archivos de programa\borland\delphi7\lib

2) En la ventana que nos aparece pulsamos el botón "Add"

3) Desde la pestaña "Add unit" y en la caja "Unit File name" localizamos el archivo Proeffectimage.pas y pulsamos el botón OK

4) Después pulsamos el botón "Compile" y "Install" y si todo está correcto veremos en la pestaña de componentes "Samples" el icono Proeffectimage.



Instalación en Delphi 2009:



Es prácticamente igual lo que cambia es que hay que abrir el archivo dclusr.dproj que está en

c:\archivos de programa\CodeGear\RadStudio\6.0\lib

y después hay que ir al menú View->Project Manager












Programa para generar efectos gráficos


Con el componente freeware tProeffectimage escrito por Babak Sateli podrán generar alucinantes efectos gráficos en sus programas, además de una manera muy sencilla ya que lo único que hay que hacer es añadir un trackbar para obtener el parámetro asociado a cada una de las funciones ( está probado en Delphi 7 y Delphi 2009) :



El siguiente código viene en el ejemplo que acompaña a la instalación:



Case EffectsList.ItemIndex of

0: ProEffectImage.Effect_GaussianBlur (TrackBar.Position);

1: ProEffectImage.Effect_SplitBlur (TrackBar.Position);

2: ProEffectImage.Effect_AddColorNoise (TrackBar.Position * 3);

3: ProEffectImage.Effect_AddMonoNoise (TrackBar.Position * 3);

4: For i:=1 to TrackBar.Position do

ProEffectImage.Effect_AntiAlias;

5: ProEffectImage.Effect_Contrast (TrackBar.Position * 3);

6: ProEffectImage.Effect_FishEye (TrackBar.Position div 10+1);

7: ProEffectImage.Effect_Lightness (TrackBar.Position * 2);

8: ProEffectImage.Effect_Darkness (TrackBar.Position * 2);

9: ProEffectImage.Effect_Saturation (255-((TrackBar.Position * 255) div 100));

10: ProEffectImage.Effect_Mosaic (TrackBar.Position div 2);

11: ProEffectImage.Effect_Twist (200-(TrackBar.Position * 2)+1);

12: ProEffectImage.Effect_Splitlight (TrackBar.Position div 20);

13: ProEffectImage.Effect_Tile (TrackBar.Position div 10);

14: ProEffectImage.Effect_SpotLight (TrackBar.Position ,

Rect (TrackBar.Position ,

TrackBar.Position ,

TrackBar.Position +TrackBar.Position*2,

TrackBar.Position +TrackBar.Position*2));

15: ProEffectImage.Effect_Trace (TrackBar.Position div 10);

16: For i:=1 to TrackBar.Position do

ProEffectImage.Effect_Emboss;

17: ProEffectImage.Effect_Solorize (255-((TrackBar.Position * 255) div 100));

18: ProEffectImage.Effect_Posterize (((TrackBar.Position * 255) div 100)+1);

19: ProEffectImage.Effect_Grayscale;

20: ProEffectImage.Effect_Invert;



end;{Case}



Fuente:

babak_sateli@yahoo.com

http://raveland.netfirms.com




Descargar codigo











Detector de movimiento con Delphi



Este software detecta el movimiento entre imágenes tomadas por una webcam, se pueden ajustar varios parámetros como la sensibilidad, pixels verificados y el retardo antes de avisar. Cuando salta un aviso nos enviará un email ( antes hay que cambiar el nombre del host SMTP ) y se guardará en la carpeta "detection" una imagen jpg de ese instante.

Es interesante observar cómo se inicializa el dispositivo de captura de imagen de la siguiente forma:



hcam:=capCreateCaptureWindowA('',0,0,0,320,240,handle,0);

sendmessage(hcam,1034,0,0);

form1.DoubleBuffered:=true;



Descargar codigo fuente


















Ejemplo de uso de un proxy con Delphi

Este es un ejemplo de utilización de un proxy con indy.
Es interesante observar cómo se programa el componente AntiFreeze que se utiliza para evitar el bloqueo de la aplicación, ya que indy trabaja en modo no asíncrono, de tal forma que cuando se intenta realizar una conexión la aplicación se quedará bloqueada hasta que lo consiga, añadiendo el componente AntiFreeze se consigue minimizar este comportamiento.
El procedimiento UTF8ToWideString está en la biblioteca JEDI VCL.
procedure TForm1.Button1Click(Sender: TObject);
Var
Resp : String;
begin
Resp := webSession('http://www.elmundo.es');
if Length(Resp)>0 then
MessageDlg('Got the body ok',mtInformation,[mbOk],0);
end;

function TForm1.webSession(sURL : ansistring) : ansistring;
var
SStream : Tstringstream;
HTTPCon : TIdHTTP;
AntiFreeze : TIdAntiFreeze;
begin
Result := '';
if Length(SettingsForm.edtProxyServer.text) >= 7 then // 0.0.0.0
Try
SStream := NIL;
AntiFreeze := NIL;
HTTPCon := NIL;
Try
SStream := tstringstream.Create('');
{ Create & Set IdHTTP properties }
HTTPCon := TIdHTTP.create;
HTTPCon.HandleRedirects := true;
{ Check Proxy }
if checkproxy('http://www.google.com') then
Begin
HTTPCon.ProxyParams.ProxyServer := SettingsForm.edtProxyServer.text;
HTTPCon.ProxyParams.ProxyPort := StrToInt(SettingsForm.edtProxyPort.Text);
HTTPCon.ProxyParams.BasicAuthentication := True;
HTTPCon.ProxyParams.ProxyUsername := SettingsForm.edtProxyServer.Text;
HTTPCon.ProxyParams.ProxyPassword := SettingsForm.edtProxyUserName.Text;
End;
{ Create another AntiFreeze - only 1/app }
AntiFreeze := TIdAntiFreeze.Create(nil);
AntiFreeze.Active := true;
HTTPCon.Get(sURL,SStream);
Result := UTF8ToWideString(SStream.DataString);
Finally
If Assigned(HTTPCon) then FreeAndNil(HTTPCon);
If Assigned(AntiFreeze) then FreeAndNil(AntiFreeze);
If Assigned(SStream) then FreeAndNil(SStream);
End;
Except
{ Handle exceptions }
On E:Exception do
MessageDlg('Exception: '+E.Message,mtError, [mbOK], 0);
End;
end;

function TForm1.checkproxy(sURL : ansistring) : boolean;
var
HTTPCon : TIdHTTP;
AntiFreeze : TIdAntiFreeze;
begin
Result := False;
Try
{ Inti vars }
AntiFreeze := NIL;
HTTPCon := NIL;
Try
{ AntiFreeze }
AntiFreeze := TIdAntiFreeze.Create(NIL);
AntiFreeze.Active := true;
{ Create & Set IdHTTP properties }
HTTPCon := TIdHTTP.Create(NIL);
HTTPCon.ProxyParams.ProxyServer := SettingsForm.edtProxyServer.text;
HTTPCon.ProxyParams.ProxyPort := StrToInt(SettingsForm.edtProxyPort.Text);
HTTPCon.ProxyParams.BasicAuthentication := True;
HTTPCon.ProxyParams.ProxyUsername := SettingsForm.edtProxyServer.Text;
HTTPCon.ProxyParams.ProxyPassword := SettingsForm.edtProxyUserName.Text;
HTTPCon.HandleRedirects := true;
HTTPCon.ConnectTimeout := 1000;
HTTPCon.Request.Connection := 'close';
HTTPCon.Head(sURL);
Finally
{ Cleanup }
if Assigned(HTTPCon) then
Begin
{ Return Success/Failure }
Result := HTTPCon.ResponseCode = 200;
If HTTPCon.Connected then HTTPCon.Disconnect;
FreeAndNil(HTTPCon);
End;
if Assigned(AntiFreeze) then FreeAndNil(AntiFreeze);
End;
Except
On E:EIdException do ;
{ Handle exceptions }
On E:Exception do
MessageDlg('Exception: '+E.Message,mtError, [mbOK], 0);
End;
end;

Obtener parametros de los paneles solares

Programa que calcula partiendo de los siguientes datos: (se obtienen de la hoja de características del fabricante de los módulos fotovoltaic...