LordJashin Posted November 20, 2012 Share Posted November 20, 2012 (edited) This is a very very important function to have when making bitmap functions. You can check if the bitmap variable has been assigned, and if it has. Does it have more than 0 width or height. If it does, it is a valid bitmap according to SCAR rules . Adding this to OSI soon. [scar] {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function BitmapExists(bmp: TSCARBitmap): Boolean; Contributors: LordJashin Description: Checks if Bitmap Exists, using Assigned and checking the width & height Date Created: November 19th, 2012. By LordJashin. Last Modified: November 19th, 2012. By LordJashin. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=} function BitmapExists(bmp: TSCARBitmap): Boolean; begin Result := False; try if Assigned(bmp) then if (bmp.Width > 0) and (bmp.Height > 0) then Result := True; finally end; end; [/scar] Hmm... I could probably do away with the Try block. What do you guys think? Edit: In other news...I'm really going to start grinding OSI now. Stuff is just going to pop up out of no where once I get a bigger grip on these debug functions. Then I'm just going to go crazy. After all is made, I might just bring back the GMRL plugin. I'm sure most of it still works even now. Edited November 20, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 20, 2012 Share Posted November 20, 2012 Something like this maybe? Once you know the bitmap exists it should be safe to check its dimensions. [sCAR] {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function BitmapExists(bmp: TSCARBitmap): Boolean; Contributors: LordJashin Description: Checks if Bitmap Exists, using Assigned and checking the width & height Date Created: November 19th, 2012. By LordJashin. Last Modified: November 19th, 2012. By LordJashin. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=} function BitmapExists(bmp: TSCARBitmap): Boolean; begin Result := False; if Assigned(bmp) then Result := ((bmp.Width > 0) and (bmp.Height > 0)); end; [/scar] Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 20, 2012 Author Share Posted November 20, 2012 Something like this maybe? Once you know the bitmap exists it should be safe to check its dimensions. [sCAR] {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function BitmapExists(bmp: TSCARBitmap): Boolean; Contributors: LordJashin Description: Checks if Bitmap Exists, using Assigned and checking the width & height Date Created: November 19th, 2012. By LordJashin. Last Modified: November 19th, 2012. By LordJashin. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=} function BitmapExists(bmp: TSCARBitmap): Boolean; begin Result := False; if Assigned(bmp) then Result := ((bmp.Width > 0) and (bmp.Height > 0)); end; [/scar] I usually forget to take it one step further like that ahaha. Great though, there we go! Its perfect now. Conditionals in the result ...I usually never do that, I should start now lols. Quote Link to comment Share on other sites More sharing options...