Turbine1991 Posted November 28, 2012 Share Posted November 28, 2012 (edited) The last time I used the finding image functionality in an older version of SCAR there was a function solely to this. I'm only guessing, but I assume the FindBitmap functions will now use any transparency in a PNG image or consider a particular colour in an image denoted to transparency. Should something like this work? It's not considering the transparency at all. procedure Example(); var image: TSCARBitmap; x, y: integer; begin image := TSCARBitmap.Create('') image.TranspColor := RGBToColor(255, 255, 255); image.LoadFromBmp(ScriptPath + 'example.bmp'); if FindBitmap(x, y, image, 0, 0, 800, 600) then begin WriteLn('Found.'); end; end; It's just comparing the portion of the screen with this image which maintains the white areas staying white. Edited November 28, 2012 by Turbine1991 Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 28, 2012 Share Posted November 28, 2012 That's not correct no, PNg transparency is not used by FindBitmapX as it allows for semi transparency. It only works with the color set in the TranspColor property. It looks like you're doing it right though. Though it doesn't really matter, I would recommend setting the transparent color after loading the bitmap. Quote Link to comment Share on other sites More sharing options...
Turbine1991 Posted November 30, 2012 Author Share Posted November 30, 2012 I've give it a try again setting the transparent colour after I wouldn't have expected it to keep alpha transparent values, but does it preserve these if the alpha value is 0? Or is it only possibly by colour and possibly a mask? Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 30, 2012 Share Posted November 30, 2012 The bitmap will hold the entire loaded alpha channel, and as long as TSCARBitmap.AlphaBlend is False, the alpha channel won't be reset when you assign to TranspColor. But this alpha channel is only used for alpha blended drawing. When searching for a bitmap, it'll only skip pixels of the color you've set in TranspColor, regardless of their alpha value. Quote Link to comment Share on other sites More sharing options...