Recent

Author Topic: [CLOSED] BGRAControls  (Read 549165 times)

lainz

  • Guest
Re: BGRAControls
« Reply #270 on: August 29, 2011, 03:21:48 am »
Hi, I commited new TBGRAButton and TBGRAPanel:

Changes:
  • TBGRAButton - big optimize. I cut draw algorithms from paint method. They don't need be calculated on each paint. So now graphic (gradients, shadows, etc) is calculated only when is necessary (on resize, etc.) and paint method draw prepared BGRA bitmaps directly. These changes reduce CPU usage about 2-3 times. Now drawing is more soft and light similar to native widgets ;)
  • TBGRAPanel - this same changes as in TBGRAButton

Regards

It's really fast.  :)

But now I have some problems with 'testbgracontrols': 'GlassMenu' doesn't works & 'Ribbon' has an acces violation (uribbon.pas line 72).

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #271 on: August 29, 2011, 08:13:24 pm »
I commited fixes. Now it should work

P.S. I notify some "pixbuff" error when try reopen some demo modal form (for example ribbon), but with BGRAButtons only, it works fine. It seems that this is vrutalscreen or some other component, hmm.

lainz

  • Guest
Re: BGRAControls
« Reply #272 on: August 30, 2011, 05:51:06 pm »
I've a problem with Static property, seems it's not working.
« Last Edit: August 31, 2011, 04:29:25 pm by lainz »

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #273 on: August 31, 2011, 07:26:44 pm »
Commit changes:

- Added BeginUpdate and EndUpdate in TBGRAButton and TBGRAPanel. It works similar like in TListView - if you change many propertys in runtime you can reduce paint call by:
Code: Pascal  [Select][+][-]
  1. begin
  2.   BGRAButton1.BeginUpdate;
  3.   try
  4.     BGRAButton1.BorderWidth := 1;
  5.     BGRAButton1.BodyNormal.Gradient1.EndColor := clgreen;
  6.     BGRAButton1.BodyHover.Gradient1.EndColor := clred;
  7.     .....
  8.   finally
  9.     BGRAButton1.EndUpdate;
  10.   end;
  11. end;
  12.  

- TBGRAPanel: Fix - some propertys was not refreshed after changing it
I've a problem with Static property, seems it's not working.
I check this. Thanks

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #274 on: September 04, 2011, 07:37:15 pm »
Commit changes:
  • TBGRAButton: Fix for StaticButton property
  • TBGRAButton: Added Down property

lainz

  • Guest
Re: BGRAControls
« Reply #275 on: September 05, 2011, 12:43:09 am »
Commit changes:
  • TBGRAButton: Fix for StaticButton property
  • TBGRAButton: Added Down property

Thankyou. You will see some commits after yours, that was because I commited without push first- The current revision is the same you commited.

I'm trying to add some Metro UI 'templates' like in testbgracontrols 'ubgrasamples' & 'ubgraribbon'. I't getting popular that interface.

lainz

  • Guest
Re: BGRAControls
« Reply #276 on: September 05, 2011, 04:08:45 am »
- Added Metro UI color button in 'testbgracontrols'.

By default the button has an opacity of 180 and mouse enter and pressed stages has 255, it's the only difference. If you want to look the same this requires Segoe WP font.
« Last Edit: September 05, 2011, 04:15:31 am by lainz »

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #277 on: September 05, 2011, 05:37:31 pm »
I commited some other fixes for TBGRAButton (e.g. Gradient1EndPercent was not remembered by object inspector)

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #278 on: September 06, 2011, 10:22:45 pm »
Commit changes:
- Added OnAfterPrepareBGRAButton event in TBGRAButton
- Added OnAfterPrepareBGRAPanel event in TBGRAPanel
- Some fixes for TBGRAPanel

P.S. Anyone know why ImgList unit is commented in bgraimagelist.pas? I can't compile bgracontrols package without this unit on linux.

lainz

  • Guest
Re: BGRAControls
« Reply #279 on: September 07, 2011, 03:48:46 am »
Commit changes:
- Added OnAfterPrepareBGRAButton event in TBGRAButton
- Added OnAfterPrepareBGRAPanel event in TBGRAPanel
- Some fixes for TBGRAPanel

P.S. Anyone know why ImgList unit is commented in bgraimagelist.pas? I can't compile bgracontrols package without this unit on linux.

That's from the time when I uses Jedi Code format and I removed all the unused units. I did that from windows, never tested on linux. So you can uncomment.

- I've removed the picture from testbgracontrols 'Metro UI'.. 6mb that's a lot.

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRAControls
« Reply #280 on: September 08, 2011, 10:31:52 pm »
Hello people !

I've nothing to say, it's just to say hello. I'm happy to see that BGRABitmap is still alive thanks to you people.  :)
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRAControls
« Reply #281 on: September 09, 2011, 04:52:54 am »
I've created my first game with BGRAControls
http://lazarus.freepascal.org/index.php/topic,14463.0.html

If I can solve (or someone =) ) the bugs maybe we can put it as sample in the package  8-)

lainz

  • Guest
Re: BGRAControls
« Reply #282 on: September 11, 2011, 03:02:54 am »
I do not agree. It seems that the problem comes from Qt version of TBGRABitmap.Draw with alpha blending. It seems that it draws with black background.

This depends on unit "bgraqtbitmap.pas" which is not well optimized. Any help with it would be appreciated. For example, it would be faster to use specific Qt functions. More generally, if TBitmap can be used to draw with transparency, the bug we are talking about could be solved by rewriting SlowDrawTransparent function :
Quote
procedure TBGRAQtBitmap.SlowDrawTransparent(ABitmap: TBGRADefaultBitmap;
  ACanvas: TCanvas; ARect: TRect);
begin
  ACanvas.Draw(0,0, ABitmap.Bitmap);
end;

Does it work ?

It is possible that GetImageFromCanvas does not work either.

In fact, in testbgrafunc, it is test 3 that shows if transparent drawing on Canvas works. If it doesn't, pacman should have a black background.

The same problem in Windows, not only in Linux with Qt.

I've replaced the procedure with this one in Windows7 and works (Qt 4.7.3). I've commited the bgraqtbitmap.pas

Running 'testbgrafunc' works really bad:
* The window content is not updated: i need to resize the form to see changes
* Test 1 & Test 2: transparency with a 'black' background, it's like a bad semi-transparency.. (you know Test 5 is ok)
* Test 3 & Test 4: there is a black box right to the pacman

Test Canvas 2D is ok. Test 3D is ok.

bgracontrols:
* BGRASpriteAnimation doesn't resize (stretch, etc..)
* BGRAButton dropdown doesn't works.

LazPaint:
* Fonts are larger (tested only in HighDPI), seems that Qt is HighDPI aware by itself (talking about font's size).
« Last Edit: September 11, 2011, 03:30:10 am by lainz »

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRAControls
« Reply #283 on: September 13, 2011, 01:33:26 am »
I've replaced the procedure with this one in Windows7 and works (Qt 4.7.3). I've commited the bgraqtbitmap.pas
Ok.

Quote
Running 'testbgrafunc' works really bad:
* The window content is not updated: i need to resize the form to see changes
testbgrafunc doesn't use the onPaint event. it would be more cross-platform with an OnPaint event and a call to Invalidate. it would be necessary to specify that background must not be erased to avoid flickering.

Quote
* Test 1 & Test 2: transparency with a 'black' background, it's like a bad semi-transparency.. (you know Test 5 is ok)
* Test 3 & Test 4: there is a black box right to the pacman
Ok so basically alpha channel doesn't work.

Quote
Test Canvas 2D is ok. Test 3D is ok.
It uses a TBGRAVirtualScreen.

Quote
LazPaint:
* Fonts are larger (tested only in HighDPI), seems that Qt is HighDPI aware by itself (talking about font's size).
This could be fixed with a compiler directive in the HighDPI unit.
Conscience is the debugger of the mind

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRAControls
« Reply #284 on: September 13, 2011, 09:21:50 pm »
Commit changes:
  • TBGRAPanel - added caption alignment, layout and shadow
  • TBGRAImageList - uncommented ImgList unit (commented by uses cleaner)

 

TinyPortal © 2005-2018