Recent

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

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: New version of BGRABitmap
« Reply #345 on: January 20, 2018, 02:57:44 pm »
New version of BGRABitmap (9.6)
  • Improvement of SVG rendering (gradients, line styles, fill modes)
  • Minor bug fixes

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

Many thanks to phoenixfenix and lainz for their help.

Phoenixfenix did the class structure to implement gradients in SVG files.
In the BGRAControls package, Lainz made a component TBCSVGViewer to display an SVG file.
In BGRAControls, you will find a test program in the directory "test/svg_viewer".

If you want to display an SVG file by code, you can still refer to BGRABitmap "test/testcanvas2d" folder. It is as simple as:
Code: Delphi  [Select][+][-]
  1. uses BGRASVG;
  2. var bmp: TBGRABitmap;
  3. ...
  4.   svg := TBGRASVG.Create;
  5.   svg.LoadFromFile('Amsterdammertje-icoon.svg');
  6.   svg.StretchDraw(bmp.Canvas2D, taCenter,tlCenter, 0,0,bmp.Width,bmp.Height);
  7.   svg.Free;

Radial gradients are now implemented in Canvas2D property:

Code: Delphi  [Select][+][-]
  1.     function createRadialGradient(x0,y0,r0,x1,y1,r1: single; flipGradient: boolean=false): IBGRACanvasGradient2D; overload;
  2.     function createRadialGradient(p0: TPointF; r0: single; p1: TPointF; r1: single; flipGradient: boolean=false): IBGRACanvasGradient2D; overload;
  3.     function createRadialGradient(x0,y0,r0,x1,y1,r1: single; Colors: TBGRACustomGradient; flipGradient: boolean=false): IBGRACanvasGradient2D; overload;
  4.     function createRadialGradient(p0: TPointF; r0: single; p1: TPointF; r1: single; Colors: TBGRACustomGradient; flipGradient: boolean=false): IBGRACanvasGradient2D; overload;

You can of course use TBGRAGradientScanner that was improved as well:
Code: Delphi  [Select][+][-]
  1. procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
  2. var
  3.   c1,c2: TPointF;
  4.   r1,r2: single;
  5.   scan: TBGRAGradientScanner;
  6. begin
  7.   //using screen center for first circle
  8.   c1.x := Bitmap.Width/2;
  9.   c1.y := Bitmap.Height/2;
  10.   r1 := min(Bitmap.Width,Bitmap.Height)/2;
  11.  
  12.   //using mouse position for second circle
  13.   c2.x := mx;
  14.   c2.y := my;
  15.   r2 := r1/4;
  16.  
  17.   scan := TBGRAGradientScanner.Create(c1, r1, c2, r2);
  18.   scan.SetGradient(CSSYellow, CSSGray);
  19.   Bitmap.Fill(scan, dmDrawWithTransparency);
  20.   scan.Free;
  21. end;  
« Last Edit: January 20, 2018, 04:54:37 pm by circular »
Conscience is the debugger of the mind

Phoenix

  • Jr. Member
  • **
  • Posts: 87
Re: New version of BGRABitmap
« Reply #346 on: January 20, 2018, 04:52:24 pm »
Thanks for this new release !!!  :D

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: New version of BGRABitmap
« Reply #347 on: January 20, 2018, 04:55:22 pm »
Thank you for you help  :)
Conscience is the debugger of the mind

balazsszekely

  • Guest
Re: New version of BGRABitmap
« Reply #348 on: January 20, 2018, 04:57:47 pm »
Hi Guys,

What is the fastest way to compare two BGRABitmaps? All I want to know if they are the same or not.

Thanks.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: New version of BGRABitmap
« Reply #349 on: January 20, 2018, 05:02:14 pm »
Hmm check if they have the same width and height, then CompareMem their data. Or use the Equals function of TBGRABitmap.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: New version of BGRABitmap
« Reply #350 on: February 07, 2018, 08:48:07 pm »
New version of BGRABitmap 9.6.1:
- Memory leak fix for SVG
- Polygon rendering fixes
- Gradient rendering fixes

Upgrade recommended if you're using polygons/shapes or SVG.

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

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: New version of BGRABitmap
« Reply #351 on: February 08, 2018, 02:05:34 am »
Thanks!!!  :D

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: New version of BGRABitmap
« Reply #352 on: April 24, 2018, 01:45:06 pm »
New version of BGRABitmap 9.6.2:
  •     BGRAIconCursor: fixes for icons/cursors
  •     BGRAIconCursor: added BGRADitherIconCursor function to dither icons if they have too many colors
  •     TBGRABitmap: added GetMaskFromAlpha to create a mask matching the alpha channel of the bitmap
  •     TBGRABitmap: added GetHasSemiTransparentPixels to know if there are pixels that are neither opaque nor fully transparent
  •     TBGRABitmap: minor fixes for PutImageAffine
  •     Canvas2D: fixed text offset when applying transforms
  •     avoid range errors in code so that the library can be compiled and run with range checks which helps with debugging
  •     TBGLVirtualScreen: added UseContext function to allow to access OpenGL context outside of regular events
  •     TBGLSprite: added Visible property
  •     BGRACanvas: fixed Frame3D function ("with" keyword ambiguity)

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

Upgrade recommended if you're using BGRAIconCursor or text on Canvas2D.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: New version of BGRABitmap
« Reply #353 on: April 24, 2018, 02:00:57 pm »
Thankyou!

Now we're all using OPM
https://forum.lazarus.freepascal.org/index.php/topic,34297.0.html

So you can tell @GetMem of the new version, so he can add it. (In OPM thread)

Also this website
https://packages.lazarus-ide.org/

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: New version of BGRABitmap
« Reply #354 on: April 24, 2018, 05:17:26 pm »
Ok. I've posted a message on OPM thread.

I am not sure how I can notify lazarus-ide.org about the new version of the package?
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: New version of BGRABitmap
« Reply #355 on: April 24, 2018, 05:38:01 pm »
Ok. I've posted a message on OPM thread.

Thanks.

I am not sure how I can notify lazarus-ide.org about the new version of the package?

And is not necessary, because it uses the same data as OPM, so if it's updated in one place, it's updated in the other.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: New version of BGRABitmap
« Reply #356 on: April 24, 2018, 06:55:36 pm »
Ok cool
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: New version of BGRABitmap
« Reply #357 on: April 25, 2018, 12:41:47 am »
Ok cool

Yes, is really nice. Of course in the PC you develop BGRABitmap it has no sense to install it like that, but for all users is really simple to install with OPM.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: New version of BGRABitmap
« Reply #358 on: April 25, 2018, 07:58:15 pm »
Of course. So users don't have to check this thread
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: New version of BGRABitmap
« Reply #359 on: April 25, 2018, 08:03:17 pm »
Well, that depends, I think it depends on the interest of the user.

If you want to know what are the new features and bugfixes, you will check this thread. If not, you will simply update.

I think the same happens with Lazarus, I'm just paying attention to these features / bugs I reported or I want.

 

TinyPortal © 2005-2018