Recent

Author Topic: BGRABitmap tutorial  (Read 351817 times)

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRABitmap tutorial
« Reply #360 on: February 26, 2013, 11:23:34 pm »
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRABitmap tutorial
« Reply #361 on: February 27, 2013, 12:10:11 am »
Ok.

Download latest BGRAControls SVN. Open the test_customdrawn_windows 7 project. Compile. It works. Close the application. The heaptrc unit show 'memory heap' (not freed memory)...

I think that the problem is on TBGRAMultiSliceScaling, if I create from a TBGRABitmap it does not free the source object. FBitmapOwned := false;

You can add an option like 'BitmapOwned: Boolean'? Because I need to free the bitmap when the TBGRAMultiSliceScaling is freed.

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRABitmap tutorial
« Reply #362 on: February 27, 2013, 10:30:31 am »
Ok, it's updated on subversion. Just add a boolean at the end of the Create call :
Code: [Select]
    Result := TBGRAMultiSliceScaling.Create(bmp, ini.ReadInteger(Section, 'MarginTop', 0),
      ini.ReadInteger(Section, 'MarginRight', 0), ini.ReadInteger(Section,
      'MarginBottom', 0), ini.ReadInteger(Section, 'MarginLeft', 0),
      ini.ReadInteger(Section, 'NumberOfItems', 1), Direction, True);
8-)
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRABitmap tutorial
« Reply #363 on: February 27, 2013, 02:02:11 pm »
Thanks =) It's nice.

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRABitmap tutorial
« Reply #364 on: March 04, 2013, 06:39:40 pm »
New version of BGRABitmap (7.0) with :
- more filters can be applied to a rectangle part : FilterSharpen, FilterBlurRadial, FilterBlurMotion, FilterGrayscale, FilterNormalize, FilterTwirl, LinearNegativeRect, NegativeRect
- blur filter tasks that can be put into threads
- slice scaling Owned parameter

How to use blur tasks :
Code: [Select]
uses BGRAFilters;
var task: TFilterTask;
begin
  task := BGRAFilters.CreateMotionBlurTask(bitmap,bounds,distance,angle,oriented);
  task.CheckShouldStop:= @MyCheckShouldStopFunc; //function to tell to stop the task
  try
    Result := task.Execute; //result may not be finished if the task has been stopped
  finally
    task.Free;
  end;
end;
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRABitmap tutorial
« Reply #365 on: March 07, 2013, 08:55:51 pm »
New version of BGRABitmap (7.1) with :
- Phong lighting vertical position fix
- compilation fix for blur for 32-bit
- TBGRAVectorizedFontRenderer : MaxFontResolution property -> you can use quadratic bezier approximation instead of full vectorization
- TBGRAPolygonalGlyph : Closed and MinimumDotProduct properties -> useful for easy bezier (see below)
- added ComputeEasyBezier in BGRATypeWriter unit -> simply define a polygon and it will be rounded using bezier curves when the dot product is above some value (which means it is not too much of an angle)
- BGRACanvas2D : added CurrentPath property -> you can get the points computed for the current path
- TBGRABitmap : InplaceGrayscale and grayscale task -> so you don't need to allocate a new bitmap to apply grayscale

How to use Easy Bezier :
Code: [Select]
uses BGRABitmap, BGRABitmapTypes, BGRATypewriter;

procedure TForm1.FormPaint(Sender: TObject);
var bmp: TBGRABitmap;
begin
  bmp := TBGRABitmap.Create(ClientWidth,ClientHeight,ColorToRGB(clBtnFace));
  bmp.DrawPolygonAntialias(ComputeEasyBezier(
    [PointF(10,10), PointF(50,10),PointF(90,50),PointF(90,100),PointF(20,100)],
    True, 0.5), BGRABlack, 5);
  bmp.Draw(Canvas,0,0);
  bmp.Free;
end;
« Last Edit: March 07, 2013, 09:08:02 pm by circular »
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRABitmap tutorial
« Reply #366 on: March 07, 2013, 10:11:47 pm »
nice easy bezier!

idc65

  • Jr. Member
  • **
  • Posts: 50
Re: BGRABitmap tutorial
« Reply #367 on: March 08, 2013, 01:05:45 pm »
Help

Just installed version 7.1

Lazarus, compiled and installed, rebuilt but when restarting it just beeps, then exits?

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRABitmap tutorial
« Reply #368 on: March 08, 2013, 01:37:43 pm »
Strange. Is it 32 bit or 64 bit Lazarus ?

Did you add another package too ?
Conscience is the debugger of the mind

idc65

  • Jr. Member
  • **
  • Posts: 50
Re: BGRABitmap tutorial
« Reply #369 on: March 08, 2013, 01:46:43 pm »
Hi

32bit on 64bit wndows

No but, i think has something to with the version of bgracontrols 2.0.6, as when it loaded in my project that had controls in it would beep and exit.

So i loaded lazarus.old.exe so that i could create a blank project. then exit. then when I loaded lazarus.exe it started and worked fine, but still would not open my project beep then exit.

So i will go back and use the bgrabitmap 6.9.2 with the bgracontrols 2.0.6 that i had before until I can fathom out where the problem is.

My Project is not using any of the depricated controls bgracontrols.

« Last Edit: March 08, 2013, 01:55:16 pm by idc65 »

lainz

  • Guest
Re: BGRABitmap tutorial
« Reply #370 on: March 08, 2013, 02:11:40 pm »
I have Lazarus 32 on Windows 64 and works, maybe the difference is I'm using both packages SVN and Lazarus svn + fpc 2.6.0

idc65

  • Jr. Member
  • **
  • Posts: 50
Re: BGRABitmap tutorial
« Reply #371 on: March 08, 2013, 02:31:45 pm »
Hi

I am using fpc 2.7.1 lazarus 1.1 svn 40362.

When i go back to 6.9.2 all works fine and I can open project, but with 7.1 beep and exit.

It's not a great problem at the moment, As I will continue to use the version that I have

using earlier version of BGACONTROLS as it is going to take lots of work to convert all projects to not use the removed controls.



Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRABitmap tutorial
« Reply #372 on: March 11, 2013, 02:36:01 pm »
I can't compile BGRABitmap 7.1 on Linux 64 bit (GTK)
On stable FPC 2.6.0 I get error in unit BGRASSE in line 159 (function Add_AlignedSSE) in asm [dest]:
Quote
Fatal: Internal error 201001032
On FPC 2.7.1 from SVN I get error in BGRABitmapTypes, line 2770 (IntersectLine):
Quote
Fatal: Internal error 2012090607

BTW: I want try BGRA Chart extension: http://wiki.freepascal.org/BGRABitmap_tutorial_TAChart  but don't know where to download this package

Sternas Stefanos

  • Full Member
  • ***
  • Posts: 170
  • Ex Pilot, M.Sc, Ph.D
    • http://www.pilotlogic.com
Re: BGRABitmap tutorial
« Reply #373 on: March 11, 2013, 02:47:02 pm »
Temporary solution:
in bgrasse.inc

{$IFDEF MSWINDOWS}  // 9999 for CodeTyphon Studio
  {$IFDEF cpux86_64}
    {$DEFINE BGRASSE_AVAILABLE}
  {$ENDIF}
{$ENDIF}

CodeTyphon Architect and Programmer

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRABitmap tutorial
« Reply #374 on: March 11, 2013, 02:59:40 pm »
After this trick, I get another error (FPC 2.6.0):

BGRASSE line 232 "uknown identifer RBX"

 

TinyPortal © 2005-2018