Recent

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

SONFEDAI

  • Jr. Member
  • **
  • Posts: 55
Re: BGRAControls
« Reply #360 on: November 08, 2011, 08:24:04 pm »
@SONEFEDAI:

You mean these lines take to much time to run ? And afterwards, it's fast enough ?
Program start is too slow.

I Think "Because Power func is slow for windowsce and initgamma function 65535 times call power func."

After some background drawing is small slow nut no big problem...

If program start is normally no any big problem
I'm using
   Lazarus: 0.9.3.1
   Date: 2011-11-05
   FPC: 2.5.1
   SVN Ver.: 29060

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRAControls
« Reply #361 on: November 08, 2011, 10:42:32 pm »
@SONEFEDAI:

I propose to replace the function like this :
Code: [Select]
procedure InitGamma;
var
  i: integer;
{$IFDEF WINCE}
  j,prevpos,curpos,midpos: integer;
{$ENDIF}
begin
  //the linear factor is used to normalize expanded values in the range 0..65535
  GammaLinearFactor := 65535 / power(255, GammaExpFactor);

{$IFDEF WINCE}
  curpos := 0;
  GammaExpansionTab[0] := 0;
  GammaCompressionTab[0] := 0;
  for i := 0 to 255 do
  begin
    prevpos := curpos;
    curpos := round(power(i, GammaExpFactor) * GammaLinearFactor);
    if i = 1 then curpos := 1; //to avoid information loss
    GammaExpansionTab[i] := curpos;
    midpos := (prevpos+1+curpos) div 2;
    for j := prevpos+1 to midpos-1 do
      GammaCompressionTab[j] := i-1;
    for j := midpos to curpos do
      GammaCompressionTab[j] := i;
  end;
{$ELSE}
  for i := 0 to 255 do
    GammaExpansionTab[i] := round(power(i, GammaExpFactor) * GammaLinearFactor);

  for i := 0 to 65535 do
    GammaCompressionTab[i] := round(power(i / GammaLinearFactor, 1 / GammaExpFactor));

  GammaExpansionTab[1]   := 1; //to avoid information loss
  GammaCompressionTab[1] := 1;
{$ENDIF}
end;         

Does it solve the slowness ?
Conscience is the debugger of the mind

SONFEDAI

  • Jr. Member
  • **
  • Posts: 55
Re: BGRAControls
« Reply #362 on: November 08, 2011, 11:39:17 pm »
Does it solve the slowness ?
Thanks

Yes solve the problem...

Thanks again
I'm using
   Lazarus: 0.9.3.1
   Date: 2011-11-05
   FPC: 2.5.1
   SVN Ver.: 29060

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRAControls
« Reply #363 on: November 09, 2011, 04:01:45 pm »
Ok. I've updated the code on subversion.
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRAControls
« Reply #364 on: November 10, 2011, 04:05:05 pm »
BGRAControls 1.2.0.0
https://sourceforge.net/projects/bgracontrols/

Changelog:
- Fix in TBGRAButton AutoSize using different glyph sizes using or not caption and using TextCanvas.
- Added Style in TBGRAWin7ToolBar. Improved Win7ToolBar example.
- Changes in BGRASamples. Improved StyleButtons. Now all sample styles are using TextCanvas.
- Improved DrawArrow in TBGRAButton.
- TCustomBGRAVirtualScreen, TCustomWin7ToolBar (those are to create your own component based on this ones).
- Some other fixes.

See the attached screenshots.

Edit:

I need to publish this new one =)

BGRAControls 1.2.0.1
- Added SetSizeVariables in TBGRAButton.
- Added High DPI scaling in TBGRAButton default Size Variables and TBGRAWin7ToolBar default spacing under Windows.
- How those changes works: see 'Test Win 7 ToolBar' in testbgracontrols project.
« Last Edit: November 10, 2011, 06:02:15 pm by lainz »

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRAControls
« Reply #365 on: November 10, 2011, 08:02:13 pm »
Wow it looks nice.

I've tested it on Windows 7 with standard DPI, it works fine. Autosize seems perfect. Of course I'm wondering if this could be applied to TBGRALabel.
« Last Edit: November 10, 2011, 08:26:54 pm by circular »
Conscience is the debugger of the mind

SONFEDAI

  • Jr. Member
  • **
  • Posts: 55
Re: BGRAControls
« Reply #366 on: November 10, 2011, 10:36:46 pm »
Is it possible Graphic Position Layout?
I'm using
   Lazarus: 0.9.3.1
   Date: 2011-11-05
   FPC: 2.5.1
   SVN Ver.: 29060

lainz

  • Guest
Re: BGRAControls
« Reply #367 on: November 10, 2011, 11:20:47 pm »
Is it possible Graphic Position Layout?

Yes, but to do that we need to override:

DrawText
CalculatePreferredSize

Isn't easy.

Wow it looks nice.

I've tested it on Windows 7 with standard DPI, it works fine. Autosize seems perfect. Of course I'm wondering if this could be applied to TBGRALabel.

Thanks.

I've compared standar button with bgrabutton in different dpi settings and I've noticed that the scaling of the 'Size Variables' is only neccesary in a ToolBar, not for common buttons, noticed after publishing 1.2.0.1. BTW some buttons in Windows (like in the File Open dialog) are bigger than the others, others are bigger only in Width.

Depending of the needs, we can change this code 'OnCreate' in TBGRAButton:

Code: [Select]
  {$IFDEF WINDOWS}
    // default sizes under different dpi settings
    // ArrowSize, ArrowSpace, AutoSizeExtraVertical, AutoSizeExtraHorizontal.
    SetSizeVariables(ScaleX(8,96), ScaleX(16,96), ScaleY(8,96), ScaleX(24,96));
  {$ELSE}
    // default sizes
    SetSizeVariables(8, 16, 8, 24);
  {$ENDIF} 

Or use SetSizeVariables for each button we want to change the values ArrowSize, ArrowSpace, AutoSizeExtraVertical, AutoSizeExtraHorizontal.

If someone know the recommended values in other OS's post here.

SONFEDAI

  • Jr. Member
  • **
  • Posts: 55
Re: BGRAControls
« Reply #368 on: November 11, 2011, 12:50:31 am »
Yes, but to do that we need to override:

DrawText
CalculatePreferredSize

Isn't easy.
May be next version?
I'm using
   Lazarus: 0.9.3.1
   Date: 2011-11-05
   FPC: 2.5.1
   SVN Ver.: 29060

lainz

  • Guest
Re: BGRAControls
« Reply #369 on: November 11, 2011, 01:09:08 am »
Yes, but to do that we need to override:

DrawText
CalculatePreferredSize

Isn't easy.
May be next version?

I Don't know =)

lainz

  • Guest
Re: BGRAControls
« Reply #370 on: November 13, 2011, 01:38:40 am »
Commit changes:
- Added 'iOS Elements' in BGRASamples and testbgracontrols project.

You can draw the top tiny toolbar, the blue one and the tiled background.

Advice?
Be carefull using it, also using BGRASamples, because imitates some commercial OS's UI and I don't know if you need some permission or something to use that.

SONFEDAI

  • Jr. Member
  • **
  • Posts: 55
Re: BGRAControls
« Reply #371 on: November 13, 2011, 12:49:02 pm »
Where is the new sources?
I'm using
   Lazarus: 0.9.3.1
   Date: 2011-11-05
   FPC: 2.5.1
   SVN Ver.: 29060

lainz

  • Guest
Re: BGRAControls
« Reply #372 on: November 13, 2011, 03:26:16 pm »
Where is the new sources?

In the BGRAControls git repo.

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRAControls
« Reply #373 on: November 15, 2011, 08:39:15 am »
Here is a small bug with wordwrap with TBGRALabel : the shadow is not wrapped the same way.

Another one : the shadow offset is not in the right direction when VAlign is not top.
« Last Edit: November 15, 2011, 08:42:42 am by circular »
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRAControls
« Reply #374 on: November 15, 2011, 01:53:41 pm »
Here is a small bug with wordwrap with TBGRALabel : the shadow is not wrapped the same way.

Another one : the shadow offset is not in the right direction when VAlign is not top.

I don't know how it works codedeep need to fix that..

 

TinyPortal © 2005-2018