Hello,
A new version of BGRABitmap (7.3) has been released.
UTF8 support
In this version, when a UTF8 filename is expected, it is reflected by the name of the function or of the parameter:
constructor TBGRAAnimatedGif.Create(filenameUTF8: string);
When there was no UTF8-handling function, it has been added. The class TFileStreamUTF8 is now used whenever possible to ensure maximum support of any UTF8 character.
Gtk (linux)
There was a bug when drawing an image on the canvas, sometimes the image had offset. This is hopefully corrected in 7.3 (tested on Lubuntu 32-bit).
New units
- BGRAGrayscaleMask: it is a light version of a bitmap having only one grayscale and linear channel. It does not provide any drawing capacities for now, except setpixel and direct pixel access. It is used internally by BGRAText.
- BGRAReadBMP, BGRAReadGif, BGRAReadPCX, BGRAReadPng, BGRAReadPSD, BGRAReadTGA, BGRAReadIco, bgrareadjpeg, BGRAReadXPM: these units are readers for images, that are automatically included in the program, to provide optimisations, corrections and additions to the standard ones provided by FreePascal. You may not need to make explicit reference to them because you can use them using the new TBGRAImageFormat enumeration.
- BGRAReadLzp, BGRAWriteLzp, BGRALzpCommon: this introduce a new version of Lzp format that you can use just like other image formats. The Lzp use by default a kind of RLE that is fast and does a compression that is in general a bit less efficient than PNG but still quite good (and surely much fast than PNG or zstream). It also supports layers. The software LazPaint use this format to store layered images. Note that in BGRABitmap, for now, you can only load and save flat images, so loading a layered image will just give you the flattened image of it.
- BGRAThumbnail: this unit provide fast loading and computation of thumbnails (using to display images for browsing)
- UnzipperExt: provides an unzipper that works with streams and UTF8 filenames
TAnimatedGif
To make it easy to display animated gif without using too much CPU, the following property has been added:
property TimeUntilNextImageMs: integer read GetTimeUntilNextImage;
It returns the time in milliseconds before the next frame will be rendered. The value zero means that the Gif should be updated immedialty.
BGRABitmapTypes
- TResampleFilter provides now rfBox, which is high quality version of the stretched image. Note that the algorithm for stretched draw has been changed, it is to some extent faster and gives nice results except when the size becomes smaller than a half. In this case, not all pixels may be used to compute the resulting image. This makes it fast whatever the size of the original image is.
- TBGRAImageFormat = (ifUnknown, ifJpeg, ifPng, ifGif, ifBmp, ifIco, ifPcx, ifPaintDotNet, ifLazPaint, ifOpenRaster, ifPsd, ifTarga, ifTiff, ifXwd, ifXPixMap) are all the formats read by BGRABitmap. This goes with the following functions:
function DetectFileFormat(AFilenameUTF8: string): TBGRAImageFormat;
function DetectFileFormat(AStream: TStream; ASuggestedExtensionUTF8: string = ''): TBGRAImageFormat;
function SuggestImageFormat(AFilenameOrExtensionUTF8: string): TBGRAImageFormat;
function CreateBGRAImageReader(AFormat: TBGRAImageFormat): TFPCustomImageReader;
function CreateBGRAImageWriter(AFormat: TBGRAImageFormat; AHasTransparentPixels: boolean): TFPCustomImageWriter;
- DefaultBGRAImageReader, DefaultBGRAImageWriter: if you want to specify a reader for a specific file format.
- VGAColors: provide the basic 16 colors separately from CSS colors
- The color conversion between HSLA, GSBA and RGBA have been optimised. Also more functions to decode a string describing a color:
function BGRAToStr(c: TBGRAPixel; AColorList: TBGRAColorList = nil; AMaxDiff: Word= 0): string;
function StrToBGRA(str: string): TBGRAPixel; //full parse
function StrToBGRA(str: string; const DefaultColor: TBGRAPixel): TBGRAPixel; //full parse with default when error or missing values
function PartialStrToBGRA(str: string; const fallbackValues: TBGRAPixel; out error: boolean): TBGRAPixel; //partial parse allowed
procedure TryStrToBGRA(str: string; var parsedValue: TBGRAPixel; out missingValues: boolean; out error: boolean);
BGRAPolygon
Fixed a bug in FillShapeAliased about the computation of the horizontal position of the polygons.
BGRAScene3d
Added the following function to apply a function on each vertex/face:
procedure ForEachVertex(ACallback: TVertex3DCallback);
procedure ForEachFace(ACallback: TFace3DCallback);
Added the possibility to set custom flags on vertex/faces with the property CustomFlag.
BGRASliceScaling
UTF8 support to load TBGRASliceScaling and TBGRAMultiSliceScaling objects
BGRASSE
Fixed some compilation issues (constref instead of const).
BGRAStreamLayers
Supports now both Lzp compression, i.e. Zstream and RLE.
BGRAText and BGRATextFX
UTF8 support more explicit. Use of TGrayscaleMask to reduce memory usage and speed it up.