type TPixel = record R,G,B: byte; end; pPixelArray = ^TPixelArray; TPixelArray = Array[0..32767] Of TPixel; procedure AAS(aBitmap: TBitmap; const pR: PRect; const Percent: single = 0.1); var PreLn, CurLn, NexLn : PPixelArray; M, L, P : Integer; aRect, bRect : TRect; nCent : single; const iCent = 0.20; begin if aBitmap.Empty then Exit; aBitmap.PixelFormat := pf24bit; bRect.Left := 1; bRect.Top := 1; bRect.Right := aBitmap.Width-2; bRect.Bottom := aBitmap.Height-2; aRect := bRect; if pR <> Nil then begin aRect := pR^; if aRect.Left < bRect.Left then aRect.Left := bRect.Left; if aRect.Top < bRect.Top then aRect.Top := bRect.Top; if aRect.Right > bRect.Right then aRect.Right := bRect.Right; if aRect.Bottom > bRect.Bottom then aRect.Bottom := bRect.Bottom; end; nCent := iCent/(Percent + iCent); for L := aRect.Top to aRect.Bottom do begin PreLn := aBitmap.ScanLine[l-1]; CurLn := aBitmap.ScanLine[l]; NexLn := aBitmap.ScanLine[l+1]; for P := aRect.Left to aRect.Right do begin m := p - 1; if (CurLn[p].R <> CurLn[m].R) or (CurLn[p].G <> CurLn[m].G) or (CurLn[p].B <> CurLn[m].B) then begin CurLn[m].R := Round(CurLn[p].R + (CurLn[m].R - CurLn[p].R) * nCent); CurLn[m].G := Round(CurLn[p].G + (CurLn[m].G - CurLn[p].G) * nCent); CurLn[m].B := Round(CurLn[p].B + (CurLn[m].B - CurLn[p].B) * nCent); end; m := p + 1; if (CurLn[p].R <> CurLn[m].R) or (CurLn[p].G <> CurLn[m].G) or (CurLn[p].B <> CurLn[m].B) then begin CurLn[m].R := Round(CurLn[p].R + (CurLn[m].R - CurLn[p].R) * nCent); CurLn[m].G := Round(CurLn[p].G + (CurLn[m].G - CurLn[p].G) * nCent); CurLn[m].B := Round(CurLn[p].B + (CurLn[m].B - CurLn[p].B) * nCent); end; if (CurLn[p].R <> PreLn[P].R) or (CurLn[p].G <> PreLn[P].G) or (CurLn[p].B <> PreLn[P].B) then begin PreLn[P].R := Round(CurLn[p].R + (PreLn[P].R - CurLn[p].R) * nCent); PreLn[P].G := Round(CurLn[p].G + (PreLn[P].G - CurLn[p].G) * nCent); PreLn[P].B := Round(CurLn[p].B + (PreLn[P].B - CurLn[p].B) * nCent); end; if (CurLn[p].R <> NexLn[P].R) or (CurLn[p].G <> NexLn[P].G) or (CurLn[p].B <> NexLn[P].B) then begin NexLn[P].R := Round(CurLn[p].R + (NexLn[P].R - CurLn[p].R) * nCent); NexLn[P].G := Round(CurLn[p].G + (NexLn[P].G - CurLn[p].G) * nCent); NexLn[P].B := Round(CurLn[p].B + (NexLn[P].B - CurLn[p].B) * nCent); end; end; end; end;
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.