Jump to content

Shrinavat

Members
  • Content Count

    70
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Shrinavat

  1. Shrinavat

    Format uses clause

    @Uwe Raabe What am I doing wrong? Why aren't the units grouped by group prefix?
  2. Shrinavat

    Delphi 10.4.2 custom templates

    Isn't that the reason you are here? https://quality.embarcadero.com/browse/RSP-28708
  3. There is current code, in which I think the use of dictionaries is redundant: const N = $1; S = $2; E = $4; W = $8; var DX, DY, OPPOSITE: TDictionary<Integer, Integer>; // init dictionares DX := TDictionary<Integer, Integer>.Create; DX.Add(E, 1); DX.Add(W, -1); DX.Add(N, 0); DX.Add(S, 0); DY := TDictionary<Integer, Integer>.Create; DY.Add(E, 0); DY.Add(W, 0); DY.Add(N, -1); DY.Add(S, 1); OPPOSITE := TDictionary<Integer, Integer>.Create; OPPOSITE.Add(E, W); OPPOSITE.Add(W, E); OPPOSITE.Add(N, S); OPPOSITE.Add(S, N); // Usage of these dictionaries is shown below in the example code: var nx := x + DX[dir]; var ny := y + DY[dir]; grid[ny, nx] := grid[ny, nx] or OPPOSITE[dir]; To improve performance, I would like to avoid using dictionaries and use a simpler code instead... but I don't know which one? Any help in this arena would be greatly appreciated.
  4. Shrinavat

    How to gracefully get rid of the use of dictionaries?

    Thank you all, you put me on the right track!
  5. Shrinavat

    How to gracefully get rid of the use of dictionaries?

    You are correct. The code uses expressions like: cx := E or W; grid[ny, nx] := grid[ny, nx] or S;
  6. Shrinavat

    Is this C++ builders new FORUM ???

    Alas, "Omnia orta cadunt"
  7. Shrinavat

    adding graphics32 component

    Maybe it makes sense to add graphics32 to "Delphi Third-Party" section?
  8. Shrinavat

    Looking for SVG support in Delphi?

    Looks great, is there any chance of animation support (like SVGMagic do)?
  9. Shrinavat

    Free SQLite -> Interbase tool?

    Maybe something like https://www.rebasedata.com/convert-interbase-to-sqlite-online ?
  10. Shrinavat

    Report components: good, bad, ugly

    OExport - XLSX/XLS/ODS/CSV native Delphi/Lazarus import/export library - https://www.kluug.at/kluug-net/xlsx-ods-delphi.php I use Template engine: automatically process user-defined XLSX/XLS templates.
  11. Shrinavat

    Saving a large project takes soooo Loooonnnnggg..

    The latest version is in the attachment. It supports the latest version of RAD Studio.
  12. I have a pipeline for downloading files to a specific database. FFileDownloader := Parallel.Pipeline .Stage(Asy_URLBuilder) .Stage(Asy_URLRetriever) .Stage(Asy_DBInserter, Parallel.TaskConfig.OnMessage(Self)) .Run; procedure Asy_URLBuilder(const input, output: IOmniBlockingCollection); var ovIN, ovOUT: TOmniValue; begin for ovIN in input do begin // ... compose url for downloading output.TryAdd(ovOUT); // url is in ovOUT end; end; procedure Asy_URLRetriever(const input, output: IOmniBlockingCollection); var ovIN, ovOUT: TOmniValue; begin for ovIN in input do begin // ... downloading output.TryAdd(ovOUT); // downloaded file is in ovOUT end; end; procedure Asy_DBInserter(const input, output: IOmniBlockingCollection; const task: IOmniTask); var ovIN: TOmniValue; DB: TxxxDatabase; begin DB := TxxxDatabase.Create(nil); DB.DatabaseName := ??? ; DB.Open; for ovIN in input do begin // ... insert downloaded file in specific database end; DB.Commit; task.Comm.Send(WM_TASK_COMPLETED); end; I run a pipeline for various databases. I need to pass DatabaseName to the third stage of the pipeline. How can I do that? Can I use the SetParameter method of Task controller when creating a pipeline? And if so, how? Any help will be appreciated!
  13. @Schokohase Thank you, it's works! I wonder if there is another solution? Without creating an extra class?
  14. @Schokohase Sorry, I'm afraid I don't know what you're talking about. What method what class i shoud use? The pipeline does not have an Initialize method.
  15. Shrinavat

    Rio IDE Menu Font Size

    Here is description (on a russian website) of IDEFont - http://www.proghouse.ru/programming/143-idefont
  16. Shrinavat

    Rio IDE Menu Font Size

    IDEFont A tool to change the font of IDE Delphi https://github.com/zMotoR/IDEFont
  17. Shrinavat

    Delphi wrapper for libpng

    I hope this is the right place to ask this... Is there a Delphi wrapper for libpng? I would very much like to use it, but I couldn't find it anywhere. Please share if you know anything. If someone got working wrapper for libpng and wants to share it at here would be cool. Thanks!
  18. Shrinavat

    Delphi wrapper for libpng

    @dummzeuch I saw these links. The libraries are very old, seems more than 15 years old and for very early versions of libpng. Unfortunately, they cannot be used for current versions of libpng.
  19. My task is to draw a lot of small images in a certain order on one large one. I'm using TBitmap32 from Graphics32 Library. Since TBitmap32 is a descendant of TThreadPersistent, it inherits its locking mechanism and it may be used in multi-threaded applications. Here is how I do it now in the main thread: var LargeImage: TBitmap32; procedure BuildLargeBitmap; var x,y, bx,by: integer; AreaRect: TRect; tile: TBitmap32; begin LargeImage.BeginUpdate; try AreaRect := GetSpecifiedArea; // small images (tiles) are 256*256 pixels in size LargeImage.SetSize(256 * (AreaRect.Right - AreaRect.Left+1), 256 * (AreaRect.Bottom - AreaRect.Top+1)); { loop of drawing tiles on a large bitmap } by := 0; // bx,by - coordinates on the bitmap where the tile is drawn (in tiles) for y := AreaRect.Top to AreaRect.Bottom do begin bx := 0; for x := AreaRect.Left to AreaRect.Right do begin tile := GetTileFromDB(x, y); // get tile from the database if Assigned(tile) then // if tile exists, render it on the large bitmap RenderTileToBitmap32(LargeImage, tile, bx*256, by*256); inc(bx); end; inc(by); end; finally LargeImage.EndUpdate; end; end; I want to use all the power of OmniThreadLibrary and bring this rendering loop to a separate thread(s). Which one of the proposed abstractions should I use? ForEach, Fork/Join, Map or something else? Please give me advice and an example applicable to my task. Thanks!
  20. @Primož Gabrijelčič Do you have any progress for this issue fix? There are no new commits on github. Current workaround with using extra variable is not very elegant, although it works.
  21. Here is the simplest code: When I click on the button "Read Image in GUI Thread", then everything is fine. TWICImage loads the image from the stream. However, the same code does not work in the thread (click on the button "Read Image in OTL Thread"), I get AV "Access violation at address 0050316F in module 'Project1.exe'. Read of address 00000000". If you use TJPEGImage instead of TWICImage, then everything works fine in both cases. I don't get what the problem is. Can someone explain to me in simple terms what should I do in order for TWICImage to work in the thread? I want to use TWICImage because it allows you to download a wide variety of image formats, not just jpeg. Delphi 10.2.3, Win7SP1 x64. Project full source is in attachment test_OTL_read_from_memory.zip
  22. Shrinavat

    Strange TWICImage behavior when working in a thread.

    Yes, indeed.
  23. Shrinavat

    Strange TWICImage behavior when working in a thread.

    Ooops! I completely forgot about that... Thanks!
  24. Thank, @Primož Gabrijelčič. That works. And what about my question #1 (numTasks)?
  25. @Anders Melander I have latest Graphics32 with fixed TBitmap32 constructor access violation AV occurs when executing a line of code Image32.Bitmap.Assign(workItem.Result.AsObject as TBitmap32); - FBackend is nil: This is in case when workItem.Result.Ownsobjects: = True If I comment out workItem.Result.OwnsObject := True line in Asy_Factory procedure and uncomment workItem.Result.AsObject.Free; line in HandleRequestDone procedure, FBackend is not nil. It's a bug. But whose? Mine, GR32 or OTL?
×