Les Snippets

Connexion

Effets "night vision" sur un bitmap

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 03/07/2008 19:50:48 et initié par f0xi [Liste]
Date de mise à jour : 03/07/2008 20:00:11
Vue : 480
Catégorie(s) : Graphique
Langages dispo pour ce code :
- Delphi 5



Langage : Delphi 5
Date ajout : 03/07/2008
Posté par f0xi [Liste]
DateMAJ : 03/07/2008
type
   pByteQuad = ^ByteQuad;
   ByteQuad  = array[0..3] of byte;
 
 
 procedure XRay(Src : TBitmap; Dest : TBitmap);
 var
   X,Y   : integer;
   pPix  : pByteQuad;
   COEF  : array[0..255] of byte;
 begin
   if Src.PixelFormat <> pf32bit then
   begin
     Src.PixelFormat  := pf32Bit;
     Dest.PixelFormat := pf32Bit;
   end;
   Dest.Assign(Src);
 
   { PreCalculs }
   for X := 0 to 255 do
     COEF[X] := byte( round(X * (X*0.00390625)) );
 
   pPix := Dest.ScanLine[Dest.Height-1];
   { l'effet de scanline necessite de connaitre le numero
     de ligne sur laquelle on travaille, afin d'eviter des
     calcul complexe a partir du pointeur pPix...
     on double boucle Y,X :) }
   for Y := 0 to Dest.Height-1 do
     for X := 0 to Dest.Width-1 do
     begin
       case (Y and $1) of
         0: pPix^[1] := not pPix^[1];
         1: pPix^[1] := COEF[not pPix^[1]];
       end;
       pPix^[0] := COEF[pPix^[1]];
       pPix^[2] := COEF[pPix^[1]];
 
       inc(pPix);
     end;
 end;

{ version avec pré-calculs externes } type   pByteQuad = ^ByteQuad;   ByteQuad  = array[0..3] of byte; { ... } var   precalc_XRayCOEF  : array[0..255] of byte; { ... } procedure XRay(Src : TBitmap; Dest : TBitmap); var   X,Y   : integer;   pPix  : pByteQuad; begin   if Src.PixelFormat <> pf32bit then   begin     Src.PixelFormat  := pf32Bit;     Dest.PixelFormat := pf32Bit;   end;   Dest.Assign(Src);   pPix := Dest.ScanLine[Dest.Height-1];   for Y := 0 to Dest.Height-1 do     for X := 0 to Dest.Width-1 do     begin       case (Y and $1) of         0: pPix^[1] := not pPix^[1];         1: pPix^[1] := precalc_XRayCOEF[not pPix^[1]];       end;       pPix^[0] := precalc_XRayCOEF[pPix^[1]];       pPix^[2] := precalc_XRayCOEF[pPix^[1]];       inc(pPix);     end; end; { ... } var init_X : integer; initialization   for init_X := 0 to 255 do     precalc_XRayCOEF[init_X] := byte( round(init_X * (init_X*0.00390625)) );

Snippets en rapport avec : Bitmap, Filtre, Effet, Vision nuit, Night vision



Codes sources en rapport avec : Bitmap, Filtre, Effet, Vision nuit, Night vision

{Delphi} DÉFILEMENT HORIZONTAL OU VERTICAL
Réalise un défilement horizontal, en quelque clicks, - Ses défauts: Défile une image (Une parfait...

{Delphi} BAC À SABLE
Bon, je vais essayer de me rattraper après mon dernier post.... Retour aux sources (sans jeux de mo...

{Delphi} EFFET NEIGE PARASITE D'ECRAN DE TELE (PURE GDI)
Salut, suite a une interrogation de Emhandal, voici, un effet simple de l'effet neige parasite d'une...

{Visual Basic, VB6, VB.NET, VB 2005} UN EFFET WATER SUR VOS IMAGES
une petite source avec un effet d'eau sur une image,pour bien réaliser le code j'ai du écrire la par...

{Flash} FLASH 8, EXEMPLE DE FLOU
Un exemple de ce que l'on peut faire avec les nouveautés de flash 8 ! Ici le filtre blur (flou). En...

{IRC} GALERIE DE FILTRES V0.1
Salut a tous, Ce vous propose ce pettit "add-on" qui permet d'appliquer un certains nombre de filtr...

{Graphisme} EFFET DESSIN
c extremement facile -Pour commence ouvrez votre image -dupliquez l'image -dans la copie mete le ...

{Delphi} A PROPOS DE FILTRE BITMAP
Suite à "APPLIQUER FILTRE BITMAP" de notre ami yvemoreau et à l'abondante documentation qui a suivi...

{JAVA / J2EE} FILTRES POUR IMAGES
C'est une bibliotheque de filtres et d'effets pour image. Elle contient les filtres classiques sur ...

{Graphisme} TUTORIAL 12# : CREER UN EFFET CENTRE SUR UN POINT
Voici comment genere beaucoup d effets selon un seul filtre (capture), telecharger le fichier zip, e...