Jump to content

A.M. Hoornweg

Members
  • Content Count

    494
  • Joined

  • Last visited

  • Days Won

    9

A.M. Hoornweg last won the day on August 2 2024

A.M. Hoornweg had the most liked content!

Community Reputation

153 Excellent

About A.M. Hoornweg

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. A.M. Hoornweg

    Creating webp files with Skia fails

    The bitmap is created like this, the 32-bits is just for alignment (speed) reasons: ResultBitmap := tbitmap.Create; ResultBitmap.pixelformat := pf32bit; ResultBitmap.Alphaformat := TAlphaFormat.afIgnored; and function TSkBitmapHelper.ToSkImage (found in Unit vcl.skia) explicitly handles that 32bit/afIgnored case, so there's probably a bug there somewhere: if PixelFormat = TPixelFormat.pf32bit then begin case AlphaFormat of TAlphaFormat.afIgnored: LAlphaType := TSkAlphaType.Opaque; TAlphaFormat.afDefined: LAlphaType := TSkAlphaType.Unpremul; TAlphaFormat.afPremultiplied: LAlphaType := TSkAlphaType.Premul; else LAlphaType := TSkAlphaType.Unknown; end; ...... Saving the tBitmap to a stream and then creating the tSkImage from that stream works, but this still seems a bug to me.
  2. A.M. Hoornweg

    Creating webp files with Skia fails

    I have a workaround that works: procedure SaveAsWebP(aBitmap: tbitmap; aOutputfilename: string; Compressionfactor: integer; out MimeContentType: string); var lStream: tMemorystream; skimage: iSkImage; begin lStream := tMemorystream.Create; try aBitmap.SaveToStream(lStream); lStream.Position := 0; skimage := tskimage.MakeFromEncodedStream(lStream); skimage.encodetofile(aOutputfilename, tskEncodedImageFormat.WebP, Compressionfactor); MimeContentType := 'image/webp'; finally lStream.Free; end; end; So it appears that it is really the following code that is broken: var skimage:=aBitmap.ToSKImage;
  3. Hello all, I have a 32-bit Windows application (it is an Intraweb based ISAPI dll) and I try to write images in losslessly compressed webp format. The bitmap that I want to convert to webp is a 32-bit tBitmap containing some 2-D graphics. My problem: The generated output image is totally broken when I use Delphi 12's SKIA routines for the conversion. Graphics programs render it only partially, then give up. This is the code that I wrote; The compression factor that I pass is 100. Did I do anything wrong? ... uses system.skia, vcl.skia; procedure SaveAsWebP(aBitmap: tbitmap; aOutputfilename: string; Compressionfactor: integer;Out MimeContentType:String); begin var skimage:=aBitmap.ToSKImage; skimage.encodetofile(aOutputfilename, tskEncodedImageFormat.WebP, compressionfactor); MimeContentType:='image/webp'; end ; broken_webpfile.webp
  4. Smart Setup is a unified tool for installing and building Delphi packages, whether they come from TMS or elsewhere. See: https://www.tmssoftware.com/site/blog.asp?post=1360
  5. A.M. Hoornweg

    Stringgrid objects problem

    If you want to store either integers or objects into your grid, just declare a simple class that contains an integer. That way you can consistently store objects in the grid and treat everything alike. And you can simply test if the object is an integer or something else: "(if Obj IS tInteger then ...)" Type tInteger=Class protected fValue:Integer; public Constructor Create(const aValue:Integer); Property Value: Integer read fValue write fValue; end; Constructor tInteger.Value (const aValue:integer); begin fValue:=aValue; end;
  6. If the problem is just that the cdecl function needs to be in an external module, maybe it's possible to work around that. It may sound counter-intuitive, but it's perfectly possible to export a function contained in an *.exe project and then call it from a DLL loaded by the executable. I see no reason why the executable shouldn't be allowed to import a function that it exports itself. Program test; uses windows; function somefunction:integer; cdecl; export; begin result:=1; outputdebugstring(pchar('Hello World')); end; Exports somefunction; end;
  7. One advantage is that it's way less work server-side. If anything goes wrong, you need not worry too much about how to inform the client because that information is already contained in the exception that was thrown by whatever action failed. The stack is unrolled automatically just like in regular Delphi apps and the exception information is automatically propagated to the client. Client-side, a remote procedure call is used like any other Delphi call. In the case of an error, you use structured exception handling and use the exception type as a criterium for how the client should proceed. try server.executequery(query) except on e:exception do begin if e is eCommsError then //did the internet connection fail? If so, client should try again later. ... else if e is eDatabaseError then showmessage(format('The server really didn''t like this query, this is wrong with it: (%s) "%s"',[e.classname, e.message])) else ... end; end;
  8. The disadvantage of that is that it doesn't tell you in detail what went wrong on the server. It is also tedious, the server needs to CATCH exceptions and convert them into something meaningful (an error code?) to pass back to the client, hopefully yielding sufficient information. If the framework itself is designed in such a way that it can pass exceptions back from server to client, the client will re-raise the same exception type (eOverflow, eConvertError, eInOutError, eListError...) with (hopefully) the server's error address in the error message so you can easily find the root cause. It also simplifies server-side development enormously; if something goes wrong on the server, it can simply raise an exception and it will be passed back to the client.
  9. I use Remobjects Remoting SDK as a middleware and that is perfectly capable of passing an exception that happens in a remote procedure call back to the client without hanging. The exception is then raised in the client.
  10. A.M. Hoornweg

    Plugin to expand namespaces in DCU?s?

    Thank you very much!
  11. A.M. Hoornweg

    Plugin to expand namespaces in DCU?s?

    I use MMX code explorer but I can't find the option to do this, can you point me to it? Thanks in advance!
  12. Hello World, does anyone know of an IDE plugin or other tool that will analyze the interface section of a unit and expand the unit names with their full namespaces, such as "rtl, vcl, db" etc ? Thanks in advance!
  13. Please try to disable "code inlining control" in the compiler settings and see if the problem disappears.
  14. A.M. Hoornweg

    Linker error L902

    FOUND! The L902 linker error disappears if I set the compiler switch "code inlining control" to OFF! I can reproduce this in several 32-bit programs that had this problem. Kudos to my colleague Ralf Claussen who discovered this by chance.
  15. A.M. Hoornweg

    What new features would you like to see in Delphi 13?

    I want "F2084 Internal Error L902" gone !!!
×