Advertisement
Advertisement
| 08.07.2008 at 01:59PM PDT, ID: 23631004 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: |
unit ColourFinder;
{$O+}
interface
uses Windows, Variants, Graphics, Sysutils, Forms;
type
TRGB24 = packed Record
b,g,r: Byte;
end;
TRGB24Array = Array [0..MaxInt div SizeOf(TRGB24)-1] of TRGB24;
PRGB24Array = ^TRGB24Array;
var
SBMP : TBitmap; //Search bitmap
Scanlines: Array of PRGB24Array; //scanlines
I: Integer; //for for loop for getting the scanlines
function FindColor(var x, y: Integer; color, xs, ys, xe, ye: Integer; ClientDC : HDC): Boolean;
implementation
function FindColor(var x, y: Integer; color, xs, ys, xe, ye: Integer; ClientDC : HDC): Boolean;
var
xx, yy: Integer;
R, G, B: Byte;
begin
R:= color;
G:= color shr 8;
B:= color shr 16;
BitBlt(SBMP.Canvas.Handle, xs, ys, xe - xs, ye - ys, ClientDC, xs, ys, SRCCOPY);
for yy:= ys to ye do
for xx:= xs to xe do
if(Scanlines[yy][xx].R = R)then if(Scanlines[yy][xx].G = G)then if(Scanlines[yy][xx].B = B)then
begin
x:= xx;
y:= yy;
Result:= True;
exit;
end;
Result:= False;
x:= -1;
y:= -1;
end;
initialization
SBMP := TBitmap.Create; //Create the search bitmap
SBMP.Width:= Screen.Width;
SBMP.Height:= Screen.Height;
SetLength(Scanlines, SBMP.Height);
SBMP.PixelFormat:= pf24bit;
for I:= 0 to SBMP.Height - 1 do
Scanlines[i]:= SBMP.ScanLine[i];
ClientDC := GetDC(0);
end.
|