Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CommonColorBMP(Bmp : Integer; Index :Integer) :Integer;
- var
- Target, W, H, I, Hi, I2, Hi2, Hi3, C: integer;
- ColArr, CountArr :TIntegerArray;
- ColorArr :T2DIntegerArray;
- begin
- GetBitmapSize(Bmp, W, H);
- ColorArr := GetBitmapAreaColors(Bmp, 0, 0, W - 1, H - 1);
- Hi := High(ColorArr);
- Hi2 := High(ColorArr[i]);
- C := 0;
- for I := 0 to Hi do
- for I2 := 0 to Hi2 do
- begin
- If InIntArray([2171169, 526344, 460551, 131072, 0], ColorArr[I][I2]) then Continue;
- SetLength(CountArr, C + 1);
- SetLength(ColArr, C + 1);
- ColArr[C] := ColorArr[I][I2];
- CountArr[C] := CountColor(ColArr[I], 0, 0, W - 1, H - 1);
- Inc(C);
- end;
- ClearSameIntegers(ColArr);
- ClearSameIntegers(CountArr);
- Quicksort(CountArr);
- InvertTIA(CountArr);
- Hi3 := High(ColArr);
- for I := 0 to Hi3 do
- If CountColor(ColArr[I], 0, 0, W - 1, H - 1) = CountArr[Index] then
- Result := ColArr[I];
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement