Jump to content
FHannes

SCAR Divi 3.40 Final

Recommended Posts

SCAR Divi 3.40.00 has been released. As usual, lots of new stuff, bug fixes, tweaks, ... Some of the major changes are the new added support for loading GIF files and exporting animated PNG/GIF. Lots of additions and changes were made to TSCARBitmap. SCAR Divi now also comes with a new program icon!

 

Downloads: SCAR Divi - Download

 

Changelog:

Bugfixes:
- ActivateClient restored window when maximized
- TPAUnique didn't function properly
- A bug in Delphi's VCL framework prevented palette based PNG imaged to be loaded correctly by TSCARBitmap
- Several png formats were unsupported or lost transparency
- FloodFill(Tol)(Ex) threw exceptions due to an implementation flaw
- Code in form designer wasn't being highlighted
- Fixed possible bugs in LoadFromJpeg and SaveToJpeg

New:
- procedure SortTPAByX(var TPA: TPointArray);
- procedure SortTPAByY(var TPA: TPointArray);
- TChrono class to measure time intervals
- TObject.ClassName
- procedure ClampInt(var Value: Integer; const Min, Max: Integer);
- procedure ClampExt(var Value: Extended; const Min, Max: Extended);
- procedure ClampTIA(var TIA: TIntArray; const Min, Max: Integer);
- procedure ClampTEA(var TEA: TExtArray; const Min, Max: Extended);
- function MoveFile(const OldPath, NewPath: string): Boolean;
- TSCARBitmap.ClearEx
- function CopyFile(const OldPath, NewPath: string): Boolean;
- function IsValidPath(const Path: string): Boolean;
- TBmpResampler = (brNearest, brBilinear, brBicubic, brSuperSample);
- procedure TSCARBitmap.ResizeEx(const NewWidth, NewHeight: Integer; const Resampler: TBmpResampler);
- procedure TSCARBitmap.ClearAlpha;
- procedure TSCARBitmap.ClearAlphaEx(const Alpha: Byte);
- procedure TSCARBitmap.SetAlpha(const Color: Integer; const Alpha: Byte);
- procedure TSCARBitmap.SetAlphaEx(const Colors: TIntArray; const Alpha: Byte);
- property TSCARBitmap.Alpha[const X, Y: Integer]: Byte;
- procedure TSCARBitmap.Reduce(const MaxColors: Integer);
- procedure TSCARBitmap.SetPixelsEx(const TPA: TPointArray; const Colors: TIntArray);
- TFile = class(TPersistent)
- TImageFile = class(TFile)
- TAnimImageFile = class(TImageFile)
- TPNGFile = class(TAnimImageFile)
- TGIFFile = class(TAnimImageFile)
- TResizeAnchor = (raCenter, raTop, raTopRight, raRight, raBottomRight, raBottom, raBottomLeft, raLeft, raTopLeft);
- procedure TSCARBitmap.ResizeCanvas(const NewWidth, NewHeight: Integer; const ResizeAnchor: TResizeAnchor);
- TJPEGFile = class(TImageFile)
- New program icon
- New about window

Tweaks:
- Optimized TPASpread, SortTPA(Ex) and TPARemoveEx
- Rewritten SplitTPA(Ex) for added performance
- TPADelete now raises an exception when the index fall outside of the array boundaries
- TPARemove now removes the first point instead of the last when removing just one
- Editor now shows icon to indicate modifications in tab
- New clean look
- Improved TSCARBitmap.SaveToPng performance
- Merged in changes from official PascalScript codebase:
  * Support Include/Exclude for sets
  * Support iterating over enum types
- Proper alpha channel support in TSCARBitmap
- TSCARBitmap.Pixels renamed to TSCARBitmap.Pixel
- TSCARBitmap.DrawTo(Ex) now has the "Blend" parameter for alpha blending
- Significant performance tweaks for the PascalScript compiler
- TSCARBitmap is now a descendant of TPersistent

Removed:
- TSCARObject
- Automated resource freeing for (previous) TSCARObject descendants
- function BmpFromStrLegacy(const W, H: Integer; const Str: AnsiString): TSCARBitmap;
- Update Bitmaps tool
- function rs_GetTextAt(const Font, x, y: Integer): AnsiString;
- function rs_LoadChars(const Path: AnsiString): Integer;

 

Enjoy!

 

~Freddy

Link to comment
Share on other sites

The "Ctrl + Alt + S" combination immediately forcefully terminates the script, which is leading to a memory leak in the script, because not all resources are released upon forcefull termination.

 

The Stop button does the same.

Edited by georgri
Link to comment
Share on other sites

The "Ctrl + Alt + S" combination immediately forcefully terminates the script, which is leading to a memory leak in the script, because not all resources are released upon forcefull termination.

 

The Stop button does the same.

 

Older versions of SCAR freed resources automatically, newer versions don't. It's assumed the scripter does this himself. There's a ScriptTerminate event you can add to scripts which is called when the script is stopped.

Link to comment
Share on other sites

Thanks, Freddy, for your reply! I'm now freeing all the resources I created/allocated in the ScriptTerminate procedure.

The new problem has appeared.

 

Scar 3.40 leaks around 0.6MB every launch even of an empty script (let alone my non-empty script).

Is there a way to get around this?

After a few hundred launches of an empty script the scar eats around 180MB and this window appears:

scar_report.jpg

scar_report.bmp

Link to comment
Share on other sites

Thanks, Freddy, for your reply! I'm now freeing all the resources I created/allocated in the ScriptTerminate procedure.

The new problem has appeared.

 

Scar 3.40 leaks around 0.6MB every launch even of an empty script (let alone my non-empty script).

Is there a way to get around this?

After a few hundred launches of an empty script the scar eats around 180MB and this window appears:

[ATTACH=CONFIG]1001[/ATTACH]

 

Oh wow, that's odd O_o I'll look into that.

Link to comment
Share on other sites

The combination "Shift+Tab" doesn't work in SCAR 3.40 for some reason.

It gets very frustrating from time to time.

 

Also, I tried to add a task to the bug tracker and it showed me this message:

Notice: Undefined index: estimated_effort in /home/divi/public_html/bug/includes/class.backend.php on line 835 Query { SELECT * FROM `tasks` WHERE task_id = ? } with params {} Failed! (Unknown column 'Array' in 'where clause')

(But somehow it added the task)

Edited by georgri
Link to comment
Share on other sites

This program gets "An internal error while compiling" in SCAR 3.40:

var client: TSCARClient;
begin
 client := GetClient;  
 if (client.ImageArea.x2 > 1000) then begin
   writeln('Hello!');
 end; 
end;

 

And this doesn't:

var client: TSCARClient;
   i: integer;
begin
 client := GetClient; 
 i := client.ImageArea.x2;
 if (i > 1000) then begin
   writeln('Hello!');
 end; 
end;

 

This is so weird...

Link to comment
Share on other sites

One more question.

 

Among other new killer features in SCAR 3.40 there is "Iterating over enums".

Is it improvement of the RemObjects Pascal Script Engine or of the SCAR itself?

If it's SCAR related, could you please consider enhansing Enum capability to more then 256 values? Say, 65536?

 

UPD: Oh, nevermind, I researched it myself. So, it's the engine improvement, and the script engine is already supporting more than 256 enum values:

https://github.com/lewinjh/pascalscript/blob/f8e612ceea5f0a07f4d04e5a7fe3a44112405770/Source/uPSCompiler.pas#L1894

 

NICE!

Edited by georgri
Link to comment
Share on other sites

Oh man, this Pascal script engine just sucks. It doesn't allow creating user classes, and it has particular quirks with handling enumerations turning them unusable for me.

The engine doesn't have any means to implement interconnected structures containing links to each other.

I will have to do this:

const handle0 = 0; handle1 = 1; handle2 = 2; handle3 = 3;

instead of this:

type handleEnum = (handle0, handle1, handle2, handle3);

because the engine has its quirks with enums:

type enum1 = (value0, value1);
var e: enum1; 
   i: integer;
begin
 //i := value1; // DOESN'T WORK  
 //i := ord(value1); // DOESN'T WORK
 e := value1; // OK!!!
 i := ord(e); // OK!!! 
 //i := e; // DOESN'T WORK  
 //i := ord(enum1(value1)); // DOESN't WORK   
 for e := 0 to value1 do begin // OK
   i := ord(e); // OK
 end;
end.

Freddy, when will be SCAR 4.00 (with the new script engine) released? Is it even usable in the current state?

Edited by georgri
Link to comment
Share on other sites

Freddy, when will be SCAR 4.00 (with the new script engine) released? Is it even usable in the current state?

 

It is somewhat useable, but the API which is available is fairly limited. You can download the pre-alpha version here: http://dev.scar-divi.com/ There's also some stuff in the related thread about available features and such: http://forums.scar-divi.com/showthread.php?t=2280

It has been a while since I've been able to work on it because my schoolwork is keeping me incredibly busy at the moment, I have no intention to stop developing it though.

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