Jump to content
TroisVerites

Question about BitmapFromString

Recommended Posts

Why we can't include the w and h in the string.

I think it is a good idea to save Bmp ressource in external file.

 

Bmp := BitmapFromString(54, 37, 'beNp78uXpq69gtD6GwaLh5'...)

 

Thanks for the answer

 

Huh? Is your question answered?

 

Use SaveBitmap to save a bitmap to a file. Like so:

 

[sCAR]

SaveBitmap(bmp, 'C:\Bitmap.bmp');

[/sCAR]

Link to comment
Share on other sites

Why we can't include the w and h in the string.

I think it is a good idea to save Bmp ressource in external file.

 

Bmp := BitmapFromString(54, 37, 'beNp78uXpq69gtD6GwaLh5'...)

 

Thanks for the answer

 

SCAR Divi 3.35 Beta already does this.

Link to comment
Share on other sites

Scar 3.35

 

I have a question about the new object TSCARBitmap. Is this object managed like the previous version ?

 

In 3.34 , we have a integer in result from BitmapFromString(...). Do you make plan to do the same change for DTM ?

 

Because in my script 3.34 , to detect an object like (color or Bmp or Dtm ) , I just use the integer , the type of ressource.

 

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function OR_FindRes( const Src, SrcID, SrcTol: integer; Area:TBox; Pt: TPoint): Boolean;

Contributors: TroisVerites

Description:

Date Created: March 01st, 2012. By TroisVerites Build 001

Last Modification:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

function OR_FindRes( const Src, SrcID, SrcTol: integer; Area:TBox; var Pt: TPoint): Boolean;

begin

case Src of

1 : Result := FindColorTolerance(Pt.x, Pt.y, SrcID,

Area.x1, Area.y1,

Area.x2, Area.y2, SrcTol);

2 : Result := FindBitmapTolerance(SrcID, Pt.x ,Pt.y,SrcTol);

3 : Result := FindDTM(SrcID, Pt.x, Pt.y, Area.x1, Area.y1, Area.x2, Area.y2);

else Log_Write('OR_FindRes source is not implemented');

end;

end;

 

 

program New;

var

bmp :TSCARBitmap;

Pt : TPoint;

Bln : boolean;

 

begin

 

bmp := TSCARBitmap.Create('deNq9kltOwlAURe80TJiFU2AsToGpCEYNRKNUY' +

'nwUKWp8RI0aQUGNr2gUUhWcRDnpTg8n3vbyc8LOStuPvVf6mjE5E4bhvN9Roeh' +

'31airUdq712Kh8aDFYvCoxVJTjeX9Jy3KB89TxhgzsVM5fHFj4kRzOBtHc+Xo1' +

'QEkEkpWefX4zQHupDU79lCyymsn71lgmAjix4wiOmb1108/UsHNEGyja9ZyR06' +

'qZylgDmCznxRHudo4/7ShTiEJC9kgPwGFV7WLLxsq5JNIIavkH8KrzcueDRU8z' +

'8uLQDh+/yQsxsQ2rLau+qlgIoVQ/ZMgmGxfhw6kECp+aYgs79x8T8Skxa7ttn6' +

'08Ntq1G9/tWjcDbQIOkMtmt0/LUa2jFmg');

 

Bln := FindBitmapTol(Pt.x,Pt.y,bmp,0,0, 1900, 1200, 3);

if ( Bln ) then

begin

writeln('Bmp is found at ' + inttostr(Pt.x) + ':' + inttostr(Pt.y) );

end else

begin

writeln('Bmp is not found.');

end;

 

bmp.Free();

end.

Link to comment
Share on other sites

Check this out - http://forums.scar-divi.com/showthread.php?1603-SCAR-Divi-3-35-Preview-Tutorial

 

Here is how you use Bitmaps now. There is a TSCARBitmap object. You have to create it. Then type in its name and a dot, then hit CTRL+SPACE on your keyboard and you can see what you can do to the bitmap. For example you can save it as a png, jpeg, and bitmap.

 

Example:

 

[sCAR]

program New;

var

bmp: TSCARBitmap;

X, Y: Integer;

 

begin

 

bmp := TSCARBitmap.Create('deNpjZGBkaGxsBAADGQGG'); //Bitmap String

 

FindBitmap(X, Y, bmp, 0, 0, 100, 100);

 

end.

 

[/sCAR]

 

I don't see why you would want it as an Integer still but you can pass it as an Integer like this:

 

[sCAR]

program aaa;

var

bmp: Integer;

bmp1: TSCARBitmap;

 

begin

bmp1 := TSCARBitmap.Create('deNpjZGBksI69CwACWwF4');

 

bmp := bmp1 as Integer;

 

WriteLn(bmp1 as Integer);

 

WriteLn(bmp);

 

end.

 

[/sCAR]

 

The TSCARBitmap object has LoadFromStr procedure as well.

Edited by LordJashin
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...