Jump to content
LordJashin

BitmapExists function

Recommended Posts

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 xD.

 

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 by LordJashin
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...