Recent

Author Topic: New version of BGRABitmap  (Read 300269 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: 4348
    • 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: 4348
    • 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: 4348
    • 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: 515
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.6  FPC 3.2.2 Win10 64bit

circular

  • Hero Member
  • *****
  • Posts: 4348
    • 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

  • Sr. Member
  • ****
  • Posts: 259
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!
GitHub repositories https://github.com/Lulu04

circular

  • Hero Member
  • *****
  • Posts: 4348
    • 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

  • Sr. Member
  • ****
  • Posts: 259
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!
GitHub repositories https://github.com/Lulu04

circular

  • Hero Member
  • *****
  • Posts: 4348
    • 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: 4348
    • 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

jipété

  • Full Member
  • ***
  • Posts: 182
Strange behaviour of a bgrabitmap-11.6.2/test
« Reply #732 on: June 02, 2024, 01:14:07 pm »
Hello,

Newbie to BGRA and the dedicated forums, I really don't know how to post, so feel free to move these lines :

Starting with the sentence "If you make some improvements to this library, please notify..." found in the readme.txt of bgrabitmap-11.6.2/test/testbgrafunc, here it goes :

The test
Code: Pascal  [Select][+][-]
  1.   if TBGRAPixel_RGBAOrder then
  2.     Caption := Caption + ' (RGBA 32-bit)'
  3.   else
  4.     Caption := Caption + ' (BGRA 32-bit)';
in FormCreate lines 115-120 cannot access the second option, says my compiler, because one can read TBGRAPixel_RGBAOrder = True; in bgrapixel.inc line 90.
So I commented out the test (maybe not the best thing to do, but...) and everythings stills work fine.  8)

Now, is it the right place to ask something strange with the bgralape found in bgrabitmap-11.6.2/test ?
When I click Run then the first "ShowMessage", the second test displays the following : nothing on right side, an empty field...
bug_test_bgralape.png

And the Text test (15) displays broken glyphs, at least for me :
strangetext_testbgralape.png

I use the last BGRA package (from "Packages / OnLine Package Manager...") on a 64 bits machine with Linux-Debian 11.9 Gtk2 FPC 3.2.2 Laz 3.2.

Thanks,
« Last Edit: June 02, 2024, 01:22:14 pm by jipété »

circular

  • Hero Member
  • *****
  • Posts: 4348
    • Personal webpage
Re: Strange behaviour of a bgrabitmap-11.6.2/test
« Reply #733 on: June 02, 2024, 02:06:07 pm »
Hello Jipété,

Welcome on the forum. Sure, one admin can move your post to a new thread for example called "bgralape sample project incorrect output".

About the compiler warning concerning TBGRAPixel_RGBAOrder, you can safely ignore it. In fact, the constant is not always True depending on the widgetset. It depends on compiler directives. So it is better to keep the if to handle all cases.

About the tests, I've fixed them on dev branch.

The second text was commented out due to a limitation of lape. I've

About the text test, it is on purpose that the display would be strange. Though I've made it more subtle so that we can actually see the original shape of the text.

Also I've fixed the code for latest version of lape.

Regards
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4348
    • Personal webpage
Re: New version of BGRABitmap
« Reply #734 on: August 06, 2024, 02:59:08 pm »
New version of BGRABitmap (11.6.3)
- add aliasing options for SVG shapes (shapeRendering or antialiasing equivalent)
- fix texture size with recent versions of OpenGL (not using power-of-2 sizes)
- add generic canvas shader TBGLFullCanvasShader
- add framebuffer example (test/test4lcl_opengl/opengltest5]
- avoid += operator for compatibility (use IncF for example instead)
- use BGRA version of writers by default for JPEG and BMP

https://github.com/bgrabitmap/bgrabitmap/releases

Examples of shaders can be found in the following thread:
Demo Scene BGRA GL Shader (from page 2 on for the examples with TBGLFullCanvasShader)
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018