

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 ExcellentAbout A.M. Hoornweg
- Currently Viewing Forums Index
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Creating webp files with Skia fails
A.M. Hoornweg replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
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. -
Creating webp files with Skia fails
A.M. Hoornweg replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
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; -
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
-
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
-
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;
-
variadic-arguments How to create a Delphi variadic method similar to Write/Writeln without requiring brackets for arguments?
A.M. Hoornweg replied to bravesofts's topic in Algorithms, Data Structures and Class Design
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; -
Exception Handling with a Middle Tier Application
A.M. Hoornweg replied to JIMSMITH's topic in Algorithms, Data Structures and Class Design
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; -
Exception Handling with a Middle Tier Application
A.M. Hoornweg replied to JIMSMITH's topic in Algorithms, Data Structures and Class Design
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. -
Exception Handling with a Middle Tier Application
A.M. Hoornweg replied to JIMSMITH's topic in Algorithms, Data Structures and Class Design
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. -
Plugin to expand namespaces in DCU?s?
A.M. Hoornweg replied to A.M. Hoornweg's topic in Delphi Third-Party
Thank you very much! -
Plugin to expand namespaces in DCU?s?
A.M. Hoornweg replied to A.M. Hoornweg's topic in Delphi Third-Party
I use MMX code explorer but I can't find the option to do this, can you point me to it? Thanks in advance! -
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!
-
Delphi 11.3 unusable due to full-build-requiring onslaught of F2084 "Internal Compiler Errors" from minor source modifications
A.M. Hoornweg replied to PaulM117's topic in Delphi IDE and APIs
Please try to disable "code inlining control" in the compiler settings and see if the problem disappears. -
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.
-
What new features would you like to see in Delphi 13?
A.M. Hoornweg replied to PeterPanettone's topic in Delphi IDE and APIs
I want "F2084 Internal Error L902" gone !!!