Recent

Author Topic: New version of BGRABitmap  (Read 291330 times)

Okoba

  • Hero Member
  • *****
  • Posts: 533
Re: New version of BGRABitmap
« Reply #720 on: March 14, 2024, 04:18:20 pm »
I thought of this poem:

The world is unknown, but nonetheless
A conclusion is inescapable to anybody
The world is vast, very vast, we can guess.
A group of friends might number around twenty
But a medium-sized country contains 7 million.
We can't really grasp this scale.
It's akin to an ultra high definition
A 4K screen of which we are but a single pixel.
And the Earth contains billions of folks,
In other words, a thousand of these screens,
Arranged in a 32 by 32 box.
The color of a pixel cannot be seen,
Yet without it, these apparatus
would have no stories to tell us.

Lovely to imagine. I guess effective people function as a gradient, giving colour to pixels/peoples they touch.

circular

  • Hero Member
  • *****
  • Posts: 4240
    • Personal webpage
Re: New version of BGRABitmap
« Reply #721 on: March 15, 2024, 08:43:02 am »
Ohhh that's sweet, gradient-like people.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4240
    • Personal webpage
Re: New version of BGRABitmap
« Reply #722 on: March 17, 2024, 12:53:48 pm »
New version of BGRABitmap (11.6)
https://github.com/bgrabitmap/bgrabitmap/releases
required for BGRAControls v9.0

Changes
- core version of BGRABitmap available: by adding the library to the project include path and setting BGRABITMAP_CORE directive (see test/testcore sample)
- package with FreeType support for Android and NoLCL (requires freetypelaz package)
- documentation for pasdoc (all units and all classes have a description)
- compilation fixes for latest FPC
- reduce warning count issued by compiler
- TBGRABitmap: added CopyProperties parameter to more functions
- add HalfUp rounding function (similar to Round but always rounded up) to avoid misalignments of texts (see issue #238)
- TBGRAIconCursor: add GetBestFitIndex function to get index of image instead of bitmap
- BGRAVectorize: fixes for serialized vectorized font (see test/testcore samples and forum thread), now kerning is saved in glyphs files
- optimized HSL blend modes (boLinearHue, boLinearColor, boLinearLightness, boLinearSaturation)

About core version
Core version is useful for small projects, if you want to reduce the size of the binaries. BGRABitmap can be about 50% smaller if you only use what's available in TBGRABitmap and no other units/classes).

BGRAVectorize also helps reducing size. You can make a program to serialize the glyphs you need in a .glyphs file. Then in another small program, you can draw text using TBGRAVectorizedTextRenderer without the LCL nor FreeType.
« Last Edit: March 17, 2024, 06:31:17 pm by circular »
Conscience is the debugger of the mind

Okoba

  • Hero Member
  • *****
  • Posts: 533
Re: New version of BGRABitmap
« Reply #723 on: March 17, 2024, 05:16:10 pm »
"BGRABitmap can by about 50% smaller" seems to be a typo.
How much (in kilobytes) is 50% in your tests?

circular

  • Hero Member
  • *****
  • Posts: 4240
    • Personal webpage
Re: New version of BGRABitmap
« Reply #724 on: March 17, 2024, 06:30:59 pm »
Ah indeed, it was "can be".

Little test program without LCL and regular BGRABitmap: 2082 Ko
Same program without LCL and BGRABitmap core: 1187 Ko
Same program without LCL but without BGRABitmap: 271 Ko
=> 49 % smaller

Little test program using LCL and regular BGRABitmap: 4060 Ko
Same program using LCL and BGRABitmap core: 3559 Ko
Same program using LCL but without BGRABitmap: 2663 Ko
=> 36 % smaller
Conscience is the debugger of the mind

d7_2_laz

  • Hero Member
  • *****
  • Posts: 512
Re: New version of BGRABitmap
« Reply #725 on: March 17, 2024, 11:03:11 pm »
Thanks circular for integrating the core version and your efforts, that makes it more attractive to use it for small projects too!   :)

Lazarus 3.2  FPC 3.2.2 Win10 64bit

circular

  • Hero Member
  • *****
  • Posts: 4240
    • Personal webpage
Re: New version of BGRABitmap
« Reply #726 on: March 22, 2024, 07:21:17 am »
Hi folks. Yet another version (v11.6.1)
https://github.com/bgrabitmap/bgrabitmap/releases

Bug fixes
- fix hue gradient from color to same color (#245)
- patch for text angle on MacOS (see Lazarus issue 40855)
- take into account LCL font kerning in TextSize and BGRAVectorize (#246)
- fix some examples for different OS / DPI scaling (test folder)

New feature
- support for SVG masks (#202)
- add TextOutOffset function #125
- add RightToLeft parameter to CanvasBGRA.TextOut
- accommodating for some GIF extra data #192
Conscience is the debugger of the mind

Lulu

  • Full Member
  • ***
  • Posts: 231
Re: New version of BGRABitmap
« Reply #727 on: April 04, 2024, 03:33:43 pm »
Hi Circular, thanks for this new release !
In a project I have to know the width and height of all ASCII characters.
All is fine except for the character '&' because
Code: Pascal  [Select][+][-]
  1. size := ima.TextSize('&');
return a width equal to 0.

If I use Form.Canvas to get the character size, the width is NOT equal to 0.
Do I miss something ?

Attached a small project to illustrate the problem.
Thanks.

EDIT: I use the last version of BGRABitmap, 11.6.1

« Last Edit: April 04, 2024, 03:36:34 pm by Lulu »
wishing you a nice life

circular

  • Hero Member
  • *****
  • Posts: 4240
    • Personal webpage
Re: New version of BGRABitmap
« Reply #728 on: April 04, 2024, 07:30:49 pm »
Hi Lulu!

Thanks for popping by. Indeed, there was an oversight in the code I wrote to take kerning into account.

I've just fixed it for you on the dev branch. It is a change in BGRAText on line 1426:
Code: Pascal  [Select][+][-]
  1.     exit(InternalTextSizeStyle(sUTF8,
  2.            BGRADefaultTextOutStyle(False, AShowPrefix), MaxLongint));
instead of
Code: Pascal  [Select][+][-]
  1.     exit(InternalTextSizeStyle(sUTF8,
  2.            BGRADefaultTextOutStyle(False, True), MaxLongint));

Can you give it a try? If that solves everything for you I will make a new release.

Regards
Conscience is the debugger of the mind

Lulu

  • Full Member
  • ***
  • Posts: 231
Re: New version of BGRABitmap
« Reply #729 on: April 04, 2024, 07:44:46 pm »
I've applyed the change and.. it works !
Thanks you again and bravo for your quick answers  :)
wishing you a nice life

circular

  • Hero Member
  • *****
  • Posts: 4240
    • Personal webpage
Re: New version of BGRABitmap
« Reply #730 on: April 04, 2024, 09:06:02 pm »
Wonderful. I've made a pull request and asked for a review.
https://github.com/bgrabitmap/bgrabitmap/pull/251
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4240
    • Personal webpage
Re: New version of BGRABitmap
« Reply #731 on: April 06, 2024, 07:58:16 pm »
New version of BGRABitmap 11.6.2 for quick fixes:
- quick fix for TextSize of "&" symbol
- handle "&" prefix on MSEgui
- more documentation

https://github.com/bgrabitmap/bgrabitmap/releases
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018