Recent

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

circular

  • Hero Member
  • *****
  • Posts: 2856
    • Personal webpage
Re: New version of BGRABitmap
« Reply #450 on: December 19, 2018, 01:31:07 pm »
All you need to do is create a new application and place a TBGRASHAPE component on it.
You get a Blank Square, rather than a Black Lined Diamond shape.

TShape works fine.

I had thought about posting on bugtracker, do you post issue on bugtracker for lazarus whuch are 3rd party related?
Hmm maybe we can try to narrow down a bit the issue. It seems to be related to transparency. What if you put in the OnPaint event of the form something like:
Code: [Select]
uses BGRABitmap, BGRABitmapTypes;

{ TForm1 }

procedure TForm1.FormPaint(Sender: TObject);
var
  bmp: TBGRABitmap;
  w: single;
begin
  bmp := TBGRAbitmap.Create(ClientWidth,ClientHeight);
  w := ClientWidth/10;
  bmp.EllipseAntialias(ClientWidth/2-0.5,ClientHeight/2-0.5,ClientWidth/2-w/2,ClientHeight/2-w/2,CSSBlack,w,CSSRed);
  bmp.Draw(Canvas,0,0,False);
  bmp.Free;
end;
?

@Windsurfer: On which repository is it? Maybe it can be updated
Conscience is the debugger of the mind

josh

  • Hero Member
  • *****
  • Posts: 733
Re: New version of BGRABitmap
« Reply #451 on: December 20, 2018, 01:36:36 am »
Hi Circular,

Changed the css color codes to cl color codes. and the form shows the painted eclipses.

The BGRAShae is still not drawn.

It is to do with the TBGRASHAPE component, as there components like tbcbutton render fine.

Hope that helps.
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

circular

  • Hero Member
  • *****
  • Posts: 2856
    • Personal webpage
Re: New version of BGRABitmap
« Reply #452 on: December 20, 2018, 06:14:25 pm »
Hmm so that would not be related to the drawing on the Canvas but on the code that generates the image of the shape.

What if you replace in BGRAShape unit in TBGRAShape.Paint the line:
Code: [Select]
  FBGRA.FillTransparent;by
Code: [Select]
  FBGRA.Fill(clRed);?
Conscience is the debugger of the mind

josh

  • Hero Member
  • *****
  • Posts: 733
Re: New version of BGRABitmap
« Reply #453 on: December 21, 2018, 12:31:29 am »
Hi Circular,

If I change the code then It draws a Red Rectangle.

I have done some further tests, It does not draw the border or fill the color, if I create the cradient and set the option to draw the border and fill with fradient then it renders.

Some pics, I have tried differing Opacity values all have no effect.

The first one you cant see where the tbgrashape is on the form, setting the gradient otion it then renders.

Hope that helps track it down, please note that the same bgrabitmap and bgracontrols work fine on RC2 and 1.8.5, it the trunk version that is having the problem, in the IDE and in Compiled code.
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

josh

  • Hero Member
  • *****
  • Posts: 733
Re: New version of BGRABitmap
« Reply #454 on: December 25, 2018, 12:32:57 pm »
Hi

Just an update.

Problem is still in RC3 and latest trunk as of 25-12-18.

Tried latest BGRABITMAP and BGRACONTROLS, as well as previous versions I have that work fine in 1.8.5.

I also have issue with StringGrid not showing Border, whether this is related or not I do not know, i have created a Bug Report for the String Grid Issue 34761
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

circular

  • Hero Member
  • *****
  • Posts: 2856
    • Personal webpage
Re: New version of BGRABitmap
« Reply #455 on: December 26, 2018, 01:42:40 pm »
If I change the code then It draws a Red Rectangle.

I have done some further tests, It does not draw the border or fill the color, if I create the cradient and set the option to draw the border and fill with fradient then it renders.
That suggests that the problem would be with the Canvas2d thing, maybe in case of solid color.

What do you get with the test/testcanvas2d program?
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 2856
    • Personal webpage
Re: New version of BGRABitmap
« Reply #456 on: January 19, 2019, 06:10:30 pm »
New version of BGRABitmap 9.9.3
https://github.com/bgrabitmap/bgrabitmap/releases

Added support for resources.

You can load bitmaps and other objects like SVG using the LoadFromResource function. It takes a filename as a parameter. Example:
Code: Delphi  [Select]
  1. var
  2.   FBmp, FPng, FIco: TBGRABitmap;  
  3. begin
  4.   FBmp := TBGRABitmap.Create;
  5.   FBmp.LoadFromResource('CIRCLE1.BMP');
  6.   FPng := TBGRABitmap.Create;
  7.   FPng.LoadFromResource('MYCIRCLE2.PNG');
  8.   FIco := TBGRABitmap.Create;
  9.   FIco.LoadFromResource('MYICON.ICO');
  10.   ...
Both Lazarus resources and Windows resources are checked. Note that if it is a Windows resource, the extension of anything other than BMP, ICO, CUR and HTML will be equivalent to DAT (RCDATA). So the following will do the same (on Windows resources) :
Code: Delphi  [Select]
  1.   FPng.LoadFromResource('MYCIRCLE2.PNG');
  2.   FPng.LoadFromResource('MYCIRCLE2.DAT');
  3.   FPng.LoadFromResource('MYCIRCLE2');
  4.  
I suggest to use the actual extension if it is known (here PNG) because this will be compatible with Lazarus resources and it will help determine the proper image reader.

Note that you can replace the BGRAResource instance with your own and get the resources from anywhere you like.

Note that for now loading ICO and CUR from Windows resources is only implemented with the LCL. They can be embedded though as DAT files.

Related to https://github.com/bgrabitmap/bgrabitmap/issues/51

Layered bitmaps

Can handle now unknown originals, i.e. originals which class is not registered in the application. This allows for example to modify an existing layered bitmap without loosing the information of the existing originals. For example, one can flip the layers, thus changing the matrix transform for the original even if the original itself cannot be interpreted.

- Some bug fixes
- the "=" operator for TGuid is now public.
- LayoutRect parameter added to original editor (Render and GetRenderBounds functions)
- added editor snap to grid
- added click event and cursor for editor points
- added key events

Stretching and co

Added StretchPutImageProportionally. Just supply the bounding rectangle and the image will be stretched while keeping its aspect ratio.

CrossFade has been slightly optimised.

Image loading

New image format added ifSvg for SVG files. You need to add unit BGRASVG in the uses clause to define the image reader. SVG are rendered at 96 DPI by default though you can change it in the reader properties.

Thumbnail code has been a bit refactored so that SVG can also be rendered as thumbnails.

Text rendering

- Fixed memory leak in TextMultiline function.
- Fixed last paragraph bounds in TBGRATextBidi.

In BGRACanvas2d:
- take into account horizontal font alignment
- raster text replacement when not using vectorized text renderer

So it is not necessary anymore to use TBGRAVectorizedFontRenderer for Canvas2d text, though using regular text renderer is slower and won't handle drawing the text outline (using stroke instead of fill).

Polygon filling

- Fixed a bug when joining densities of polygon (there could be a seam)
- Added angular gradient gtAngular (see screenshot)
- Fixed solid color case for aliased RoundRect

Misc

- Compilation fix for fpGui
- opaque draw fix for Qt on Mac
Conscience is the debugger of the mind

Lainz

  • Hero Member
  • *****
  • Posts: 3082
    • https://lainz.github.io/
Re: New version of BGRABitmap
« Reply #457 on: January 19, 2019, 06:14:08 pm »
Congratulations that looks great, and will help the loading from resources, I was using it already in some bgracontrols but now we can move on and use directly from bgrabitmap with no extra coding :)

That angular gradient fill looks good.

circular

  • Hero Member
  • *****
  • Posts: 2856
    • Personal webpage
Re: New version of BGRABitmap
« Reply #458 on: January 19, 2019, 08:56:29 pm »
Thanks.  :)

I am progressing on LazPaint and VectorEdit. Some changes in the layered bitmaps will allow LazPaint to open an image with unknown layer originals, but preserve them, as long as there isn't any additional drawing on the layer of course.
Conscience is the debugger of the mind

bills

  • New member
  • *
  • Posts: 38
Re: New version of BGRABitmap
« Reply #459 on: January 24, 2019, 03:52:32 am »
Great Work.

circular

  • Hero Member
  • *****
  • Posts: 2856
    • Personal webpage
Re: New version of BGRABitmap
« Reply #460 on: January 25, 2019, 12:49:49 am »
Thanks. The challenge is stimulating.  :)
Conscience is the debugger of the mind

Phoenix

  • New member
  • *
  • Posts: 45
Re: New version of BGRABitmap
« Reply #461 on: January 27, 2019, 11:10:37 am »
Many thanks!!  :D

circular

  • Hero Member
  • *****
  • Posts: 2856
    • Personal webpage
Re: New version of BGRABitmap
« Reply #462 on: May 16, 2019, 09:54:39 pm »
New version of BGRABitmap 9.9.4
https://github.com/bgrabitmap/bgrabitmap/releases

- added constant BGRABitmapVersion and function BGRABitmapVersionStr
- added "releaser" program. It can automatically update the version of a project, package and JSON file.
See: https://forum.lazarus.freepascal.org/index.php/topic,45146.0.html

Font rendering:
- fixed bidi text for TextOutAngle function
- underline fix for some Linux fonts
- better handling of font quality/extent on Linux
- bidi support for vectorized font (so RTL text is handled but without ligature)

SVG:
- added good text support : spaces, spans, tref, positionning, gradients, bidi text, alignment, relative font size
- fixing style/attribute precedence
- using more typed values for attributes
- more generic linking system

Bidi text layout:
- keep paragraph alignment when modifying text using provided functions
- added untransformed functions
- refactoring into separate BGRAUnicodeText unit
- fix layout update when changing font bidi mode
- various fixes with empty text and end of lines

Layered bitmap:
- added A-Z special keys
- added LayerOriginalClass property
- fix editor focus

Miscellaneous:
- improved vectorize algorithm (better diagonals, parameter for diagonal width)
- PutImageAffine option to not use pixel-centered coords
- patch for TextFitInfo on old LCL
- fix SSE code for 64 bit
- added 3d test for software only
- using more inc/dec/include/exclude and Offset function to increase compatibility with Delphi
- fixing static functions
« Last Edit: May 16, 2019, 10:13:47 pm by circular »
Conscience is the debugger of the mind