Lazarus

Announcements => Third party => Topic started by: Dibo on March 14, 2011, 12:50:45 am

Title: [CLOSED] BGRAControls
Post by: Dibo on March 14, 2011, 12:50:45 am
Hi,

All details for this package are now available on wiki page created by lainz. Big thanks.
http://wiki.lazarus.freepascal.org/BGRAControls

Regards
Title: Re: BGRAImageList - solution for GTK alpha
Post by: Marc on March 14, 2011, 10:58:15 am

License: I know nothing about licensing. I added GNU from Lazarus wizard. Just download and do what you want. It is free


A to be LCL compatible, use at least LGPL+linking exception (the same as the LCL)
Title: Re: BGRAImageList - solution for GTK alpha
Post by: circular on March 14, 2011, 11:39:22 am
You can find it in the bgrabitmap directory. There are 3 files :

- one that say that this is under LGPL with linked exception
- the LGPL
- the link exception
Title: Re: BGRAImageList - solution for GTK alpha
Post by: Dibo on March 14, 2011, 05:32:33 pm
New version 1.0.1.0 (link in first post)

@circular. If you don't mind, I copied this license files and change description, contact etc. In top of my files I added LGPL license from lazarus wizard "Source -> Insert General -> Modified LGPL notice". Now everything is ok?

My patch to TImageList has been accepted, so lazarus revision >=29834 is required.

Regards
Title: Re: BGRAImageList - solution for GTK alpha
Post by: Dibo on March 14, 2011, 08:14:49 pm
New version 1.0.2.0
Small optimization. This is final version. I think this component has nothing more to do.
Title: Re: BGRAImageList - solution for GTK alpha
Post by: circular on March 14, 2011, 08:48:07 pm
@circular. If you don't mind, I copied this license files and change description, contact etc. In top of my files I added LGPL license from lazarus wizard "Source -> Insert General -> Modified LGPL notice". Now everything is ok?
I suppose.
Title: Re: BGRAImageList - solution for GTK alpha
Post by: joseme on March 17, 2011, 02:04:19 pm
Dibo, thanks for your work. Day after day I see Lazarus grow with the effort of people like you.
Title: Re: BGRAImageList - solution for GTK alpha
Post by: Dibo on March 17, 2011, 05:52:03 pm
Thanks
Title: Re: BGRAImageList - solution for GTK alpha
Post by: Gintas on March 18, 2011, 03:41:06 pm
Now you need to make same with TSpeedButton :)
Title: Re: BGRAImageList - solution for GTK alpha
Post by: Dibo on March 19, 2011, 01:56:37 pm
Yes. I think about this
Title: Re: BGRAImageList - solution for GTK alpha
Post by: Dibo on March 21, 2011, 06:17:43 pm
New version 1.0.3.0
BGRABitmap updated to 2.6 version
Title: Re: BGRAControls - solution for GTK alpha
Post by: Dibo on April 07, 2011, 02:40:43 pm
New version 1.0.5.0

Changes:

Link and details in first post.

Regards
Title: Re: BGRAControls - solution for GTK alpha
Post by: circular on April 07, 2011, 07:40:42 pm
I don't understand why you would use Opaque mode. It's designed to work only with opaque images. In this case, bitmaps have transparent parts, so Opaque should not be used.  %)
Title: Re: BGRAControls - solution for GTK alpha
Post by: Dibo on April 07, 2011, 08:23:58 pm
I don't know why :D . This param is default True and work fine on GTK so I thought that it is recommended
Title: Re: BGRAControls - solution for GTK alpha
Post by: circular on April 07, 2011, 11:21:21 pm
Well, I did not expect it to work. It seems that Gtk handles transparent drawing. So in fact, BGRABitmap could be modified so that it would do this when parameter is at False, and it should be modified so that with parameter True, it would fill the background as well.

In the meantime, it is surely faster with True for now. We need to modifiy both at the same time. In BGRABitmap I should do the change and in your library, you should put False as a parameter.
Title: Re: BGRAControls - solution for GTK alpha
Post by: Dibo on April 07, 2011, 11:25:45 pm
Ok, thanks for info. I will observe LazPaint topic for changes :)
Title: Re: BGRAControls - solution for GTK alpha
Post by: circular on April 08, 2011, 01:23:09 am
I will send you a PM when I do.
Title: Re: BGRAControls - solution for GTK alpha
Post by: Dibo on April 10, 2011, 03:12:09 pm
New version 1.0.6.0

Synchronization with "opaque" mode of BGRABitmap. Link in first post
Title: Re: BGRAControls - solution for GTK alpha
Post by: lainz on April 15, 2011, 06:29:49 pm
New version 1.0.5.0

Changes:
  • I created new component TBGRASpeedButton which inherit from TSpeedButton and draw glyph using BGRABitmap (see attached screens in first post), so I change package name from BGRAImageList to BGRAControls. All components are available now in own components palette "BGRA Controls"
  • Package doesn't include BGRABitmap source anymore. BGRABitmap from version 2.4 is published as independent package, so you need install it at first. BGRABitmap package is added as required package of BGRAControls package
  • On windows, controls don't use Opaque mode (I notify some random artifacts)
  • You can install BGRAControls package with -dGTK_ONLY switch in compiler options. With this switch it use default lazarus drawing for other interfaces than GTK

Link and details in first post.

Regards

Amazing  ::)

You can do a 'Image Button' component with BGRABitmap? I need the component for this:

http://www.lazarus.freepascal.org/index.php/topic,12824.msg66429.html#msg66429
Title: Re: BGRAControls - solution for GTK alpha
Post by: Dibo on April 15, 2011, 06:52:47 pm
What this component should do? Draw PNG image as button in different states?
Title: Re: BGRAControls - solution for GTK alpha
Post by: lainz on April 15, 2011, 08:16:34 pm
What this component should do? Draw PNG image as button in different states?

Exactly.
Title: Re: BGRAControls - solution for GTK alpha
Post by: Dibo on April 15, 2011, 08:35:54 pm
Because I looked quickly at your source and I saw that you don't draw images but only draw gradients etc.
Title: Re: BGRAControls - solution for GTK alpha
Post by: lainz on April 18, 2011, 04:35:18 pm
Because I looked quickly at your source and I saw that you don't draw images but only draw gradients etc.

I'm sorry. Now I know the right translation for 'image' / 'picture' / 'bitmap' & 'drawing'.

I must say bgra-bitmap or bgra drawing. Never picture or image file.

The component must draw a bitmap in a canvas in different states, not a PNG file.
Title: Re: BGRAControls - solution for GTK alpha
Post by: Dibo on May 01, 2011, 12:05:52 am
New version 1.0.8.0

New components:
TBGRAButton - Customizable graphic component which using only BGRABitmap functions for drawing (see attached screen). Demo project included in package. Functionality:
I wanted add "container" functionality (like TPanel) so this same component could be used as toolbar with childs but TCustomControl have no transparency. I created task for this issue in forum:
http://www.lazarus.freepascal.org/index.php/topic,12933.0.html
and mailing list:
http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-April/062683.html
But no response :/ . I try report this as a bug. Instead, I created TBGRAPanel with similar gradient functionality (but very limited)
TBGRAPanel - Simple TPanel descendant which can have gradient background. Created especially for TBGRAButton (for creating nice looking toolbar for bgrabuttons)

Download link in first post

I think I should create some lazarus wiki page for BGRA Controls. I can't add more screens in first post :P
Title: Re: BGRAControls - solution for GTK alpha
Post by: CaptBill on May 01, 2011, 01:36:05 am
Quote
Dibo:
I think I should create some lazarus wiki page for BGRA Controls. I can't add more screens in first post Tongue

Please do. Excellent work.

If you can build container array that will be sweet, very sweet.

Even without the transparency would be very nice. Any chance you can just do a no-transparency version?
Title: Re: BGRAControls - solution for GTK alpha
Post by: Dibo on May 01, 2011, 01:39:00 am
Even without the transparency would be very nice. Any chance you can just do a no-transparency version?
Then will be problem. Look at rounded buttons on demo screen, if I change this component to "container" then rounded space will by painted by some default control color (I have no influence on it)
Title: Re: BGRAControls - solution for GTK alpha
Post by: CaptBill on May 01, 2011, 02:16:17 am
Even without the transparency would be very nice. Any chance you can just do a no-transparency version?
Then will be problem. Look at rounded buttons on demo screen, if I change this component to "container" then rounded space will by painted by some default control color (I have no influence on it)

Ok.Thanks.

I just installed BGRAControls and all seem to go well. Are these components suppose to show up on the component pallet? Same with BGRAbitmappack. I assumed they are loaded in a nonvisual mode(no visible components). They are listed loaded in 'installed static, autoinstall static'. Should I be seeing a new tab on the components pallet or no?

Title: Re: BGRAControls
Post by: Dibo on May 01, 2011, 02:18:12 am
They all should be in own pallet "BGRA Controls". They are designing components (sorry for my english)
Title: Re: BGRAControls
Post by: CaptBill on May 01, 2011, 02:37:05 am
Managed to get it installed on the pallet. Every thing looks very nice ,very nice indeed. THIS is where its at for graphics. Good deal.

I am have a serious conflict with the speedbutton component somewhere, unfortunately. I get this every time I drop one on a form......

"Invalid raw image format (15 found)"

Crashes Lazarus each time. Am I missing some image format driver maybe?

Thanks again.

Edit:
I am running the newest CodeTyphon 1.6 install (Laz9.31) on Xp, btw.
Title: Re: BGRAControls
Post by: circular on May 01, 2011, 10:41:33 am
I've tried to fix the raw image format issue. Try download last version on subversion and tell me if it works. You'll need to recompile Lazarus (in Tools menu).

Checkout address : https://lazpaint.svn.sourceforge.net/svnroot/lazpaint

Title: Re: BGRAControls
Post by: fabienwang on May 01, 2011, 11:28:20 am
Excellent work Dibo, I really like these new components :D
Do you plan to extend it to other components like TEdit, TMemo, etc. ?

The Speedbutton is working for me (with latest version of brgabitmap).
Title: Re: BGRAControls
Post by: circular on May 01, 2011, 12:59:33 pm
Hello Dibo,

Nice work !

I saw that you were looking for an idea with gradients on buttons.

Here is suggestion for DrawBasicBody procedure in BGRAButton :
Code: [Select]
  case ABody.FStyle of
    bbsClear, bbsColor:
      { Solid background color }
      FBGRA.RoundRectAntialias(ARect.Left,ARect.Top,ARect.Right,ARect.Bottom,FRoundX,FRoundY,
        borcolor, FBorderWidth, backcolor);
    bbsGradient:
      begin
        { Using multishape filler to merge background gradient and border }
        multi := TBGRAMultishapeFiller.Create;
        multi.PolygonOrder := poFirstOnTop; { Border will replace background }

        if borcolor.alpha <> 0 then { Let the background be wider with transparent border }
          multi.AddRoundRectangleBorder(ARect.Left,ARect.Top,ARect.Right,ARect.Bottom,FRoundX,FRoundY,
            FBorderWidth, borcolor);

        { Gradients }
        back := TBGRABitmap.Create(ClientWidth,ClientHeight,BGRAPixelTransparent);
        grect1 := ARect;
        grect2 := ARect;
        { Gradient 1 }
        if ABody.FGradient1EndPercent>0 then
        begin
          grect1.Bottom := Round((grect1.Bottom/100)*ABody.FGradient1EndPercent);
          gra := CreateGradient(ABody.FGradient1, grect1);
          back.FillRect(grect1.Left,grect1.Top,grect1.Right,grect1.Bottom,
            gra,dmSet
          );
          gra.Free;
        end;
        { Gradient 2 }
        if ABody.FGradient1EndPercent<100 then
        begin
          if grect1.Bottom<ARect.Bottom then
            grect2.Top := grect1.Bottom-1;
          gra := CreateGradient(ABody.FGradient2, grect2);
          back.FillRect(grect2.Left,grect2.Top,grect2.Right,grect2.Bottom,
            gra,dmSet
          );
          gra.Free;
        end;

        multi.AddRoundRectangle(ARect.Left,ARect.Top,ARect.Right,ARect.Bottom,FRoundX,FRoundY, back);

        multi.Draw(FBGRA);
        multi.Free;

        back.Free;
      end;
  end;     
Title: Re: BGRAControls
Post by: Dibo on May 01, 2011, 01:10:55 pm
Thanks! I will try it :)
Title: Re: BGRAControls
Post by: circular on May 01, 2011, 01:38:12 pm
You're welcome.

For TImageList, here is a way to handle better grayscale effect and transparency selection :
Code: [Select]
{*** BGRA Drawing *** }
  case ADrawEffect of
    gdeDisabled:
      begin
        GetBitmap(AIndex, FBmp, gdeNormal);
        FBGRA.Assign(FBmp);
        BGRAReplace(FBGRA, FBGRA.FilterGrayscale);
      end;
    else
    begin
      GetBitmap(AIndex, FBmp, ADrawEffect);
      FBGRA.Assign(FBmp);
    end;
  end;
  if ADrawingStyle in[dsFocus, dsSelected] then FBGRA.ApplyGlobalOpacity(128);
  FBGRA.Draw(ACanvas, AX, AY, False);          

Here on Windows 7 64-bit, I've got some issues of white background. Did you encounter this already ?

EDIT: I noticed the glyph on TBGRAButton is shifted vertically when vertical align is not btvaCenter.
Title: Re: BGRAControls - solution for GTK alpha
Post by: lainz on May 01, 2011, 03:25:25 pm
New version 1.0.8.0

First thank you again  8)

Then i got this for you, like Windows 7 explorer toolbar button, add a BGRAPanel with a BGRAButton inside, then go OnCreate event of Form1 and add this code:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   // Panel
  4.   with BGRAPanel1 do begin
  5.     Gradient.StartColor:=RGBToColor(245,250,255);
  6.     Gradient.EndColor:=RGBToColor(221,233,247);
  7.   end;
  8.   // Button
  9.   with BGRAButton1 do begin
  10.     TextShadow:=False;
  11.     RoundX:=2;
  12.     RoundY:=2;
  13.     // Normal
  14.     with BodyNormal do begin
  15.       Font.Color:=clBlack;
  16.       BorderStyle:=bboNone;
  17.       Style:=bbsClear;
  18.     end;
  19.     // Hover
  20.     with BodyHover do begin
  21.       Font.Color:=clBlack;
  22.       Gradient1EndPercent:=50;
  23.       BorderColor:=RGBToColor(187,202,219);
  24.       Gradient1.StartColor:=RGBToColor(248,251,254);
  25.       Gradient1.EndColor:=RGBToColor(237,242,250);
  26.       Gradient2.StartColor:=RGBToColor(215,228,244);
  27.       Gradient2.EndColor:=RGBToColor(193,210,232);
  28.     end;
  29.     // Clicked
  30.     with BodyClicked do begin
  31.       Font.Color:=clBlack;
  32.       Gradient1EndPercent:=55;
  33.       BorderColor:=RGBToColor(187,202,219);
  34.       Gradient1.StartColor:=RGBToColor(226,236,245);
  35.       Gradient1.EndColor:=RGBToColor(216,228,241);
  36.       Gradient2.StartColor:=RGBToColor(207,219,236);
  37.       Gradient2.EndColor:=RGBToColor(207,220,237);
  38.     end;
  39.   end;
  40. end;  

See attached image 'bgratoolwin7.png'.

Suggestion:
* Add 'LightColor' for BGRAButton, is a light inside the button (next to BorderColor).
Title: Re: BGRAControls
Post by: Dibo on May 01, 2011, 03:34:03 pm
Nice :) . I see it is worth developing further
Title: Re: BGRAControls
Post by: lainz on May 01, 2011, 04:24:09 pm
Nice :) . I see it is worth developing further

I created an article in the Wiki:
http://wiki.lazarus.freepascal.org/BGRAControls

And a gallery of buttons created with BGRAButton:
http://wiki.lazarus.freepascal.org/BGRAButton_Gallery

Feel free to edit!  :-[
Title: Re: BGRAControls
Post by: Dibo on May 01, 2011, 05:33:19 pm
Wow thanks! I never did wiki pages so I could not find time for this. Thanks again
Title: Re: BGRAControls
Post by: circular on May 01, 2011, 05:55:28 pm
Hello people,

Here is a knob button control I've made. Dibo, can you include it in the next version of your package ?

By the way, nice work Lainz.  ::)
Title: Re: BGRAControls
Post by: circular on May 01, 2011, 06:00:30 pm
Here is a screenshot :
Title: Re: BGRAControls
Post by: Dibo on May 01, 2011, 08:08:41 pm
Sure. Thanks :)
Title: Re: BGRAControls
Post by: lainz on May 01, 2011, 09:24:47 pm
Is possible to set the same properties for all TBGRAButtons in a form at the same time?
Title: Re: BGRAControls
Post by: Dibo on May 01, 2011, 09:45:57 pm
Temporary you could create some sub procedure like:
Code: Pascal  [Select][+][-]
  1. procedure TForm.OnCreate(Sender: TObject);
  2.  
  3.   procedure _DefaultPropertys(AButton: TBGRAButton);
  4.   begin
  5.     AButton.BodyHover.Gradien1.StartColor := clred;
  6.     // etc...
  7.   end;
  8.  
  9. begin
  10.   _DefaultPropertys(BGRAButton1);
  11.   _DefaultPropertys(BGRAButton2);
  12.   _DefaultPropertys(BGRAButton3);
  13. end;
  14.  
But I want override procedure "Assign" and copy propertys there. So in next release you just call:
Code: Pascal  [Select][+][-]
  1. BGRAButton2.Assign(BGRAButton1);
  2. BGRAButton3.Assign(BGRAButton1);
  3.  
Title: Re: BGRAControls
Post by: ik on May 01, 2011, 10:53:38 pm
Or simply do something like so:

Code: Pascal  [Select][+][-]
  1. ...
  2. for i := 0 to Form1.ComponantCount -1 do
  3.     if Form1.Components[i] is TBGRAButton then
  4.       Form1.Components[i].BodyHover.Gradien1.StartColor := clred;
  5. ...
Title: Re: BGRAControls
Post by: lainz on May 01, 2011, 11:20:12 pm
Why if I set RoundX & RoundY to 0 background isn't displayed?

PD: I'm using Windows 7.
Title: Re: BGRAControls
Post by: Dibo on May 01, 2011, 11:27:00 pm
I just published a lot of BGRABitmap functions. I don't even know for what are most of them ;) . I try add some safety-valve (sorry for my english). I think 1 is minium value so I should handle zero values
Title: Re: BGRAControls
Post by: lainz on May 02, 2011, 05:15:22 pm
I just published a lot of BGRABitmap functions. I don't even know for what are most of them ;) . I try add some safety-valve (sorry for my english). I think 1 is minium value so I should handle zero values

Yes if I want a square button I need to use 0 in RoundX & RoundY (the corner pixels are affected if I use 1).

Wiki:

Updated BGRAButton Gallery with more examples, enjoy those buttons!

http://wiki.lazarus.freepascal.org/BGRAButton_Gallery
Title: Re: BGRAControls
Post by: lainz on May 02, 2011, 08:43:57 pm
For Windows users:

If you use BGRAButton with Windows remember to set Self.DoubleBuffered:=True; OnCreate event of each Form, else the button will flicker if you are running without themes (classic).
Title: Re: BGRAControls
Post by: Shebuka on May 04, 2011, 09:42:49 am
Hello people,

Here is a knob button control I've made. Dibo, can you include it in the next version of your package ?

By the way, nice work Lainz.  ::)

Can you make an example project with this control?

Edit: Con you also Add some sort of 2 state button, like the standard ToggleBox (which on Mac OS X is look ugly...)
Title: Re: BGRAControls
Post by: circular on May 04, 2011, 03:42:09 pm
Updated BGRAButton Gallery with more examples, enjoy those buttons!

http://wiki.lazarus.freepascal.org/BGRAButton_Gallery
I like the office button !
Title: Re: BGRAControls
Post by: circular on May 04, 2011, 04:25:10 pm
Hello people,

Here is a knob button control I've made. Dibo, can you include it in the next version of your package ?

By the way, nice work Lainz.  ::)

Can you make an example project with this control?
Here it is (attached zip).

Quote
Edit: Con you also Add some sort of 2 state button, like the standard ToggleBox (which on Mac OS X is look ugly...)
Do you mean a like TCheckBox ?
Title: Re: BGRAControls
Post by: circular on May 04, 2011, 05:54:55 pm
Here is a flash-like progressbar to be included in BGRAControls.

There is also a sample project.
Title: Re: BGRAControls
Post by: circular on May 04, 2011, 05:55:28 pm
Here is a screenshot
Title: Re: BGRAControls
Post by: Shebuka on May 04, 2011, 06:14:04 pm
Quote
Edit: Con you also Add some sort of 2 state button, like the standard ToggleBox (which on Mac OS X is look ugly...)
Do you mean a like TCheckBox ?

Yes, it's made from TCustomCheckBox but it's look like a Button with 3 state: unchecked, hover, checked.

The standard component TToggleBox has Caption and no Glyph, but it will be great to have different Captions and Glyphs for Unchecked and Checked states.
Title: Re: BGRAControls
Post by: lainz on May 04, 2011, 07:12:09 pm
Realy cool progressbar.  ;D
Title: Re: BGRAControls
Post by: Dibo on May 04, 2011, 10:23:32 pm
New version 1.0.9.0

Changes:
Details:
http://wiki.lazarus.freepascal.org/BGRAControls
Download:
http://sourceforge.net/projects/bgracontrols/files/

Quote from: FabienWang
Do you plan to extend it to other components like TEdit, TMemo, etc. ?
Yes, If I find some time ;)
Quote from: circular
Here on Windows 7 64-bit, I've got some issues of white background. Did you encounter this already ?
Which issues? I have no occasions to test it on windows
Quote from: lainz
For Windows users:

If you use BGRAButton with Windows remember to set Self.DoubleBuffered:=True; OnCreate event of each Form, else the button will flicker if you are running without themes (classic).
TGraphicControl have no DoubleBuffered property, but in future, when transparency problem in TWinControl (GTK) will be fixed then I change ancestor from TGraphicControl to TWinControl (which have DoubleBuffered property)

P.S. I am wondering. Maybe I create some svn/git repository and add write permissions for people which want add some new controls (like circular)
Title: Re: BGRAControls
Post by: circular on May 04, 2011, 11:26:17 pm
Thanks Dibo.

Well about svn repository, it depends. If you feel like you may be absent for some time, I would be able to add a component all the same. By the way, if you want access to LazPaint repository, there is no problem. This way you can also correct something if I am not there.
Title: Re: BGRAControls
Post by: lainz on May 05, 2011, 04:29:13 am
I'm understanding basing me on your code how to create this kind of control  :D

This requires BGRABitmap, it just draw a double gradient and if you enter with mouse it changes their colors (just for testing):

Code: [Select]
unit lazgui;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils,
  LResources, Forms, Controls, Graphics, Dialogs, BGRABitmap;

type

  { Ttest }

  Ttest = class(TGraphicControl)
    private
      tBmp: TBGRABitmap;
      tState: String;
    protected
      procedure Paint; override;
      procedure MouseEnter; override;
      procedure MouseLeave; override;
    public
      constructor Create(AOwner: TComponent); override;
      destructor Destroy; override;
    published
      property OnClick;
      property OnMouseDown;
      property OnMouseEnter;
      property OnMouseLeave;
      property OnMouseMove;
      property OnMouseUp;
  end;

implementation

uses
  BGRABitmapTypes, BGRAGradients;

{ Ttest }

procedure Ttest.Paint;
begin

  if tState = 'normal' then begin
  tBmp:= DoubleGradientAlphaFill(Width,Height,
  BGRABlack,BGRAWhite,BGRAWhite,BGRABlack,
  gdVertical,gdVertical,gdVertical,0.50);
  end

  else if tState = 'enter' then begin
  tBmp:= DoubleGradientAlphaFill(Width,Height,
  BGRAWhite,BGRABlack,BGRABlack,BGRAWhite,
  gdVertical,gdVertical,gdVertical,0.50);
  end;

  tBmp.Draw(Canvas,0,0,False);
end;

procedure Ttest.MouseEnter;
begin
  tState:='enter';
  Invalidate;
  inherited MouseEnter;
end;

procedure Ttest.MouseLeave;
begin
  tState:='normal';
  Invalidate;
  inherited MouseLeave;
end;

constructor Ttest.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  with GetControlClassDefaultSize do
    SetInitialBounds(0,0,CX,CY);
  tBmp:=nil;
  tState:='normal';
end;

destructor Ttest.Destroy;
begin
  FreeAndNil(tBmp);
  inherited Destroy;
end;

end.

You can create this in this way:

Code: [Select]
  private
    { private declarations }
    testctrl: Ttest;
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
begin
  testctrl:= Ttest.Create(Self);
  testctrl.Width:=50;
  testctrl.Height:=50;
  testctrl.Left:=10;
  testctrl.Top:=10;
  testctrl.Parent:=Self;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  testctrl.Free;
end;
Title: Re: BGRAControls
Post by: Dibo on May 05, 2011, 10:27:31 am
Well about svn repository, it depends. If you feel like you may be absent for some time, I would be able to add a component all the same. By the way, if you want access to LazPaint repository, there is no problem. This way you can also correct something if I am not there.
I should always be near but I may don't have time for quick update package. I must consider this yet.
Title: Re: BGRAControls
Post by: codedeep on May 06, 2011, 05:12:58 pm
Hello,

Here's my small contribution to your project.  :D

I published the property Anclors on components:

Tbgrabutton
Tbgraflashprogressbar
Tbgraknob

This feature is very useful to me resizable forms

You can include in your next version: BGRAControls v1.0.9.1  ;)

Bye
Title: Re: BGRAControls
Post by: JanRoza on May 06, 2011, 08:49:04 pm
Your controls look promising so I install bgrabitmap and then wanted to install bgracontrols but all I get on compiling bgracontrols is an error message:
Quote
D:\Compilers\lazarus\components\bgracontrols\bgraimagelist.pas(72,15) Error: There is no method in an ancestor class to be overridden: "TBGRAImageList.Draw(TCanvas,LongInt,LongInt,LongInt,TDrawingStyle,TImageType,TGraphicsDrawEffect);"

I'm using Lazarus 09.30.1 with FPC 2.4.2.
Any idea what's wrong?
Title: Re: BGRAControls
Post by: Dibo on May 06, 2011, 08:57:42 pm
You need latest lazarus 0.9.31 from SVN (revision >= 29834)
Title: Re: BGRAControls
Post by: JanRoza on May 06, 2011, 09:57:11 pm
Okay, I overlooked that fact.
Got it.

Title: Re: BGRAControls
Post by: Emerson Cavalcanti on May 08, 2011, 09:53:51 pm
Hello,

Here's my small contribution to your project. I created a
component-based TBGRABitmap that lets you crop an image.

TImageManipulation is a component designed to make simple changes in an
image while maintaining the aspect ratio of the final image and allow it
to cut to reduce the unnecessary edges. The selected area is painted
with a different transparency level for easy viewing of what will be
cut.

This is the first version, and including a demo.

Download the code
from https://docs.google.com/leaf?id=0B1bnA-yFlcQZOTc3ZDBjNmEtODYxOS00NWU0LWI3OGEtMDI1NjA5NTQ5Nzcw&hl=en&authkey=CN35wYkM.

I'm working on it a little longer to allow image rotation and other
settings. Let me know if you
need to change something or if I need to adjust the component so it can
be included. If you do not understand any part of the operation, I am at
your disposal.
Title: Re: BGRAControls
Post by: lainz on May 09, 2011, 12:20:48 am
Attached you can see BGRAImageButton.

It has 4 states:
* Normal
* Enter
* Pressed
* Disabled

Currently only support BMP files without transparency. But can be easy added using TBGRABitmap instead TBitmap.

To use the example you must add and compile the pas file with BGRAControls.
Title: Re: BGRAControls
Post by: circular on May 09, 2011, 01:08:26 pm
emersoncavalcanti, the links do not work.

anyway it sounds very interesting.

By the way, it would be more consistent to call it TBGRAImageManipulation to go along with other components.
Title: Re: BGRAControls
Post by: Shebuka on May 10, 2011, 11:42:44 am
Hi all,
i'm trying to use BGRAImageList.GetBitmap(Index, BGRAButton.Glyph) to assign Glyph to my button with transparent background and getting some really bad glyph with some sort of color inversion... BGRAImageList is design time loaded with bmp with white color transparency.

on the first screen is what i'm using now, an timage and an speedbutton
on the second screen is a BGRAButton (with solid background, but it's same with transparency...)

what i'm doing wrong?
Title: Re: BGRAControls
Post by: circular on May 10, 2011, 07:59:36 pm
Strange.
Title: Re: BGRAControls
Post by: picstart on May 10, 2011, 11:57:56 pm
Well I set up a spare test PC win Xp for safety and to see if BGRAcontrols would install.
Perhaps I'm overly cautious in heeding the warnings that a snap shot can ruin your system.
There wasn't a Documents and setting references to lazarus folder
 Downloaded and installed the latest snapshot Lazarus-0.9.31-30650-fpc-2.4.2-20110510-win32.exe. The install went fine and it actually ran a "hello world " test. Nice at least 9.31 compiling is working.
Next I selected the package installer and chose to install BGRAbitmap using the lpk
It errors with fcllaz.pas (64,48) Fatal Can't find fcllaz used by Package system
The unit is in c:\lazarus\packager\registration. Is it just me or has anyone got this to work?
Title: Re: BGRAControls
Post by: circular on May 11, 2011, 01:31:42 am
Hi all,
i'm trying to use BGRAImageList.GetBitmap(Index, BGRAButton.Glyph) to assign Glyph to my button with transparent background and getting some really bad glyph with some sort of color inversion... BGRAImageList is design time loaded with bmp with white color transparency.

on the first screen is what i'm using now, an timage and an speedbutton
on the second screen is a BGRAButton (with solid background, but it's same with transparency...)

what i'm doing wrong?
I don't see what you can do wrong here. There seem to be a problem with bitmap format. What version of Lazarus are you using and on which system ? Can you post a small project that shows the problem so someone can try to debug and see what happens ?

picstart, I cannot tell you because I am using CodeTyphon.
Title: Re: BGRAControls
Post by: picstart on May 11, 2011, 02:14:46 am
I think there are issues here. If I install BGRAbitmap.lpk via the package tab to
a freshly installed snapshot Lazarus-0.9.31-30650-fpc-2.4.2-20110510-win32.exe
it installs with the warning "do you like fat" but it installs nevertheless. However lazarus 9.31 now errors with a heap dump  true free heap 2732608 should be 2621184 this is before an install of BGRAcontrols.lpk. The dump occurs after the rebuild and upon exit from lazarus. Since 9.31 without BGRAbitmap.lpk ( latest version from 3.9 lazpaint) installed or BGRAcontrols.lpk runs hello world the issue is probably with these packages. Bgracontrols has a dependency on 9.31 and a recent build per the wiki. Perhaps there are interdependencies between  controls and bitmap and maybe Codetyphon. System is winXP home edition SP2.
Title: Re: BGRAControls
Post by: circular on May 11, 2011, 01:05:55 pm
Well, honestly I don't understand what is going on. Maybe we could add a conditional compiler directive in BGRAImageList so that it does not redeclare the Draw function if it is 0.9.30. This way, you could use it with a stable version of Lazarus. the BGRAImageList would behave just like the standard ImageList in this case. I don't remember the compiler directive to check FPC version.
Title: Re: BGRAControls
Post by: fabienwang on May 11, 2011, 01:12:30 pm
I don't remember the compiler directive to check FPC version.

There are predefined macros:
FPC_VERSION and FPC_FULLVERSION.

Here is an example:

Code: Pascal  [Select][+][-]
  1.   {$ifdef ver2}
  2.      // all versions 2.x
  3.   {$endif}
  4.   {$ifdef ver2_2}
  5.     // all versions 2.2
  6.   {$endif}
  7.    //etc.  
  8.  
  9.    // or (delphi/FPC2+ style):
  10.   {$if (fpc_version=2) and (fpc_release>4) or ((fpc_release=4) and (fpc_patch>1))}  
  11.     {$info At least this is version 2.4.2}  
  12.   {$else}  
  13.     {$fatal Problem with version check}  
  14.   {$endif}
Title: Re: BGRAControls
Post by: picstart on May 11, 2011, 05:09:36 pm
Small issue with panel. The gradient works just fine up to the bevel. The bevel color is the default button color ( gray) ..this makes the beveled panel look bad , Is there a way to have bevel color and the panel color consistent?
Title: Re: BGRAControls
Post by: Shebuka on May 11, 2011, 07:14:30 pm
Hi all,
i'm trying to use BGRAImageList.GetBitmap(Index, BGRAButton.Glyph) to assign Glyph to my button with transparent background and getting some really bad glyph with some sort of color inversion... BGRAImageList is design time loaded with bmp with white color transparency.

on the first screen is what i'm using now, an timage and an speedbutton
on the second screen is a BGRAButton (with solid background, but it's same with transparency...)

what i'm doing wrong?
I don't see what you can do wrong here. There seem to be a problem with bitmap format. What version of Lazarus are you using and on which system ? Can you post a small project that shows the problem so someone can try to debug and see what happens ?

picstart, I cannot tell you because I am using CodeTyphon.
I'm under Mac OS X 10.6.7 with last snapshot (svn rev. 30406) fpc 2.4.2 and last components/bgra

simple example project attached
Title: Re: BGRAControls
Post by: Dibo on May 11, 2011, 09:11:00 pm
@Up: I have never tested this controls on Mac (have no Mac). So I don't know how to help you :-\

P.S. Sorry for my absence. I am busy now :/ . I will check components which you attached here as soon as possible and I'll add them to package.
Title: Re: BGRAControls
Post by: picstart on May 11, 2011, 11:43:34 pm
The issues I was having with 9.31 such as heap errors are resolved if I stay with the stable version lazarus 9.30 and eliminate BGRAImagelist ( it has dependencies on 9.31) from the BGRAcontrols package. BGRAcontrols has a dependency with BGRAbitmap but BGRAbitmap is compatible with 9.30 only BGRAImagelist needs 9.31
Title: Re: BGRAControls
Post by: circular on May 12, 2011, 04:55:36 am
@Shebuka:

I don't have a mac, so I can't do it myself. But I've looked at the bitmap data in your project, and it seems to be 24-bit, so there is no problem here.

Anyway, is there any alpha problem on Mac platform ? If image with semi-transparent pixels are rendered correctly on Mac, then there is no need to override it. So it could be simply deactivated in this case.

I noticed that Dibo has written some conditional directives in BGRAImageList unit. Before that, we could add :
{$DEFINE GTK_ONLY}
to active them.

Nevertheless, there is room for improvement in BGRABitmap. I suppose that at run time, the way pixel data is stored in the image list is not handled by BGRABitmap. With a debugger, I would check what happens in LoadFromRawImage (and in Assign function).

@picstart & Dibo

There are also small problems on Windows, so making it available for GTK2 only seems to be simpler choice. And this would maybe save some headache about version checking. Otherwise, it would be necessary to check fpc version with a compiler directive. Thanks to FabienWang, we have some examples. I suppose for this case, the compiler directive would be something like :

{$if (fpc_version >= SOME_NUMBER)} ... {$endif}
where SOME_NUMBER would be the needed version of FPC.

or

{$if (fpc_fullversion >= SOME_NUMBER)} ... {$endif}
SOME_NUMBER would be the needed full version of FPC.

@picstart

About Panels you are right they would look prettier with bevels of the same color. It is possible to do it. In BGRAPanel, the Paint method calls the inherited paint method. This can be avoided by adding custom code for drawing the bevel.

I've modified TBGRACanvas to accept light and shadow parameters on subversion. Here is an updated version of TBGRAPanel :
Title: Re: BGRAControls
Post by: Shebuka on May 12, 2011, 09:39:43 am
@Shebuka:

I don't have a mac, so I can't do it myself. But I've looked at the bitmap data in your project, and it seems to be 24-bit, so there is no problem here.

Anyway, is there any alpha problem on Mac platform ? If image with semi-transparent pixels are rendered correctly on Mac, then there is no need to override it. So it could be simply deactivated in this case.

I noticed that Dibo has written some conditional directives in BGRAImageList unit. Before that, we could add :
{$DEFINE GTK_ONLY}
to active them.

Nevertheless, there is room for improvement in BGRABitmap. I suppose that at run time, the way pixel data is stored in the image list is not handled by BGRABitmap. With a debugger, I would check what happens in LoadFromRawImage (and in Assign function).
Hi, I'm trying with png images now at it hase same strange behavior...

But with normal TImageList and direct loading with LoadFromFile into TButton/TImage it works perfect (bmp and jpg).
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on May 13, 2011, 05:14:39 am
Here the component file with the now modified to TBGRAImageManipulation

Thanks


emersoncavalcanti, the links do not work.

anyway it sounds very interesting.

By the way, it would be more consistent to call it TBGRAImageManipulation to go along with other components.
Title: Re: BGRAControls
Post by: circular on May 13, 2011, 10:55:06 am
Thanks. It is a good idea.

In my opinion, the ratio constraint should be toggled by some key. As a user, I would not expect this constraint to be on by default, because ratio makes sense essentially for resampling. For cropping, there is no reason to have a part of the same ratio. But this is not so important if it can be deactivated with a key.

I noticed 2 errors.

Line 99 of UnitBGRAImageManipulationDemo. First is in the file filter string, there should be something like "|*.jpg" at the end.

Line 844, 1055 and 1092 of BGRAImageManipulation. The resample function creates a new bitmap that is not automatically freed. So there is a memory leak. You can solve this by declaring a temporary variable that you free afterwards.

I don't understand why you added a call to FreeImage at lines 687 and 691. The TBGRABitmap object creates a bitmap handle only if necessary (the property Bitmap may create a bitmap if there is none). And if a DIB section is possible, there is a handle associated to the memory used to store data, so it should not be freed anyway. Apparently, it does nothing here. But I think it is useless and may cause an error on some platforms.

Finally, I suggest to add Anchor and Align properties because there are very likely to be used with your component.
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on May 13, 2011, 05:02:10 pm
Thanks. It is a good idea.

In my opinion, the ratio constraint should be toggled by some key. As a user, I would not expect this constraint to be on by default, because ratio makes sense essentially for resampling. For cropping, there is no reason to have a part of the same ratio. But this is not so important if it can be deactivated with a key.

I noticed 2 errors.

Line 99 of UnitBGRAImageManipulationDemo. First is in the file filter string, there should be something like "|*.jpg" at the end.

Line 844, 1055 and 1092 of BGRAImageManipulation. The resample function creates a new bitmap that is not automatically freed. So there is a memory leak. You can solve this by declaring a temporary variable that you free afterwards.

I don't understand why you added a call to FreeImage at lines 687 and 691. The TBGRABitmap object creates a bitmap handle only if necessary (the property Bitmap may create a bitmap if there is none). And if a DIB section is possible, there is a handle associated to the memory used to store data, so it should not be freed anyway. Apparently, it does nothing here. But I think it is useless and may cause an error on some platforms.

Finally, I suggest to add Anchor and Align properties because there are very likely to be used with your component.


Thanks for the comments. I'll make the necessary changes for
implement the suggestions. I'm analyzing the errors, because in my computer
I couldn't reproduce.
Title: Re: BGRAControls
Post by: circular on May 13, 2011, 09:55:09 pm
You're welcome.

These are not fatal errors.  8-)
Title: Re: BGRAControls
Post by: Dibo on May 14, 2011, 01:25:23 pm
New version 1.0.9.5

Changes:
Details:http://wiki.lazarus.freepascal.org/BGRAControls
Download:http://sourceforge.net/projects/bgracontrols/files/

@Lainz, @emersoncavalcanti: Could you add some short description (screen, info what it do etc) about your component on BGRAControls wiki page? I created section for this components, just re-edit. If someone don't have wiki account, post description here and I will add it. Thanks

@circular: I saw somewhere that you add light colors functionality to bgrabitmap but can find source of this info now. How can I use it?
Title: Re: BGRAControls
Post by: circular on May 14, 2011, 02:27:16 pm
@circular: I saw somewhere that you add light colors functionality to bgrabitmap but can find source of this info now. How can I use it?
It is here : http://www.lazarus.freepascal.org/index.php/topic,13025.msg68027.html#msg68027

It uses BGRAFillInfo which is a new unit I added recently. If it's not in the last zip file, it is on subversion.
Title: Re: BGRAControls
Post by: lainz on May 14, 2011, 11:48:23 pm
@Lainz, @emersoncavalcanti: Could you add some short description (screen, info what it do etc) about your component on BGRAControls wiki page? I created section for this components, just re-edit. If someone don't have wiki account, post description here and I will add it. Thanks

Done

http://wiki.lazarus.freepascal.org/BGRAControls#TBGRAImageButton
Title: Re: BGRAControls
Post by: Dibo on May 14, 2011, 11:50:13 pm
Thanks :)
Title: Re: BGRAControls
Post by: lainz on May 15, 2011, 05:12:44 am
Thanks :)

I did some improvements, but you must ensure that works in GTK, only tested in Win32.

* Now has alpha support with BGRABitmap.
* BitmapHeight property is no longer neccesary.

Attached;
bgraimagebutton15_05_2011.zip >> the new version of the control.
eyes.png >> to test button with Alpha.
Title: Re: BGRAControls
Post by: lainz on May 16, 2011, 04:27:24 pm
it's getting popular  ::)

http://idkn.wordpress.com/2011/05/04/beautiful-ui-in-linux/

Edit: in the way of criticism
Title: Re: BGRAControls
Post by: circular on May 19, 2011, 12:33:45 pm
Here is a virtual screen component. The principle is to draw on a memory bitmap.

The component has a specific event, OnRedraw, which is called when the whole bitmap needs to be redrawn. It happends at the beggining, when resizing and when the Redraw method is called.

Otherwise, it is possible to modify the Bitmap property and call Invalidate or Repaint, to avoid erasing the whole bitmap content.

The zip contains a very simple sample project.
Title: Re: BGRAControls
Post by: Dibo on May 19, 2011, 10:40:39 pm
New version 1.0.9.7
Changes:
Details: http://wiki.lazarus.freepascal.org/BGRAControls
Download: http://sourceforge.net/projects/bgracontrols/files/

Regards
Title: Re: BGRAControls
Post by: circular on May 20, 2011, 12:18:18 am
Thanks !  ::)
Title: Re: BGRAControls
Post by: lainz on May 20, 2011, 12:58:12 am
New version 1.0.9.7
Changes:
  • Resignation from optional -dGTK_ONLY switch. Package use now OS defines for TBGRAImageList and TBGRASpeedButton so package can be installed on stable Lazarus 0.9.30 for windows. You still need Lazarus from SVN if you want install this package on Lazarus for Linux GTK
  • New component TBGRAVirtualScreen created by circular
Details: http://wiki.lazarus.freepascal.org/BGRAControls
Download: http://sourceforge.net/projects/bgracontrols/files/

Regards

Nice. :D

You have tested bgrabutton with alpha in GTK?
http://lazarus.freepascal.org/index.php/topic,12411.msg68422.html#msg68422

Title: Re: BGRAControls
Post by: Dibo on May 20, 2011, 09:02:13 am
Ouch. Sorry, I missed your post.

New version 1.0.9.8
Changes:
Details: http://wiki.lazarus.freepascal.org/BGRAControls
Download: https://sourceforge.net/projects/bgracontrols/files/
Title: Re: BGRAControls
Post by: picstart on May 20, 2011, 02:24:30 pm
Great work
These components work with win7 Pro 32bit Lazarus 9.30 without needing any modification to the lpk's to workaround 9.31 dependencies. The controls are a very nice enhancement for
Lazarus.

Thank you all
Title: Re: BGRAControls
Post by: lainz on May 20, 2011, 05:48:48 pm
Ouch. Sorry, I missed your post.

New version 1.0.9.8
Changes:
  • TBGRAImageButton - Now has alpha support with BGRABitmap
  • TBGRAImageButton - BitmapHeight property is no longer neccesary
Details: http://wiki.lazarus.freepascal.org/BGRAControls
Download: https://sourceforge.net/projects/bgracontrols/files/

Thanks  :D

You also must update the example (attached).
*added button with alpha in the example
*ButtonHeight deleted and not used anymore
Title: Re: BGRAControls
Post by: fabienwang on May 20, 2011, 06:05:28 pm
Thanks Dibo and lainz, it's already very good! keep up the excellent work
Title: Re: BGRAControls
Post by: fabienwang on May 21, 2011, 10:04:22 pm
Hey Dibo, i have a suggestion to improve TBGRAButton:
Add a BodyDisabled TBody property, so we can put a custom gradient
when the button is disabled.
Title: Re: BGRAControls
Post by: picstart on May 21, 2011, 10:55:17 pm
BGRAButton  has a fixed Font for the Caption. The Standard button allows a choice of Font.

Maybe BGRAButton requires any special font to go into the Glyph?
Title: Re: BGRAControls
Post by: fabienwang on May 21, 2011, 11:08:30 pm
BGRAButton  has a fixed Font for the Caption. The Standard button allows a choice of Font.

Maybe BGRAButton requires any special font to go into the Glyph?
Look in the BodyNormal, BodyHover, and BodyClicked properties.
You can define here the font, the gradients, etc.
Title: Re: BGRAControls
Post by: Dibo on May 22, 2011, 12:01:56 am
Hey Dibo, i have a suggestion to improve TBGRAButton:
Add a BodyDisabled TBody property, so we can put a custom gradient
when the button is disabled.
Ok
BGRAButton  has a fixed Font for the Caption. The Standard button allows a choice of Font.

Maybe BGRAButton requires any special font to go into the Glyph?
Look in the BodyNormal, BodyHover, and BodyClicked properties.
You can define here the font, the gradients, etc.
Exactly. I remind that this package have demo of TBGRAButton :)
Title: Re: BGRAControls
Post by: circular on May 22, 2011, 12:08:14 am
Dibo, I don't know if you forgot, but the panel with colored lighting is on page 6 of the topic.
Title: Re: BGRAControls
Post by: Dibo on May 22, 2011, 12:18:32 am
Ahh, I forgot. I will add it in next update. Thanks.
Title: Re: BGRAControls
Post by: picstart on May 22, 2011, 10:50:05 am
Well, you can select a font for BGRAButton  using Hover Click and Normal and yes the Normal will show the Font chosen at design time. However after compile and run the Font goes to some fixed default font ( not the font the IDE shows ) Lazarus 9.30 win7 pro 32 bit.
Title: Re: BGRAControls
Post by: fabienwang on May 22, 2011, 11:51:12 am
Well, you can select a font for BGRAButton  using Hover Click and Normal and yes the Normal will show the Font chosen at design time. However after compile and run the Font goes to some fixed default font ( not the font the IDE shows ) Lazarus 9.30 win7 pro 32 bit.

weird, i have the same lazarus version 0.9.30 and win 7 ultimate 32bits, for me it's working great.
Do you have the latest version bgracontrols-1.0.9.8.zip ?
if not you can get it from: http://sourceforge.net/projects/bgracontrols/files/
Title: Re: BGRAControls
Post by: picstart on May 22, 2011, 06:48:35 pm
The installed package tab 9.30 IDE install/uninstall packages shows BGRAbitmappack 3.9
and BGRAcontrols 1.0.9 not 1.0.9.8. I'm never sure what is compatible with what anymore.
The font I chose was Arial bold narrow it shows on the IDE form but is replaced with a default in the running program.
Title: Re: BGRAControls
Post by: fabienwang on May 25, 2011, 11:56:27 am
Hello Dibo.

I have used BGRAControls in a project, but the body states BodyHover, Normal and Clicked are not saved. It's like the Colors are not considered as Changed and the project doesn't show the Save buton. I fixed it by setting up the colors at runtime on the FormCreate event. Have you experienced this bug?

My setup is:
  Lazarus 0.9.30 r29749 FPC 2.4.2 i386-win32-win32/win64
  bgrabitmap 3.9 (from svn)
  BGRAControls 1.0.9.8
Title: Re: BGRAControls
Post by: Dibo on May 25, 2011, 12:34:30 pm
I will look at this. Thanks for report.
Title: Re: BGRAControls
Post by: picstart on May 25, 2011, 10:27:17 pm
Lazarus 0.9.30 r29749 FPC 2.4.2 i386-win32-win32/win64
  bgrabitmap 3.9 (from svn)
  BGRAControls 1.0.9.8
For the button control very little seems to stick when designed in the IDE. Shape size border  X Y  and position will stick thru to run time but Font Color etc don't .. they default to main form values..
Title: Re: BGRAControls
Post by: picstart on May 30, 2011, 07:13:45 pm
bgraimagebutton doesn't have a corresponding bgraimagebutton_icon.lrs
all the other items in bgracontol have corresponding *.lrs files. The registration section in bgraimagebutton.pas has the binding to bgraimagebutton_icon.lrs commented out to avoid package installation issues with the missing lrs file. Without the bgraimagebutton icon in the palette it can't be used like the other components
Title: Re: BGRAControls
Post by: lainz on May 31, 2011, 01:03:22 am
bgraimagebutton doesn't have a corresponding bgraimagebutton_icon.lrs
all the other items in bgracontol have corresponding *.lrs files. The registration section in bgraimagebutton.pas has the binding to bgraimagebutton_icon.lrs commented out to avoid package installation issues with the missing lrs file. Without the bgraimagebutton icon in the palette it can't be used like the other components

Yes I know. But I can use it because Lazarus add some default icon.

If you can do an icon, i wasn't creative when I created the BGRAImageButton  :-[
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on May 31, 2011, 03:06:36 am
Hello

Sorry for the delay but was showing a fair and could not answer before. This is the text you'd like to place on the wiki:

Component to facilitate the importation of images in an application. This initial version enables cropping an image maintaining the aspect ratio. Future will be implemented as tools to adjust brightness or contrast, or rotate the image, all in the component.


New version 1.0.9.5

Changes:
  • Published property Anchors in TBGRAButton, TBGRAKnob and TBGRAFlashProgressBar (thanks codedeep)
  • New component TBGRAImageManipulation created by Emerson Cavalcanti
  • New component TBGRAImageButton created by Lainz
  • Created git repository for this package
Details:http://wiki.lazarus.freepascal.org/BGRAControls
Download:http://sourceforge.net/projects/bgracontrols/files/

@Lainz, @emersoncavalcanti: Could you add some short description (screen, info what it do etc) about your component on BGRAControls wiki page? I created section for this components, just re-edit. If someone don't have wiki account, post description here and I will add it. Thanks

@circular: I saw somewhere that you add light colors functionality to bgrabitmap but can find source of this info now. How can I use it?

Title: Re: BGRAControls
Post by: lainz on May 31, 2011, 03:22:25 am
Hello

Sorry for the delay but was showing a fair and could not answer before. This is the text you'd like to place on the wiki:

Component to facilitate the importation of images in an application. This initial version enables cropping an image maintaining the aspect ratio. Future will be implemented as tools to adjust brightness or contrast, or rotate the image, all in the component.

Added thanks.
Title: Re: BGRAControls
Post by: picstart on May 31, 2011, 04:57:18 pm
Lainz
Here is a lrs for bgraimagebutton
Title: Re: BGRAControls
Post by: lainz on May 31, 2011, 07:36:29 pm
Lainz
Here is a lrs for bgraimagebutton

Thanks I think Dibo will add this for the next release
Title: Re: BGRAControls
Post by: CaptBill on June 01, 2011, 03:09:39 am
Hi fellas,

Can you see what I am doing wrong here?
I need to paint a simple color box on a TBGRASpeedbutton but my round function is giving a value of 'double'.

Where am I going wrong here?

Is there maybe a simpler (faster) method to do this?

Quote
function tdbbutton.HSLAPaint(xval,basenum:double;w,h:integer):tbgrabitmap;
 var
    p: PBGRAPixel;
    image: TBGRABitmap;
    hsla: THSLAPixel;
    iw,ih:integer;
    
 begin
    image := TBGRABitmap.Create(w,h);
    hsla.lightness := 32768;
    hsla.alpha := 65535;
    hsla.saturation := 65536 ;

    for ih := 0 to h-1 do
    begin
    p := image.Scanline[ih];

    for iw := 0 to image.Width-1 do
     begin
      hsla.hue := round((w*65536) div basenum); //fails here 'got double...want longint'
      p^:= HSLAToBGRA(hsla);
      inc(p);
     end;
    end;
    result:=image;
    image.free;
   end;

Thanks
Title: Re: BGRAControls
Post by: circular on June 01, 2011, 06:48:30 pm
"div" is for integer division. Use "/" instead.

By the way, I suppose it's iw instead of w.
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on June 01, 2011, 09:32:13 pm
Hello

Answering your settings:

1. Memory Leak

fResampledBitmap is not a temporary bitmap. In other cases, the problem is resolved. fResampledBitmap store the image in size necessary to display on component, minimizing unnecessary 'resamples' every time you need to redraw.

2. Aspect Ratio

I'm working on modifications to the component can work with both cases where you need to keep the aspect ratio as in cases where it is unnecessary. The aspect ratio is not in relation to the size of the image, but over the edge of the component. This is necessary when you need to put the picture on a form (eg a photo on an identification card) and want that it does not appear distorted. Scales is the component so that it has the ideal size (eg 3 x 4). Any photo on it loaded, even if smaller in height or width, will allow the cutting of only a portion of the image that keeps the same ratio as the component.

I think it would be interesting to improve the text on the Wiki Lazarus so that the user use the component can understand this behavior. What do you think?

Please verify that the changes made ​​are working correctly for cases where there is no need to keep the aspect ratio. See the component limits the minimum size as specified in the properties  MinHeight and MinWidth.

3. Unnecessary release of the Bitmap.

I agree with you. Fixed.

4. Anchor and Align

Implemented.

5. Other resources

Fixed aspect ratio when the image has a dimension smaller than the size of the component.

See changelog on header of component.


Regards

Emerson

Thanks. It is a good idea.

In my opinion, the ratio constraint should be toggled by some key. As a user, I would not expect this constraint to be on by default, because ratio makes sense essentially for resampling. For cropping, there is no reason to have a part of the same ratio. But this is not so important if it can be deactivated with a key.

I noticed 2 errors.

Line 99 of UnitBGRAImageManipulationDemo. First is in the file filter string, there should be something like "|*.jpg" at the end.

Line 844, 1055 and 1092 of BGRAImageManipulation. The resample function creates a new bitmap that is not automatically freed. So there is a memory leak. You can solve this by declaring a temporary variable that you free afterwards.

I don't understand why you added a call to FreeImage at lines 687 and 691. The TBGRABitmap object creates a bitmap handle only if necessary (the property Bitmap may create a bitmap if there is none). And if a DIB section is possible, there is a handle associated to the memory used to store data, so it should not be freed anyway. Apparently, it does nothing here. But I think it is useless and may cause an error on some platforms.

Finally, I suggest to add Anchor and Align properties because there are very likely to be used with your component.


Thanks for the comments. I'll make the necessary changes for
implement the suggestions. I'm analyzing the errors, because in my computer
I couldn't reproduce.
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on June 02, 2011, 12:47:17 am
Hi Dibbo

Please, replace the demo directory of TBGRAImageManipulation with the contents of file attachment. I made some modifications to allow evidence of the recent changes in component.

Exclude the subdirectories Art and Demo and put only the content of file.

Replace the image of component on wiki.

Thanks

Emerson
Title: Re: BGRAControls
Post by: circular on June 02, 2011, 11:43:56 pm
@emersoncavalcanti:

Thanks for the update. I'm too tired to check everything. I suppose everything is ok except about memory leak.

1. Memory Leak

fResampledBitmap is not a temporary bitmap. In other cases, the problem is resolved. fResampledBitmap store the image in size necessary to display on component, minimizing unnecessary 'resamples' every time you need to redraw.
That's not what I was talking about. The leak comes with "fImageBitmap.Resample" which creates a bitmap object, that is not freed. PutImage just copies the content, it does not call "Free". In fact, you could simply assign the object created by the Resample procedure.
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on June 03, 2011, 02:09:56 am
Hi Circular

Sorry. Now I understand what you meant. I will correct and make new post.

I could not update the image demonstration on Wiki. Can you explain how to do it?

I am grateful for your comments.

Let me make a suggestion for everyone to adopt the changelog in their respective components BGRAControls and enter comments about the operation in the source code.

Thanks

Emerson
@emersoncavalcanti:

Thanks for the update. I'm too tired to check everything. I suppose everything is ok except about memory leak.

1. Memory Leak

fResampledBitmap is not a temporary bitmap. In other cases, the problem is resolved. fResampledBitmap store the image in size necessary to display on component, minimizing unnecessary 'resamples' every time you need to redraw.
That's not what I was talking about. The leak comes with "fImageBitmap.Resample" which creates a bitmap object, that is not freed. PutImage just copies the content, it does not call "Free". In fact, you could simply assign the object created by the Resample procedure.
Title: Re: BGRAControls
Post by: lainz on June 03, 2011, 03:06:26 am
I could not update the image demonstration on Wiki. Can you explain how to do it?

I think you must wait to the new version update before.Then change the image in the wiki.

Is realy easy, just clic the image and clic on "Upload a new version of this file".
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on June 04, 2011, 02:12:13 am
Hi Circular

Following new version of the component TBGRAImageManipulation. Modifications performed:

Thanks

Emerson
Title: Re: BGRAControls
Post by: circular on June 04, 2011, 05:58:37 pm
Thanks.

I've tried it, it works fine without aspect ratio and it's faster.

But I've encoutered a divide by zero on line 747 of BGRAImageManipulation.pas, which can be replaced by
Code: [Select]
  // Calculate aspect ratio
  if (imageHeight <> 0) then
    XYAspect := imageWidth / imageHeight
  else
    XYAspect := 1;   
Title: Re: BGRAControls
Post by: Dibo on June 05, 2011, 11:51:45 am
New version 1.0.9.9
Changes:
Download: https://sourceforge.net/projects/bgracontrols/files/
Details: http://wiki.lazarus.freepascal.org/BGRAControls

Hello Dibo.

I have used BGRAControls in a project, but the body states BodyHover, Normal and Clicked are not saved. It's like the Colors are not considered as Changed and the project doesn't show the Save buton. I fixed it by setting up the colors at runtime on the FormCreate event. Have you experienced this bug?

My setup is:
  Lazarus 0.9.30 r29749 FPC 2.4.2 i386-win32-win32/win64
  bgrabitmap 3.9 (from svn)
  BGRAControls 1.0.9.8
I can't confirm this bug. I drop BGRAButton on form at design time, change some propertys (color, etc), save project and reopen this project and all propertys are loaded properly. Can you attach some demo for this?

Regards.
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on June 07, 2011, 12:08:35 am
Hi

I did the translation of the Wiki for the Portuguese language in order to facilitate understanding to all users who speak little English.

Regards.
Title: Re: BGRAControls
Post by: Dibo on June 07, 2011, 12:55:14 am
Thanks :) Good idea. Maybe I try translate to my native language too (Polish)
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on June 07, 2011, 02:29:28 am
My mother is descended from Polish. I say nothing, but I believe she still remember a little of the language. They (my grandparents) came at the end of second War to Brazil.

Thanks :) Good idea. Maybe I try translate to my native language too (Polish)
Title: Re: BGRAControls
Post by: circular on June 20, 2011, 06:08:51 pm
Hello people,

I found on the net components using BGRABitmap :

http://ue.accesus.com/uecontrols
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on June 22, 2011, 12:18:30 am
I'm posting the new release of TBGRAImageManipulation. Changes since last version:

            - Improved function of aspect ratio including a variable to
               provide the value directly in the component, instead of using
               the dimensions of the component as the source of this value.
             - Improved exhibition of anchors on selection.
             - Improved mouse cursor.
             - Included function to get the aspect ratio from image size.
             - Included rotate Left and Right functions.
             - Fixed divide by zero when calculate aspect ratio on
               getImageRect (Thank's Circular).

Update demo:
             - Relayout of form for expand component on resize.
             - Add control to rotate image.
Title: Re: BGRAControls
Post by: lainz on June 23, 2011, 09:02:30 pm
Dibo you could update BGRAControls?

Or give access to some of the developers, such as circular, understands more of bgra than any of us = D
Title: Re: BGRAControls
Post by: circular on June 24, 2011, 01:07:56 am
Lainz I think that you can well take care of updating BGRAControls.  8)
Title: Re: BGRAControls
Post by: lainz on June 24, 2011, 01:29:17 am
 :) Thanks
Title: Re: BGRAControls
Post by: Dibo on June 24, 2011, 02:08:06 am
Some time ago I mentioned about this. If some one of contributors is interesteted, Is no problem to add some privileges :) . I can add permissions to git repository, I also look at source forge permissions functionality (for adding official release). But not today, I just back from festival in my country ;)

P.S. Sorry for my delay in updating this package. I am not expert in graphics, I just wanted publish source of components created for one of my projects. I did not expect such interest (and so many contributors) :) . You are creating very impressing controls. You could create your own BGRA Controls as independent packages, but I thinks that is good idea to keep them all together in one "BGRA Controls" package (like JEDI, RX, etc.), so I'm open to share with this package. So if some one is interested, please contact with me, but as I said, not today :-[
Title: Re: BGRAControls
Post by: circular on June 24, 2011, 11:59:01 am
@Dibo:

I suggest that you create an svn repository and give lainz full access (svn+online folder).
Title: Re: BGRAControls
Post by: fabienwang on June 24, 2011, 12:11:21 pm
git is good. why svn?
Dibo, i want full access too :D
Title: Re: BGRAControls
Post by: circular on June 24, 2011, 01:52:31 pm
Ah ok git is anhoter version control system. Yes, git ou svn, why not. Well, I already have TortoiseSvn installed, that's why I was talking about svn. Is there a similar program on Windows for git ?
Title: Re: BGRAControls
Post by: Dibo on June 24, 2011, 02:48:08 pm
There is TortoiseGit for windows
Title: Re: BGRAControls
Post by: circular on June 24, 2011, 04:43:47 pm
Ok, thanks.
Title: Re: BGRAControls
Post by: lainz on June 25, 2011, 03:57:41 pm
Thanks Dibo  :D

I've updated git repository:
* Updated BGRAImageManipulation
* Updated Demo of BGRAImageManipulation
Title: Re: BGRAControls
Post by: Dibo on June 25, 2011, 07:06:17 pm
@lainz: Have you access to files in source forge too?

@circular: I added you too
Title: Re: BGRAControls
Post by: circular on June 25, 2011, 07:22:05 pm
Thanks.
Title: Re: BGRAControls
Post by: lainz on June 25, 2011, 07:27:32 pm
@lainz: Have you access to files in source forge too?

@circular: I added you too

I don't know. How I can acces the files?
Title: Re: BGRAControls
Post by: Dibo on June 25, 2011, 08:09:11 pm
Have you something like "add file", "add folder" on this page?
https://sourceforge.net/projects/bgracontrols/files/
Title: Re: BGRAControls
Post by: lainz on June 25, 2011, 08:19:47 pm
Have you something like "add file", "add folder" on this page?
https://sourceforge.net/projects/bgracontrols/files/

Nothing.
Title: Re: BGRAControls
Post by: Dibo on June 25, 2011, 08:26:26 pm
And now?
Title: Re: BGRAControls
Post by: lainz on June 25, 2011, 09:16:10 pm
And now?

Now I see both Add file | Add folder.
Title: Re: BGRAControls
Post by: Dibo on June 25, 2011, 09:40:46 pm
Ok, so if you want, you can publish official releases (for users that don't want use git)
Tip: To make sure that I publish only source (without binaries etc. in my local folder) I always commit changes and then go to:
http://bgracontrols.git.sourceforge.net/git/gitweb.cgi?p=bgracontrols/bgracontrols;a=summary
... and download .gz archive by clicking on "snapshot" on master branch. Then I convert this source to zip and then publish in https://sourceforge.net/projects/bgracontrols/files/ by clicking "add file".

Thanks again for help.

Edit: I added some details about members in wiki page (in english version)
Title: Re: BGRAControls
Post by: lainz on June 25, 2011, 10:26:50 pm
Ok, so if you want, you can publish official releases (for users that don't want use git)
Tip: To make sure that I publish only source (without binaries etc. in my local folder) I always commit changes and then go to:
http://bgracontrols.git.sourceforge.net/git/gitweb.cgi?p=bgracontrols/bgracontrols;a=summary
... and download .gz archive by clicking on "snapshot" on master branch. Then I convert this source to zip and then publish in https://sourceforge.net/projects/bgracontrols/files/ by clicking "add file".

Thanks again for help.

Edit: I added some details about members in wiki page (in english version)

ok I was wondering how to do  ;)

Updated BGRAControls 1.0.9.10
* Updated BGRAImageManipulation
* Updated Demo of BGRAImageManipulation
* Updated BGRAImageButton: simplified paint code
Title: Re: BGRAControls
Post by: Dibo on June 25, 2011, 10:56:20 pm
Thanks :)
Title: Re: BGRAControls
Post by: lainz on July 01, 2011, 04:33:35 pm
* Updated BGRAButton by circular (added Light Effect - lightWidth and lightOpacity).
* Added testbgracontrols.

It has (for now) only one test 'Like Flash Player Setup' (in progress). But more will be added.
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on July 01, 2011, 09:58:50 pm
You updated the package on SourceForge?
Title: Re: BGRAControls
Post by: lainz on July 02, 2011, 12:45:50 am
You updated the package on SourceForge?

Yes. Also I've updated today the git repository.

If you want acces send a message to Dibo.
Title: Re: BGRAControls
Post by: lainz on July 02, 2011, 04:19:59 am
* Updated testbgracontrols with new things.

Download demo (win32 exe)
http://www.mediafire.com/?1rls1gj6lji06m3

* Source can be downloaded with bgracontrols in git repository.

This time try a little program that has basic styles for buttons:
* Flash Player
* Windows 7 ToolBar
* Windows 7
* Office 2010
* Mac OSX Lion

Image:
http://i49.servimg.com/u/f49/13/69/10/84/testbg10.png

Besides two small examples:
* Flash Player Setup (tries to mimic the flash player setup)
* Windows 7 ToolBar (in this case only can be aligned up, down, left and right).
Title: Re: BGRAControls
Post by: circular on July 02, 2011, 12:53:12 pm
That's good looking.  :)
Title: Re: BGRAControls
Post by: Dibo on July 02, 2011, 01:18:12 pm
Amazing. Thanks :)
Title: Re: BGRAControls
Post by: Dibo on July 02, 2011, 03:31:24 pm
BGRA Bitmap has more and more interesting graphic functions. We could try in future create some simple interface which will use BGRA Bitmaps only. Similar to fpGUI or QT but with less functionality and with this same idea - interface which looks same on all systems and is independent from GTK,QT,win32 librarys. We have already panels and buttons, it's time for listviews and some mechanism for templates/schema :P
Title: Re: BGRAControls
Post by: circular on July 02, 2011, 06:09:29 pm
Well that's not so easy because BGRABitmap is based on LCL. Anyway this would be a lot of work.
Title: Re: BGRAControls
Post by: Dibo on July 02, 2011, 11:49:50 pm
Argh, right, this could be a problem :)
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on July 03, 2011, 05:08:08 am
I'm working on a new component: TBGRATrackBar, that will complement the existing.
Title: Re: BGRAControls
Post by: circular on July 03, 2011, 11:00:15 am
Will it be like the TTrackBar component ?

If you need phong shading, feel free to ask what you need.
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on July 03, 2011, 12:32:39 pm
I needed a slider. I decided to create our own, with the following characteristics: Knob modifiable; gradient to indicate the selected portion; texts with the possibility of selecting color/font.
Title: Re: BGRAControls
Post by: circular on July 03, 2011, 05:30:19 pm
Cool.
Title: Re: BGRAControls
Post by: lainz on July 04, 2011, 04:26:54 pm
I'm running
Ubuntu 11.04
Lazarus 0.9.31 r31557 FPC 2.5.1 i386-linux-gtk 2
latest svn of lazpaint and bgracontrols

in my example testbgracontrols I get this error when I clic the same button two times:

procedure TBGRAGtkBitmap.ReallocData;
begin
  inherited ReallocData;
  FPixbuf := gdk_pixbuf_new_from_data(pguchar(FData),
    GDK_COLORSPACE_RGB, True, 8, Width, Height, Width*Sizeof(TBGRAPixel), nil, nil);
  if FPixbuf = nil then
    raise Exception.Create('Error initializing Pixbuf');
end;
Title: Re: BGRAControls
Post by: circular on July 04, 2011, 08:14:47 pm
I've tried some modification to BGRABitmap on subversion. Does it fix the problem you mention ?
Title: Re: BGRAControls
Post by: lainz on July 05, 2011, 12:02:41 am
Not solved-
I've attached a picture that show the problem.

How to reproduce:

* Compile and run testbgracontrols
* Open the example 'Flash Player Setup' or 'Win7 ToolBar'
* Close the opened example
* Reopen the closed example > here appears the pixbuf problem.

Edit: the file upixelate.pas is missing when I open LazPaint project.
Title: Re: BGRAControls
Post by: CaptBill on July 05, 2011, 01:51:34 am
I needed a slider. I decided to create our own, with the following characteristics: Knob modifiable; gradient to indicate the selected portion; texts with the possibility of selecting color/font.

What is the simplest way to make a slider that is indexed vs. the full range of a certain domain? I need a slider that can work with an indexed list instead of a full range without having to write a bunch of code. I want to point a slider to an array of values, in other words. Is there already a simple way to do this with sliders that I am missing?

Thanks
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on July 05, 2011, 03:14:46 am
In fact, the slider that comes with Delphi and other applications on Windows usually refers to Windows API itself. I'm designing some features that can facilitate, for example, what you need. Initially I am looking for improvements in appearance, as it must accompany the visual control of the application where it is inserted. In addition, must have control of the minimum and maximum, like this control http://developer.expressionz.in/downloads/mootools_double_pinned_slider_with_clipped_gutter_image_v2.2/slider_using_mootols_1.2.html (http://developer.expressionz.in/downloads/mootools_double_pinned_slider_with_clipped_gutter_image_v2.2/slider_using_mootols_1.2.html). But undoubtedly, it is best to allow the use of BGRABitmap, since I will use the other controls of the package.
Title: Re: BGRAControls
Post by: CaptBill on July 05, 2011, 10:24:01 pm
Hi Emerson,
What I plan on using the slider for is exactly what you are shooting for as a matter of fact. I will use 3 of these sliders, X Y and Z, to construct 3d grids. Idea is to have these and have custom scanner routines to have a super simple 3d-ish system which utilizes phong shading for making cool 3d skins without some complex 3d-engine/library. High quality 3d output but output as 2d graphics. All inside of a super small component/class.  and the idea is to have a system where  bezier curves become more natural/easy to use. Think Rhino 3d quality directly from a component. Look at the BGRAcontrols component code fore the 3d knob. That is drawn in the same way just done algorithmically. Should be able to plug in the component I have in mind right at this paint routine and be able to have CAD like abilities to make any type knob we want, from scratch.

You sound like you are on the same path so I think you will find the same issue in needing an indexable slider (knob too etc). This makes working with 3d much much easier by defining a grid system to have indexed values instead of actual datapoints.  Plus you use the grid to abstract the points so you can address them like cells of a spreadsheet vs. direct manipulation.

So a a xyz grid setup would look like so....

Quote
Var
Xindex,Yinde,Zindex  : TLineIndex;
begin
Xindex:=btlineindex.create(300,12) ///create line 300 pixels long with 12 index values
Yindex:=btlineindex.create(50,12) ///create line 50 pixels long with 12 index values
Zndex:=btlineindex.create(15,12) ///create line 15 pixels long with 12 index values
So now we can address the points by their array index. Then you can save just the index numbers and have simple "primitives" you can save. Then you can use the same basic shapes independent of the actual numbers. Change 300 to 250 and the whole structure resizes accordingly.

Plus we could easily set this up for a scripting language like addressing method. Just give the array index values some meaningful alias. How about using colors for instance...

Quote
SomePoint:= (Xindex(red), Yindex(blue), Z(violet));

This will make good sense if you give your grid lines their own color . You could just as well use musical notes for the alias naming

I hope i communicated that well enough. I think you fellas are real real close to some serious breakthrough product with the whole BGRA concept. Looks like BGRAbitmap is already there and you guys are now figuring out its full potential. Very powerful yet very simple.

Ps. The MooTools is a perfect example of what I am hoping for. This would be excellent with the color setup and also the range setting capabilities. Didn't mention ranges above for simplicity sake but they will very important player in the mix.  Perfect match up.

Thanks again

Title: Re: BGRAControls
Post by: lainz on July 06, 2011, 12:27:32 am
* Updated BGRAButton with GlobalOpacity property
* Updated testbgracontrols with new example 'Glass Menu':

Load a picture as background, you can see a blur effect in the button area.

See image attached  ;)

Edit: tested both Windows 7 and Ubuntu 11.04
Title: Re: BGRAControls
Post by: CaptBill on July 06, 2011, 03:09:06 am

Hey lainz,
That  makes a sweet button skin effect. Some cool neon backlighting like a real glass front lighted button would be awesome with this effect. My long winded idea above would serve to do the moulding around something like this. Like a 3d dashboard and a cool neon button recessed in the dashboard....hope that summarizes the idea in the long post above.

I bet you might like to Google "DJ software skins| images " for some cool ideas/inspiration if you haven't already. They take the skinning to the extreme in DJ/recording software, I noticed that you might find interesting.

Thanks
Title: Re: BGRAControls
Post by: lainz on July 06, 2011, 03:26:45 am

Hey lainz,
That  makes a sweet button skin effect. Some cool neon backlighting like a real glass front lighted button would be awesome with this effect. My long winded idea above would serve to do the moulding around something like this. Like a 3d dashboard and a cool neon button recessed in the dashboard....hope that summarizes the idea in the long post above.

I bet you might like to Google "DJ software skins| images " for some cool ideas/inspiration if you haven't already. They take the skinning to the extreme in DJ/recording software, I noticed that you might find interesting.

Thanks

Thanks i will see. I like skins =D But only a few are really cool.

I bookmarked djsoft skins to see later.
Title: Re: BGRAControls
Post by: CaptBill on July 06, 2011, 04:38:25 am
Where can i see more implementation examples of skinning that you would recommend?
I guess probably phone apps etc? Any software packages geared for skinning you know of to look at for ideas etc?

Best i have run across is the recording/effects racks and such software etc. Have you seen FL Studio's interface? It was one of the first to do the full skinning interface thing from the beginning...and it is pure Delphi btw.

http://www.flintnt.com/REVIEWS/flstudio6.jpg
Title: Re: BGRAControls
Post by: lainz on July 06, 2011, 03:34:22 pm
Where can i see more implementation examples of skinning that you would recommend?
I guess probably phone apps etc? Any software packages geared for skinning you know of to look at for ideas etc?

Best i have run across is the recording/effects racks and such software etc. Have you seen FL Studio's interface? It was one of the first to do the full skinning interface thing from the beginning...and it is pure Delphi btw.

http://www.flintnt.com/REVIEWS/flstudio6.jpg

I don't know if are really implemented as controls but in deviantArt are the most cool skins / ui designs:
http://browse.deviantart.com/customization/skins/?order=9

I'm looking at this today (implemented win7)
http://fediafedia.deviantart.com/art/Omnimo-4-0-for-Rainmeter-158707137?q=boost%3Apopular%20in%3Acustomization%2Fskins&qo=0

And this (iPad):
http://gianluca75.deviantart.com/art/UI-Touch-CDJ-Pro-193401801?q=boost%3Apopular%20ui%20design&qo=4
Title: Re: BGRAControls
Post by: CaptBill on July 06, 2011, 06:27:44 pm
Thanks. The Deviant Art site is definitely full of cool graphics. Imagine that high calibre output for skinning for your components with. Glad to see you are  on that Lainz. BGRAControls is really coming along nicely.

I just found FL Studio has a Linux clone called LMMS that has a nice component/skin interface. FL Studio is probably the most commercially successful Delphi app...next to Skype that is. The funny thing is that FL Studio was doing the whole Delphi with skins thing SINCE DELPHI 2! In fact, FL Studio were the pioneers of the whole concept. and certainly it's the Object model from Delphi that got them there.

My point is that it is just funny, and an awesome testimony to the power of the development environment we have here, that what we are doing now that we consider now as the 'the new rage'  was being done in 1997 in Delphi 2. It's just that everyone else is just now demanding it that make it seem like a new concept. Pascal has been a very solid choice since way back when.
Title: Re: BGRAControls
Post by: lainz on July 06, 2011, 08:14:31 pm
* Updated bgracontrols-1.0.10.1 (both git and file download from sourceforge)
https://sourceforge.net/projects/bgracontrols/

Updates since 1.0.9.10
* BGRAButton: added light effect, global opacity, opacity for most color properties.
* BGRAImageButton: added fine resample and new properties (anchors, align..)
* testBGRAControls: added test project with 'Flash Player Setup', 'Windows 7 ToolBar' & 'Glass Menu'.
Title: Re: BGRAControls
Post by: circular on July 06, 2011, 08:47:41 pm
Nice.

About the knob button for opacity in Glass menu example, I suggest:
- to use StartFromBottom
- set MinValue to 52 and maximum to 255+52=307
(52 is (360-256) divided by 2)
- in the change value event, to use this code :
Code: [Select]
var
  i: Byte;
begin
  i := trunc(Value-knbButtonOpacity.MinValue);
  btnBackground.GlobalOpacity:=i;
end; 

About the demo for TBGRAImageManipulation, under the trackbar, there is a round rectangle shape, but it is not antialiased. It is possible to use a BGRAButton with StaticButton property set to True.
Title: Re: BGRAControls
Post by: lainz on July 06, 2011, 09:35:21 pm
Nice.

Thanks  :D

About the knob button for opacity in Glass menu example, I suggest:
- to use StartFromBottom
- set MinValue to 52 and maximum to 255+52=307
(52 is (360-256) divided by 2)
- in the change value event, to use this code :
Code: [Select]
var
  i: Byte;
begin
  i := trunc(Value-knbButtonOpacity.MinValue);
  btnBackground.GlobalOpacity:=i;
end; 

Updated. I need to read practice again with the Free Pascal Tutorial.  :-[

About the demo for TBGRAImageManipulation, under the trackbar, there is a round rectangle shape, but it is not antialiased. It is possible to use a BGRAButton with StaticButton property set to True.
[/quote]

Done.
Title: Re: BGRAControls
Post by: circular on July 07, 2011, 12:04:08 am
Updated. I need to read practice again with the Free Pascal Tutorial.  :-[
That's ok.  8-)
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on July 07, 2011, 02:22:49 am
Nice changes.

Thanks Lainz for all changes.
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on July 07, 2011, 02:37:50 am
Lainz and Circular

I would ask if you can help me speed up TBGRAImageManipulation when running in full screen. I see a certain slowness of the redesign using the current algorithm. Is there any optimization we can do to speed it up?
Title: Re: BGRAControls
Post by: lainz on July 07, 2011, 04:44:29 am
nothing to envy to xaml / wpf
http://michaelsync.net/wp-content/uploads/2008/11/silverlight-glass-button.jpg

we can do something very similar with BGRAButton  8)
Title: Re: BGRAControls
Post by: circular on July 07, 2011, 05:42:12 pm
Emerson, here is an optimized version of RepaintBackground procedure:
Code: [Select]
procedure TBGRAImageManipulation.RepaintBackground;
  procedure DrawCheckers(bmp: TBGRABitmap; ARect: TRect);
  const
    tx = 8; ty = 8;
  var
    xb, yb, xdest,ydest, nbx,nby: integer;
    oddColor,
    evenColor: TBGRAPixel;
  begin
    oddColor := BGRA(220,220,220);
    evenColor := BGRA(255,255,255);
    bmp.ClipRect := ARect;
    xdest := ARect.Left;
    nbx := ((ARect.Right-ARect.Left)+tx-1) div tx;
    nby := ((ARect.Bottom-ARect.Top)+ty-1) div ty;
    for xb := 0 to nbx-1 do
    begin
      ydest := ARect.Top;
      for yb := 0 to nby-1 do
      begin
        if odd(xb+yb) then
          bmp.FillRect(xdest,ydest,xdest+tx,ydest+ty,oddColor,dmSet)
        else
          bmp.FillRect(xdest,ydest,xdest+tx,ydest+ty,evenColor,dmSet);
        inc(ydest,ty);
      end;
      inc(xdest,tx);
    end;
    bmp.NoClip;
  end;
 
var
  Border: TRect;
  Grad: TBGRAGradientScanner;
begin
  // Resize background
  fBackground.SetSize(fVirtualScreen.Width, fVirtualScreen.Height);

  // Draw the outer bevel
  Border := Rect(0,0,fVirtualScreen.Width, fVirtualScreen.Height);
   
  // Draw the rectangle around image
  if (fBorderSize > 2) then
  begin
    // Draw the border gradient
    Grad := TBGRAGradientScanner.Create(BGRA(245,245,245),BGRA(205,204,203),
                             gtLinear, PointF(0,0), PointF(0, fBackground.Height));
    fBackground.FillRect(0, 0, fBackground.Width, fBorderSize-2, Grad,dmSet);
    fBackground.FillRect(0, fBorderSize-2, fBorderSize-2, fBackground.Height-fBorderSize+2, Grad,dmSet);
    fBackground.FillRect(fBackground.Width-fBorderSize+2, fBorderSize-2,
                             fBackground.Width, fBackground.Height-fBorderSize+2, Grad,dmSet);
    fBackground.FillRect(0, fBackground.Height-fBorderSize+2,
                         fBackground.Width, fBackground.Height, Grad,dmSet);
    Grad.Free;
    InflateRect(Border, -(fBorderSize - 2), -(fBorderSize - 2));
  end;
 
  // Draw 3D border
  fBackground.CanvasBGRA.Frame3D(Border, 1, bvLowered, ColorToBGRA(ColorToRGB(clBtnHighlight)), ColorToBGRA(ColorToRGB(cl3DDkShadow)));
  fBackground.CanvasBGRA.Frame3D(Border, 1, bvLowered, ColorToBGRA(ColorToRGB(cl3DLight)), ColorToBGRA(ColorToRGB(clBtnShadow)));
 
  DrawCheckers(fBackground, Border);
end; 

- DrawCheckers doesn't use an intermediary bitmap
- gradient is drawn only on useful portions
- Frame3D is drawn using CanvasBGRA so there is no need to do any conversion of bitmap (which can be needed when using Canvas property).
Title: Re: BGRAControls
Post by: circular on July 07, 2011, 05:53:41 pm
And in the Render procedure, you can render the box using pixel coordinates lines :
Code: [Select]
      // Draw a selection box
      with Rect(fCropArea.Left  + fDeltaX,     fCropArea.Top    + fDeltaY,
                fCropArea.Right + fDeltaX - 1, fCropArea.Bottom + fDeltaY - 1) do
        Mask.DrawPolyLineAntialias([Point(Left,Top),Point(Right,Top),
                                    Point(Right,Bottom),Point(Left,Bottom),
                                    Point(Left,Top)],
                                    BorderColor,BGRAPixelTransparent,1,False); 
Title: Re: BGRAControls
Post by: lainz on July 07, 2011, 05:59:47 pm
@Circular

Those should be added to TBGRAImageManipulation?
Title: Re: BGRAControls
Post by: circular on July 07, 2011, 06:04:18 pm
Yes. These are modifications of the existing code.
Title: Re: BGRAControls
Post by: circular on July 07, 2011, 06:56:13 pm
Here is a new component : TBGRAShape

To be added too  8)
Title: Re: BGRAControls
Post by: lainz on July 07, 2011, 07:14:21 pm
Thanks.

BGRAControls 1.0.10.2
https://sourceforge.net/projects/bgracontrols/files/
* Added TBGRAShape
* Added TBGRAImageToggleBox
* Updated TBGRAImageManipulation
* Fixed TBGRAImageButton 'acces violation'
* Updated testbgracontrols, bgraimagebuttontest, bgraimagemanipulationdemo

I forget this in the log of 1.0.10.1
* Added DoubleBuffered property in TBGRAVirtualScreen to avoid flickering in windows running without themes (classic style)
Title: Re: BGRAControls
Post by: circular on July 07, 2011, 07:37:53 pm
Why is DoubleBuffered necessary? There is already WMEraseBkgnd procedure to prevent erasing the background.

You found the problem with TBGRAImageButton? What was it?
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on July 07, 2011, 07:56:34 pm
Tanks for all Circular.
Title: Re: BGRAControls
Post by: lainz on July 07, 2011, 09:58:07 pm
Why is DoubleBuffered necessary? There is already WMEraseBkgnd procedure to prevent erasing the background.

You found the problem with TBGRAImageButton? What was it?

No. I found the bug putting BGRAButtons inside BGRAVirtualScreen. But the problem is the same with BGRAImageButton.

Try it by yourself. Change your theme to Windows Classic and comment doublebuffered property. If you put BGRAButton or BGRAImageButton you will see filckering in the buttons.

I can't change BGRAButton / BGRAImageButton from TGraphicControl to TCustomControl in order to use DoubleBuffered in those controls because transparency doesn't works.

Edit: also if you don't set DoubleBuffered in a Form and you put a BGRAButton / BGRAImageButton running with the classic theme you will see the flickering.

Edit2: this remember me that i posted a bug in the bugtracker a long time ago, about flickering in the PaintBox but I notice now that PaintBox is a TGraphicControl.

Edit3:

Dibo post about that:
http://www.lazarus.freepascal.org/index.php/topic,12933.0.html

Mailing list:
http://www.mail-archive.com/lazarus@lists.lazarus.freepascal.org/msg19463.html

Bugtracker (flickering):
http://bugs.freepascal.org/view.php?id=18184
Title: Re: BGRAControls
Post by: circular on July 08, 2011, 11:24:57 am
Ok, I understand now. The basic content of BGRAVirtualScreen does not flicker, but with components on it, it flickers, right ?

I've published a new version of BGRABitmap (4.6.1) with minor changes so that TBGRAShape works well. There was a problem for example with the triangle with wide border at the bottom left corner.
Title: Re: BGRAControls
Post by: lainz on July 08, 2011, 02:49:11 pm
Ok, I understand now. The basic content of BGRAVirtualScreen does not flicker, but with components on it, it flickers, right ?

I've published a new version of BGRABitmap (4.6.1) with minor changes so that TBGRAShape works well. There was a problem for example with the triangle with wide border at the bottom left corner.

Right.  :)
Title: Re: BGRAControls
Post by: hitz on July 14, 2011, 04:56:09 pm
Hi,
i used images with labels to get my own designed buttons. I handled the changes with multiple onmouse events, so the bgraimagebutton is one big step forward for me. But i would like to have text on it (without editing the image for evera button), which reacts also onmouseover etc.
I guess ill have to add it in the bgraimagebutton.pas, but i never worked with those definition(?)-files so i dont know how to do it. Anyone may help me?
Title: Re: BGRAControls
Post by: lainz on July 14, 2011, 07:48:18 pm
Hi,
i used images with labels to get my own designed buttons. I handled the changes with multiple onmouse events, so the bgraimagebutton is one big step forward for me. But i would like to have text on it (without editing the image for evera button), which reacts also onmouseover etc.
I guess ill have to add it in the bgraimagebutton.pas, but i never worked with those definition(?)-files so i dont know how to do it. Anyone may help me?

I will update the bgraimagebutton to support text soon.

-------

I've attached bgraribbon.zip, isn't a control, is designed with BGRAVirtualScreen & BGRAButton. Not all buttons inside the example works-

Is just for fun.
Title: Re: BGRAControls
Post by: circular on July 14, 2011, 10:33:16 pm
Hey people. Here is an update with :
- TBGRAGraphicControl, which allows to draw your component by yourself with alpha blending
- the color of the flash progress bar can be set
- some minor changes
Title: Re: BGRAControls
Post by: circular on July 14, 2011, 10:34:30 pm
I've attached bgraribbon.zip, isn't a control, is designed with BGRAVirtualScreen & BGRAButton. Not all buttons inside the example works-

Is just for fun.
Cool, it's like we're in word 2010.  8)
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on July 14, 2011, 10:53:00 pm
It was fantastic. Congratulations
Title: Re: BGRAControls
Post by: lainz on July 14, 2011, 11:03:52 pm
Hey people. Here is an update with :
- TBGRAGraphicControl, which allows to draw your component by yourself with alpha blending
- the color of the flash progress bar can be set
- some minor changes

Thankyou. Added in git repository.

Would be desirable to replace TGraphicControl with TBGRAGraphicControl in BGRAControl, BGRAImageButton, BGRAShape, BGRAFlashProgressBar, BGRAKnob, BGRAImageManipulation...?
Title: Re: BGRAControls
Post by: Emerson Cavalcanti on July 14, 2011, 11:16:46 pm
Hey people. Here is an update with :
- TBGRAGraphicControl, which allows to draw your component by yourself with alpha blending
- the color of the flash progress bar can be set
- some minor changes

Thankyou. Added in git repository.

Would be desirable to replace TGraphicControl with TBGRAGraphicControl in BGRAControl, BGRAImageButton, BGRAShape, BGRAFlashProgressBar, BGRAKnob, BGRAImageManipulation...?

I am studying how to include the component in TBGRAImageManipulation and on new component TBGRATrackBar in development.
Title: Re: BGRAControls
Post by: circular on July 15, 2011, 11:57:22 am
Would be desirable to replace TGraphicControl with TBGRAGraphicControl in BGRAControl, BGRAImageButton, BGRAShape, BGRAFlashProgressBar, BGRAKnob, BGRAImageManipulation...?
I'm not sure it will connect nicely, because TBGRAGraphicControl is designed for user-defined controls inside the application. And anyway those components work well. About BGRAImageManipulation, it think it would be better to derive it from TPanel ou TCustomControl because it does not need alpha blending, and so it would be possible to put components into it.
Title: Re: BGRAControls
Post by: lainz on July 16, 2011, 08:46:26 pm
Ok-

Added TBGRASpriteAnimation in git repository.
Download a snapshot here:
http://bgracontrols.git.sourceforge.net/git/gitweb.cgi?p=bgracontrols/bgracontrols;a=summary

With this you can do animations from bitmap.
http://wiki.lazarus.freepascal.org/BGRAControls#TBGRASpriteAnimation

Features:
* Animation: invert, position, lap, speed, static, repeat.
* Sprite: fill opacity (global transparency), flip mode (horizontal, vertical, both), key color (transparent color), resample (normal or fine resample modes). AutoSize.
Title: Re: BGRAControls
Post by: circular on July 17, 2011, 04:16:38 pm
Interesting component. Some comments :

- It is possible to show the bitmap in design mode. The only thing that needs to be deactivated is the timer
- I think there should be Center and Stretch property like in a TImage
- the Autosize property doesn't resize the component when changed, only after moving it
Title: Re: BGRAControls
Post by: lainz on July 17, 2011, 10:20:48 pm
I've updated BGRASpriteAnimation in git repository.

* Added rotation (cw, ccw)
* Added some events
* Now the bitmap can be shown in design mode
* Fixed small things

@circular : I have some problems using bgrabitmap with this object, please see test project, the problem is commented in the sprAnimBeforeRedraw procedure.
Title: Re: BGRAControls
Post by: circular on July 18, 2011, 12:50:35 am
Here is a way to apply grayscale :
Code: [Select]
var grayscale: TBGRABitmap;
begin
  grayscale := Bitmap.FilterGrayscale as TBGRABitmap;
  Bitmap.Assign(grayscale);
  grayscale.Free;
Title: Re: BGRAControls
Post by: lainz on July 18, 2011, 03:22:19 am
Here is a way to apply grayscale :
Code: [Select]
var grayscale: TBGRABitmap;
begin
  grayscale := Bitmap.FilterGrayscale as TBGRABitmap;
  Bitmap.Assign(grayscale);
  grayscale.Free;

Thankyou!
Title: Re: BGRAControls
Post by: lainz on July 18, 2011, 07:00:51 pm
Released BGRAControls 1.1.0.0

Download:
https://sourceforge.net/projects/bgracontrols/files/

Changelog:
* Added circular updates ( http://www.lazarus.freepascal.org/index.php/topic,12411.msg72778.html#msg72778 )
* Added TBGRAGraphicControl
* Added TBGRASpriteAnimation ( http://wiki.lazarus.freepascal.org/BGRASpriteAnimation )

I've reuploaded BGRAControls-1.0.0.0
* Fixes in BGRASpriteAnimation
Title: Re: BGRAControls
Post by: codedeep on July 19, 2011, 08:01:54 pm
Hi

I created TBRGALabel, is based on TBRGAButton. Basically it is a simplification of the moment.
I have also implemented the feature to enable or disable antialiasing in text and shadows, both TBRGAButton as TBRGALabel
And finally I have fixed a bug in TextAlign when the value was set at btaLeft. In the component TBRGAButton
Attached the files with the new components and additions and corrections to TBRGAButton

Another small contribution ;). This library would be great. lol   :D

You can include it in the next version.

updated with correct files sorry
Title: Re: BGRAControls
Post by: circular on July 19, 2011, 08:46:28 pm
Hello. I tried the components but left TextAlign doesn't seem to work, the text disappears. And I can't find the antialiasing property. Are you sure you copied the right files ?

What is the difference between TBGRALabel and TBGRAButton ?
Title: Re: BGRAControls
Post by: codedeep on July 19, 2011, 10:31:20 pm
Sorry %)

This is correct files
Title: Re: BGRAControls
Post by: lainz on July 20, 2011, 12:14:09 am
@codedeep: Please responds What is the difference between TBGRALabel and TBGRAButton ?

I've updated BGRASpriteAnimation on git repository using cardinals instead integer.

@circular: if you have a moment you can see bgraspriteanimation, I need help with this:

1)
{ Mixing signed expressions and longwords gives a 64bit result }
  if (AValue < 1) or (AValue > FSprite.Width) then

AValue is cardinal (sprite count), FSprite.Width is integer (bitmap width)..

2)
Done, but i'm not 100% sure that the timer is disabled.
Quote
- It is possible to show the bitmap in design mode. The only thing that needs to be deactivated is the timer

Done.
Quote
- the Autosize property doesn't resize the component when changed, only after moving it

I need some help with this =D
Quote
I think there should be Center and Stretch property like in a TImage

---

Also I will try to change FSprite from bitmap to TPicture.
Title: Re: BGRAControls
Post by: circular on July 20, 2011, 03:23:25 pm
@codedeep: Please responds What is the difference between TBGRALabel and TBGRAButton ?
See the new version of the control.

It is by default Autosized, there is no border color, by default there is no background. There are no states (hover...).

@codedeep: By the way, the following properties are not needed anymore : StaticButton, TextApplyGlobalOpacity. To my opinion, it is too complicated to have the property TextShadowAntialias. You can just apply antialiasing option to both or not.

Quote
@circular: if you have a moment you can see bgraspriteanimation, I need help with this:

1)
{ Mixing signed expressions and longwords gives a 64bit result }
  if (AValue < 1) or (AValue > FSprite.Width) then

AValue is cardinal (sprite count), FSprite.Width is integer (bitmap width)..
As the sprite Width is always positive, you can write Cardinal(FSprite.Width) instead of FSprite.Width.

Quote
Done, but i'm not 100% sure that the timer is disabled.
Well if the image doesn't move anymore, it's already ok. But it's better if it is completely disabled.

Quote
Quote
- the Autosize property doesn't resize the component when changed, only after moving it
I need some help with this =D
Maybe by overriding AdjustSize method.
Title: Re: BGRAControls
Post by: lainz on July 20, 2011, 03:43:34 pm
Thankyou.

The last: How I can get the picture from a TPicture and create a BGRABitmap from it?
Title: Re: BGRAControls
Post by: circular on July 20, 2011, 06:33:31 pm
Maybe TBGRABitmap.Create(Picture1.Bitmap) ?
Title: Re: BGRAControls
Post by: codedeep on July 20, 2011, 07:24:54 pm
Hi

@lainz and @circular

TRGBALabel 1.0v:

Differences:
By Default:
Autosized
No Background
No border

Caracteristics not presents:
There are no states (hover and clicked)
StaticButton

New caracteristics ;) (The first version was necessary to implement this feature.)
WordWarp: Posibility multiline text (attached here)

In next version Rotate text  :o
 :D
Title: Re: BGRAControls
Post by: lainz on July 20, 2011, 10:26:24 pm
Maybe TBGRABitmap.Create(Picture1.Bitmap) ?

=) http://lazarus-ccr.sourceforge.net/docs/lcl/graphics/tpicture.html

Doesn't works. I've found one way (I really don't know if is the best way drawing in the canvas):

Code: [Select]
TempSpriteBGRA := TBGRABitmap.Create(FSprite.Graphic.Width,FSprite.Graphic.Height);
TempSpriteBGRA.Canvas.Draw(0,0,FSPrite.Graphic);

Hi

@lainz and @circular

TRGBALabel 1.0v:

Differences:
By Default:
Autosized
No Background
No border

Caracteristics not presents:
There are no states (hover and clicked)
StaticButton

New caracteristics ;) (The first version was necessary to implement this feature.)
WordWarp: Posibility multiline text (attached here)

In next version Rotate text  :o
 :D

Added on git repository.

It is really nice, I will use it in BGRAImageButton as caption.

Please I see missing properties in the object inspector:
* Font

I see unused? properties:
* RoundX
* RoundY
* Color

Recomendations:
* AutoSize:=True as default
Title: Re: BGRAControls
Post by: circular on July 21, 2011, 06:36:13 pm
Maybe TBGRABitmap.Create(Picture1.Bitmap) ?

=) http://lazarus-ccr.sourceforge.net/docs/lcl/graphics/tpicture.html

Doesn't works. I've found one way (I really don't know if is the best way drawing in the canvas):

Code: [Select]
TempSpriteBGRA := TBGRABitmap.Create(FSprite.Graphic.Width,FSprite.Graphic.Height);
TempSpriteBGRA.Canvas.Draw(0,0,FSPrite.Graphic);
Well, this works as long as the bitmap is not semi-transparent. Anyway, why do you want to use Picture instead of Bitmap ?

Quote
In next version Rotate text  :o
 :D
This will be a little more complicated.  8-)
Title: Re: BGRAControls
Post by: lainz on July 21, 2011, 07:20:15 pm
Well, this works as long as the bitmap is not semi-transparent. Anyway, why do you want to use Picture instead of Bitmap ?

Because if you change TSprite (TBitmap) in the ObjectInspector and you clear the bitmap there is an acces violation. With TPicture this doesn't appear.

With TBitmap from code you only can load .bmp. With TPicture you can use TSprite.LoadFromFile .png .jpg and others.

This is usefull to avoid the loading of one picture first to a TBGRABitmap and then assigning to TSprite (TBitmap).

I've updated git repository adding the properties in BGRASpriteAnimation: Stretch, Center & Proportional (works same as TImage). Now TSprite is TPicture.
Title: Re: BGRAControls
Post by: circular on July 21, 2011, 07:44:05 pm
Maybe you can define Bitmap property to use in fact a TBGRABitmap object. When accessing Bitmap property, you can return TBGRABitmap.Bitmap property, and when assigning the Bitmap property, you can use TBGRABitmap.Assign. See what I mean ?

Then in fact, you store internally a TBGRABitmap, so no need to convert it to draw it. You can then add a LoadFromFile method in the TBGRASprite object that calls TBGRABitmap.LoadFromFile.
Title: Re: BGRAControls
Post by: codedeep on July 21, 2011, 08:06:57 pm
TBRALabel Changes in 1.01:
-Feature "Font" removed from "TBackground" and added to "TBRALabel" more visible and coherent
-Added property Editor Multiline in Caption  8-)
-Color Property Removed unnecessary and unused

Added requirement "IDEIntf" in package "bgracontrols.lpk" to use property editors in the component

Attached changed files
Title: Re: BGRAControls
Post by: lainz on July 22, 2011, 08:46:40 pm
BGRAControls 1.1.0.1
https://sourceforge.net/projects/bgracontrols/files/

* Updated BGRASpriteAnimation
* Added BGRALabel
* Added some caption in BGRAImageButton

@circular

I've solved the problem on this way:

Code: [Select]
procedure TBGRASpriteAnimation.SetFSprite(const AValue: TPicture);
var
  TempBitmap: TBitmap;
begin
  if (FSprite = AValue) or (AValue = nil) then
    Exit;

  TempBitmap := TBitmap.Create;
  TempBitmap.Assign(AValue);
  FSprite.Assign(TempBitmap);
  TempBitmap.Free;

  Invalidate;
end;

The image is always stored in FSprite.Bitmap.

BTW I'm trying to load from a TPicture and store as TBGRABitmap to avoid the conversion on Paint.
Title: Re: BGRAControls
Post by: lainz on July 24, 2011, 07:52:46 pm
Added BGRALabelFX on git repository.

Features:
* Outline
* Shadow

ToDo:
* Use BGRATextFX multicolor, textures.
* Calculations (size according outline & shadow position)
* Alignment (just center is ok)
* etc.

Feel free to improve it :)
Title: Re: BGRAControls
Post by: circular on July 24, 2011, 09:44:47 pm
Nice  ;)
Title: Re: BGRAControls
Post by: hitz on July 26, 2011, 02:58:01 am
Thanks for adding the caption function to bgraimagebutton, but i cant test it, on installation it misses the BGRATextFX library.
I installed BGRABitmap 4.6.1, there ist no BGRATextFX and i have not found in packages on this page of the thread.
Any hint where to find it would be great :)
Title: Re: BGRAControls
Post by: lainz on July 26, 2011, 04:54:37 am
Thanks for adding the caption function to bgraimagebutton, but i cant test it, on installation it misses the BGRATextFX library.
I installed BGRABitmap 4.6.1, there ist no BGRATextFX and i have not found in packages on this page of the thread.
Any hint where to find it would be great :)

try BGRABitmap SVN
Title: Re: BGRAControls
Post by: circular on July 26, 2011, 08:50:48 pm
Here is bgrabitmap uploaded as a new version (4.7)
http://sourceforge.net/projects/lazpaint/files/src/
Title: Re: BGRAControls
Post by: JanRoza on July 27, 2011, 01:20:31 pm
Curious to try out BGRAControls and Bitmap I installed BGRABitmap, but continuously run into problems when installing BGRAControls. It seems TextShadow is not found:

Quote
D:\Compilers\lazarus\components\bgracontrols\bgraimagebutton.pas(139,21) Error: Identifier not found "TextShadow"

Any idea what might be wrong here?
Title: Re: BGRAControls
Post by: Takeda on July 27, 2011, 02:47:33 pm
Here is bgrabitmap uploaded as a new version (4.7)
http://sourceforge.net/projects/lazpaint/files/src/

When I use Cross-Compilerof FPC 2.5.1 to Win64, it was failed to compile my projects !
I report this issue in Sourceofrge.. (http://sourceforge.net/tracker/?func=detail&aid=3375668&group_id=404555&atid=1676204)

This issue is already fixed, Sir?

Regards,
Takeda.
Title: Re: BGRAControls
Post by: lainz on July 27, 2011, 03:12:30 pm
Curious to try out BGRAControls and Bitmap I installed BGRABitmap, but continuously run into problems when installing BGRAControls. It seems TextShadow is not found:

Quote
D:\Compilers\lazarus\components\bgracontrols\bgraimagebutton.pas(139,21) Error: Identifier not found "TextShadow"

Any idea what might be wrong here?

Download BGRABitmap 4.7 or try BGRABitmap SVN.
Title: Re: BGRAControls
Post by: JanRoza on July 27, 2011, 05:26:09 pm
I am using BGRABitMap 4.7 and still the error occurs.
I'll try a newer svn version.
Title: Re: BGRAControls
Post by: circular on July 28, 2011, 01:19:02 pm
@JanRoza : the problem is probably due to the compiler. Try using a stable version of Lazarus/FPC instead.
Title: Re: BGRAControls
Post by: JanRoza on July 29, 2011, 01:40:27 am
Using Lazarus 0.9.30.1 BGRABitmap 4.7 compiles okay but trying out one of the tests (bgrabuttondemo) it fails to load the project with error message that it needs LCLbase >= 1.0.1.
LCLbase 1.0.1 as far as I know means I have to use a unstable snapshot to make it work. So I'm going round in circles.
Title: Re: BGRAControls
Post by: lainz on July 29, 2011, 01:58:53 am
I'm using FPC 2.4.2 release with Lazarus 0.9.31 SVN.

I'm not sure. Try to replace the dependency in BGRAControls package to your LCLbase version.
Title: Re: BGRAControls
Post by: circular on July 29, 2011, 12:56:34 pm
@JanRoza: you can remove LCLbase dependency
Title: Re: BGRAControls
Post by: JanRoza on July 29, 2011, 07:34:42 pm
After removing the LCLbase dependency I run into the old and now well known error "Error: Identifier not found "TextShadow" again when running the bgrabuttondemo.
Maybe I'll better leave BGRABitMap alone until its more stable.

Title: Re: BGRAControls
Post by: lainz on July 30, 2011, 12:15:20 am
After removing the LCLbase dependency I run into the old and now well known error "Error: Identifier not found "TextShadow" again when running the bgrabuttondemo.
Maybe I'll better leave BGRABitMap alone until its more stable.

I've installed Lazarus 0.9.30 FPC 2.4.2 (The current release) for Windows x86
BGRABitmap 4.7 (last release)
BGRAControls 1.1.0.1 (last release)

Installation issues: none.

I've noticed the LCLbase dependency in the 'bgrabuttondemo' and other examples, just removed the dependency and the example is running.
Title: Re: BGRAControls
Post by: lainz on July 30, 2011, 01:22:39 am
BGRAControls 1.1.0.2
http://wiki.lazarus.freepascal.org/BGRAControls

* Added BGRALabelFX
* Improved examples to run in Lazarus 0.9.30
* JEDI Code Format
Title: Re: BGRAControls
Post by: JanRoza on July 30, 2011, 11:47:21 pm
With version 1.1.02 things work out okay in Lazarus 0.9.30.
Thanks!
Title: Re: BGRAControls
Post by: Dibo on July 31, 2011, 12:45:19 am
Nice work lainz! The package is developing well.  I plan to add a new component (something like DrawGrid)
Title: Re: BGRAControls
Post by: circular on July 31, 2011, 07:54:43 pm
Nice work lainz! The package is developing well.
+1
Title: Re: BGRAControls
Post by: lainz on August 01, 2011, 04:05:22 am
Good job you too! We have 15 controls.  :o

Develping visual controls I've learned something about object oriented programming-
Title: Re: BGRAControls
Post by: Sora-Kun on August 02, 2011, 12:13:24 pm
Hi all,
   You people are amazing, this project is growing so fast :O.
I want to tell you, that, when I add bgrabuttons to a project, i leave them as they are, and i change their appearance later in Code Right ?
However, in reality, the application displays the buttonsas I created them, then it changes their appearance, doesn't that takes some times, maybe you people could find a solution about that it's just a matter of optimizations. The thing is that I'm making an Application heavily based on BGRAControles (you can find the link in my sig below), and when the application loads, I see in few ms that the application starts in Black Color (check the attached image). After that, the application starts normally. The application has a lot of BGRAButtons and BGRAPanels everywhere.

Thanks a lot,
Cheers,
KingXerXes
Title: Re: BGRAControls
Post by: circular on August 02, 2011, 06:27:13 pm
I want to tell you, that, when I add bgrabuttons to a project, i leave them as they are, and i change their appearance later in Code Right ?
You can do that. You can set their appearence on design too.

Quote
However, in reality, the application displays the buttonsas I created them, then it changes their appearance, doesn't that takes some times
You can change the parameters of the buttons before there are showed, in the Create procedure for example.

Does this fix your problem ?
Title: Re: BGRAControls
Post by: Sora-Kun on August 02, 2011, 06:52:28 pm
Hi,
  onCreate procedure, of the main form or of each button ?
Title: Re: BGRAControls
Post by: lainz on August 02, 2011, 07:14:09 pm
Hi,
  onCreate procedure, of the main form or of each button ?

On the Main Form, there is no OnCreate event for buttons.

See the testbgracontrols project (included in the package).
Title: Re: BGRAControls
Post by: JD on August 02, 2011, 07:27:26 pm
Nice work lainz! The package is developing well.  I plan to add a new component (something like DrawGrid)

I really love your work, guys. It is looking better & better by the day. Please keep it up & who knows, maybe one day your library & its controls may be part of the default Lazarus installation.
Title: Re: BGRAControls
Post by: Sora-Kun on August 02, 2011, 09:15:04 pm
Hi,
Yes that's what I was doing already,
 did you find a solution about the black components at start up ?

Thanks a lot!
Cheers,,
KingXerxes
Title: Re: BGRAControls
Post by: Sora-Kun on August 02, 2011, 09:51:53 pm
Hi, again,
Also please note that the BGRALabelFX is not very dynamic, i mean let's say the following code:
Code: [Select]
procedure ...
var
  lblTitle: TBGRALabelFx;
begin
   lblTitle.Caption := Edit2.Text;
end

actually, the Caption will not change until the windows is resized or moved.
Also, can you please the onMouseMove, onMouseUp, and others basic events.
Thanks a lot.
Sincerely,
KingXerxes.
Title: Re: BGRAControls
Post by: lainz on August 03, 2011, 02:50:01 am
BGRALabelFX updated in BGRAControls git repository (you can download the latest snapshot here: http://bgracontrols.git.sourceforge.net/git/gitweb.cgi?p=bgracontrols/bgracontrols;a=snapshot;h=HEAD;sf=tgz )

Now you can do something like:

Code: [Select]
procedure TForm1.BGRALabelFX1Click(Sender: TObject);
begin
  if BGRALabelFX1.Caption = 'BGRALabelFX' then
    BGRALabelFX1.Caption := 'LabelFX'
  else BGRALabelFX1.Caption := 'BGRALabelFX';
end; 

About the black color, is because the components take some time to draw everything.

The solution can be don't show the window until all the things are drawn.. something like 'Loading...' but I have no idea if possible or the way to do that-

Edit: your app looks really nice-
Title: Re: BGRAControls
Post by: Sora-Kun on August 03, 2011, 03:33:06 am
Hi,
Thanks a lot my friend,
 I'll install it and post the results ;)
Cheers,
KingXerXes
Title: Re: BGRAControls
Post by: Sora-Kun on August 03, 2011, 03:41:08 am
Hi agai,
I know .. i'm fast xD
Actually you are faster ! You quickly added the events that I asked for ..
Another small problem, it's when I change the text of the BGRALabelFx, and the AutoSize if already set to true, it's not updated in the BGRALabelFx, a screenshot is attached, please check it.
Thanks a lot mate,
Cheers,
KingXerXes.
Title: Re: BGRAControls
Post by: lainz on August 03, 2011, 05:08:23 am
Hi agai,
I know .. i'm fast xD
Actually you are faster ! You quickly added the events that I asked for ..
Another small problem, it's when I change the text of the BGRALabelFx, and the AutoSize if already set to true, it's not updated in the BGRALabelFx, a screenshot is attached, please check it.
Thanks a lot mate,
Cheers,
KingXerXes.

It work's for me.

I can't see the problem with a screenshot, please upload a test project.
Title: Re: BGRAControls
Post by: Sora-Kun on August 03, 2011, 12:44:43 pm
hi,
  actually, the BGRALabelFx text should be:
  E:/Python32/Lib/_phello_foo.py
Because auto sizing is not yet fixed, the text is not totally shown. I mean the BGRALabelFx size didn't change!
I attached an example, hope it helps you.
Thanks a lot.
KingXerXes
Title: Re: BGRAControls
Post by: lainz on August 03, 2011, 06:02:49 pm
hi,
  actually, the BGRALabelFx text should be:
  E:/Python32/Lib/_phello_foo.py
Because auto sizing is not yet fixed, the text is not totally shown. I mean the BGRALabelFx size didn't change!
I attached an example, hope it helps you.
Thanks a lot.
KingXerXes

The problem is AutoSize only work with Align = alNone. BGRAImageButton, BGRAImageToggleBox & BGRASpriteAnimation work the same. Needs improvement.
Title: Re: BGRAControls
Post by: Dibo on August 03, 2011, 09:25:34 pm
I am wondering... Is any chance to separate BGRABitmap from LCL in future? I am working now on project based on FpGUI. This is very interesting lightweight interface. With BGRABitmap power, we could create some new components for it.
Title: Re: BGRAControls
Post by: circular on August 03, 2011, 09:46:16 pm
@Dibo: few chances, because TBGRABitmap is deeply linked to TBitmap.

@Lainz: I think that KingXerxes wants to talk about updating the size of the component when the caption is changed. To do so, you need to handle caption change event to apply the auto size.
Title: Re: BGRAControls
Post by: lainz on August 03, 2011, 10:11:29 pm
@Dibo: few chances, because TBGRABitmap is deeply linked to TBitmap.

I only need a TBGRABitmap / TBGRAPixel plugin for the object inspector =) (like TPicturePropertyEditor & TColorPropertyEditor of the GraphPropEdits in the IDEIntF)

@Lainz: I think that KingXerxes wants to talk about updating the size of the component when the caption is changed. To do so, you need to handle caption change event to apply the auto size.

That works, but only if align is alNone.

To use AutoSize right way would have to add

CalculatePreferredSize

and

TBGRALabel.UpdateSize;
begin
  InvalidatePreferredSize;
  AdjustSize;
end;   

as do BGRAButton and BGRALabel.
Title: Re: BGRAControls
Post by: lainz on August 05, 2011, 09:18:24 pm
I've updated BGRASpriteAnimation on git repository:
* Is using TBitmap instead of TPicture (is better when usign bgrabitmap)
* Added function AnimatedGifToSprite(Filename: String): TBGRABitmap;

(at this time the function is contained inside TBGRASpriteAnimation, but I will add this in the unit as standalone function)

Now you can easy convert animated gif's to sprite and then, for example, you can save to a .png file.

BTW at this time I can't solve how to assign the resulting image directly in the Sprite property.
Title: Re: BGRAControls
Post by: Sora-Kun on August 06, 2011, 12:57:59 am
Hi,

   there is a problem with the BGRAButton, actually when I change the button type to DropDown, actually, a new dropdown arrow appears, and I add to that BGRAButton a popupmenu, however in execution mode, when i click on the dropdown arrow  I can see the popupMenu, however the BGRAButtonOnClick action is called. It's just like i clicked the button itself. The Button and the dropdown arrow should be seperated from eachother.

Thanks a lot.
Cheers,
KingXerXes
Title: Re: BGRAControls
Post by: Dibo on August 06, 2011, 11:10:04 am
Ok, I will fix it, thanks
Title: Re: BGRAControls
Post by: lainz on August 06, 2011, 11:49:23 pm
See those skins, are really nice:
http://www.alphaskins.com/asdwnld.php
http://www.alphaskins.com/ademos.php

72 skins  :o
Title: Re: BGRAControls
Post by: Dibo on August 07, 2011, 12:17:23 am
Look nice :) .

BTW: I think we should create some base control for better manage common functionality. All BGRA controls should inherit from it. TBGRAGraphic control is good candidate
Title: Re: BGRAControls
Post by: Sora-Kun on August 10, 2011, 01:55:45 am
Hi,
   Actually, BGRAButtons does not support transparency using Qt .. (i have KDE desktop)
Please check this picture:http://zupimages.net/up/1/278854368.png (http://zupimages.net/up/1/278854368.png) I can not  attach it because it's too large. Sorry
The Pictures show two application, the main one under Linux KDE, and the other on WinXP running on Vbox,  showing the difference between both of them.
Title: Re: BGRAControls
Post by: lainz on August 10, 2011, 01:19:57 pm
Hi,
   Actually, BGRAButtons does not support transparency using Qt .. (i have KDE desktop)
Please check this picture:http://zupimages.net/up/1/278854368.png (http://zupimages.net/up/1/278854368.png) I can not  attach it because it's too large. Sorry
The Pictures show two application, the main one under Linux KDE, and the other on WinXP running on Vbox,  showing the difference between both of them.

Only BGRAButtons? Other BGRA Controls are working?
Title: Re: BGRAControls
Post by: Sora-Kun on August 10, 2011, 10:05:28 pm
Hi,
   I made many screenshots of the examples that comes with bgraControls, i compiled all of them with Qt LCL. Here is a global idea: http://zupimages.net/up/1/1784458850.png (http://zupimages.net/up/1/1784458850.png)
This Zip file contains more screenshots. I could not attach it because it too large: http://kingxerxes.yolasite.com/resources/bgrabut-bug001.png.zip (http://kingxerxes.yolasite.com/resources/bgrabut-bug001.png.zip)
Hope my report helps you.
Sincerely,
KingXerXes.
Title: Re: BGRAControls
Post by: lainz on August 11, 2011, 12:30:48 am
Hi,
   I made many screenshots of the examples that comes with bgraControls, i compiled all of them with Qt LCL. Here is a global idea: http://zupimages.net/up/1/1784458850.png (http://zupimages.net/up/1/1784458850.png)
This Zip file contains more screenshots. I could not attach it because it too large: http://kingxerxes.yolasite.com/resources/bgrabut-bug001.png.zip (http://kingxerxes.yolasite.com/resources/bgrabut-bug001.png.zip)
Hope my report helps you.
Sincerely,
KingXerXes.

I see. But seems that transparency inside 'solid' controls has transparency.

So the problem is with BGRAControls and not with BGRABitmap. But to ensure compile lazpaint\testbgrafunc project, specially test nº12 and nº17.

Here http://lazarus.freepascal.org/index.php/topic,13893.msg73847.html#msg73847 say that 'For the splash-shaped form, with GTK2 the background must be black and the shape white. In Qt it is opposite.' so the transparent color is different.
Title: Re: BGRAControls
Post by: circular on August 11, 2011, 06:48:04 pm
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.
Title: Re: BGRAControls
Post by: Dibo on August 13, 2011, 11:21:20 pm
I commited new version with event OnButtonClick in TBGRAButton which is fired only when main button is clicked (not drop down button)
Title: Re: BGRAControls
Post by: lainz on August 18, 2011, 12:24:47 am
I've uploaded BGRAControls-1.1.0.3

https://sourceforge.net/projects/bgracontrols/files/

* Updated BGRALabelFX (fixes in autosize)
* Updated BGRAButton (OnButtonClick event)
* Updated BGRASpriteAnimation (Now you can convert animated gif to sprite)
* Fixes in TBitmap property for TBGRAImageButton & TBGRAImageToggleBox
Title: Re: BGRAControls
Post by: Dibo on August 28, 2011, 05:40:49 pm
Hi, I commited new TBGRAButton and TBGRAPanel:

Changes:

Regards
Title: Re: BGRAControls
Post by: lainz 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).
Title: Re: BGRAControls
Post by: Dibo 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.
Title: Re: BGRAControls
Post by: lainz on August 30, 2011, 05:51:06 pm
I've a problem with Static property, seems it's not working.
Title: Re: BGRAControls
Post by: Dibo 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
Title: Re: BGRAControls
Post by: Dibo on September 04, 2011, 07:37:15 pm
Commit changes:
Title: Re: BGRAControls
Post by: lainz 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.
Title: Re: BGRAControls
Post by: lainz 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.
Title: Re: BGRAControls
Post by: Dibo on September 05, 2011, 05:37:31 pm
I commited some other fixes for TBGRAButton (e.g. Gradient1EndPercent was not remembered by object inspector)
Title: Re: BGRAControls
Post by: Dibo 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.
Title: Re: BGRAControls
Post by: lainz 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.
Title: Re: BGRAControls
Post by: circular 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.  :)
Title: Re: BGRAControls
Post by: lainz 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-)
Title: Re: BGRAControls
Post by: lainz 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).
Title: Re: BGRAControls
Post by: circular 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.
Title: Re: BGRAControls
Post by: Dibo on September 13, 2011, 09:21:50 pm
Commit changes:
Title: Re: BGRAControls
Post by: lainz on September 13, 2011, 11:12:27 pm
* Fixed Glass Menu: now is HighDPI compatible, sizable.
* Minor form change in MetroUI.

ToDo: create functions for Glass Menu to be reusable.
Title: Re: BGRAControls
Post by: lainz on September 14, 2011, 08:26:48 pm
* New procedure 'Glass' in Glass Menu.
* New option 'ShowBkg': the result is like a shadow for the opaque buttons and a texture for transparent buttons.

It's really nice see the attached shot.
Title: Re: BGRAControls
Post by: arbelest on September 15, 2011, 06:55:32 am
Y
- 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.

Today I watch Windows 8 demo and I think Metro UI is very interesting. Your Metro UI button color sample is best, but is there any way to make multiline caption, or add multiple image inside ?

NB. sorry for my bad english
Title: Re: BGRAControls
Post by: lainz on September 16, 2011, 05:04:34 am
Y
- 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.

Today I watch Windows 8 demo and I think Metro UI is very interesting. Your Metro UI button color sample is best, but is there any way to make multiline caption, or add multiple image inside ?

NB. sorry for my bad english

Maybe using the same behavior that has BGRALabel. About multiple image I've no idea.

But you can create your own control based on TBGRAImageButton (that's easy to understand) or TButton and add the features you want. Or better create a new control (not graphic control if you doesn't need alpha, just an opaque rectangle) and add inside a BGRALabel.
Title: Re: BGRAControls
Post by: arbelest on September 16, 2011, 06:08:03 am
Maybe using the same behavior that has BGRALabel. About multiple image I've no idea.

But you can create your own control based on TBGRAImageButton (that's easy to understand) or TButton and add the features you want. Or better create a new control (not graphic control if you doesn't need alpha, just an opaque rectangle) and add inside a BGRALabel.
Thanks for your replay, I try it now. But, i use TBGRAPanel, because TBGRAImageButton can not have child control (Correct me if i'am wrong). Unfortunately, TBGRAPanel have no alpha or transparent property, but it fine.

I already modify TBGRAPanel so it can change color on mouse over, mouse click and mouse leave. It is OK until you add other control inside (ex. button). Mouse leave is trigger when mouse enter button inside panel. So, how we make all child control inside  TBGRAPanel to ignore all of it's event (mouse over, click etc) ?.


Title: Re: BGRAControls
Post by: Sora-Kun on September 17, 2011, 12:29:32 pm
Hello,
  BGRAControles evolution speed is very high,
and I think about choosing a user interface (btn colors and backgrounds ...), that we all use to make lazarus applications looks unique and belongs to the same family. If course we don't oblige people to use of course :) Like MS interface which is blue and orange ...
U see what i'm talking about ?
Title: Re: BGRAControls
Post by: JD on September 23, 2011, 04:20:33 pm
Hello,
  BGRAControles evolution speed is very high,
and I think about choosing a user interface (btn colors and backgrounds ...), that we all use to make lazarus applications looks unique and belongs to the same family. If course we don't oblige people to use of course :) Like MS interface which is blue and orange ...
U see what i'm talking about ?

In a nutshell, you are talking about using BGRAControls to add themes to the Lazarus IDE and maybe even Lazarus applications. I wouldn't mind having that either.  ;)
Title: Re: BGRAControls
Post by: lainz on September 25, 2011, 07:13:19 pm
For those always download the release:
BGRAControls-1.1.0.4
https://sourceforge.net/projects/bgracontrols/files/

The main advantage of this release is that BGRAButton is much faster than before, is fast like the default OS buttons.

For Qt users: update to the last BGRABitmap and transparency will work. There are some issues in Qt like drop down button and bgraspriteanimation sizing, other things works fine.

- Optimalization for TBGRAButton and TBGRAPanel

TBGRAButton:
- Fix for ribbon and glass menu demo
- Added BeginUpdate and EndUpdate
- Fix: Some propertys was not refreshed after changing
- TBGRAButton: Fix for StaticButton property
- TBGRAButton: Added Down property
- Fix for refrehsing TBody propertys
- Added OnAfterPrepareBGRAButton event

TBGRAPanel:
- Added OnAfterPrepareBGRAPanel event
- Some fixes for TBGRAPanel
- Added caption alignment, layout and shadow
- Added BeginUpdate and EndUpdate

TBGRAImageList:
- uncommented ImgList unit (commented by uses cleaner)

TestBGRAControls:
- Metro UI in testbgracontrols
- Now all demo in testbgracontrols run at any High DPI setting in Windows 7.
- New procedure 'Glass' in Glass Menu with new option 'ShowBkg': the result is like a shadow for the opaque buttons and a texture for transparent buttons.
Title: Re: BGRAControls
Post by: Dibo on September 29, 2011, 09:35:31 pm
Commit changes:

-TBGRAButton - small fix for text align
Title: Re: BGRAControls
Post by: lainz on September 30, 2011, 04:03:55 pm
Commit changes:

- BGRAImageButton fixes and speed optimization.
Title: Re: BGRAControls
Post by: JD on September 30, 2011, 08:39:34 pm
I got 2 errors in the BGRAImageButton.pas file while trying to compile BGRAControls-1.1.0.4 on Linux Mint 11.

Quote
/usr/lib/lazarus/0.9.31/components_extra/bgracontrols/bgraimagebutton.pas(170,12) Error: Incompatible types: got "TBGRACustomBitmap" expected "TBGRAGtkBitmap"
/usr/lib/lazarus/0.9.31/components_extra/bgracontrols/bgraimagebutton.pas(326,12) Error: Incompatible types: got "TBGRACustomBitmap" expected "TBGRAGtkBitmap"

It has to do with the type of the variable TBmp2.
Quote
var
  TBmp, TBmp2: TBGRABitmap;

The error occurred on the following lines

Line 170
Quote
  TBmp2 := TextShadow(Width, Height, Caption, FFont.Height,
    ColorToBGRA(FFont.Color, 255), ColorToBGRA(FShadow.Color, FShadow.Alpha),
    FShadow.OffsetX, FShadow.OffsetY, FShadow.Radius, FFont.Style, FFont.Name);

Line 326
Quote
  TBmp2 := TextShadow(Width, Height, Caption, FFont.Height,
    ColorToBGRA(FFont.Color, 255), ColorToBGRA(FShadow.Color, FShadow.Alpha),
    FShadow.OffsetX, FShadow.OffsetY, FShadow.Radius, FFont.Style, FFont.Name);

JD
Title: Re: BGRAControls
Post by: lainz on September 30, 2011, 09:10:18 pm
That's because BGRABitmap has changed, I've solved that in the git repository of BGRAControls  ;)
Title: Re: BGRAControls
Post by: JD on September 30, 2011, 09:38:31 pm
That's because BGRABitmap has changed, I've solved that in the git repository of BGRAControls  ;)

Can you send the link to the git repository please?
Title: Re: BGRAControls
Post by: lainz on September 30, 2011, 09:57:37 pm
http://sourceforge.net/scm/?type=git&group_id=530771

git://bgracontrols.git.sourceforge.net/gitroot/bgracontrols/bgracontrols
Title: Re: BGRAControls
Post by: JD on September 30, 2011, 10:18:52 pm
http://sourceforge.net/scm/?type=git&group_id=530771

git://bgracontrols.git.sourceforge.net/gitroot/bgracontrols/bgracontrols

This link led me to the same Sourceforge page where I downloaded the buggy zip package: bgracontrols-1.1.0.4.zip! I downloaded it again and tried to install it and the same errors show up.
Title: Re: BGRAControls
Post by: lainz on October 01, 2011, 01:04:55 am
http://sourceforge.net/scm/?type=git&group_id=530771

git://bgracontrols.git.sourceforge.net/gitroot/bgracontrols/bgracontrols

This link led me to the same Sourceforge page where I downloaded the buggy zip package: bgracontrols-1.1.0.4.zip! I downloaded it again and tried to install it and the same errors show up.

I've updated 'Installation' in the Wiki:

http://wiki.lazarus.freepascal.org/BGRAControls#Install
Title: bgracontrols-1.1.0.4 failed to get married with bgrabitmap4.8
Post by: Takeda on October 01, 2011, 08:14:39 am
Yesterday I download bgrabitmap4.8..
I found, bgracontrols-1.1.0.4 failed to get married with bgrabitmap4.8. So sad..

But when I tried to use bgrabitmap4.7.2, it works and successfully to installed..

Regards,
Takeda.
Title: Re: BGRAControls
Post by: circular on October 01, 2011, 08:49:36 am
I got 2 errors in the BGRAImageButton.pas file while trying to compile BGRAControls-1.1.0.4 on Linux Mint 11.

Quote
/usr/lib/lazarus/0.9.31/components_extra/bgracontrols/bgraimagebutton.pas(170,12) Error: Incompatible types: got "TBGRACustomBitmap" expected "TBGRAGtkBitmap"
/usr/lib/lazarus/0.9.31/components_extra/bgracontrols/bgraimagebutton.pas(326,12) Error: Incompatible types: got "TBGRACustomBitmap" expected "TBGRAGtkBitmap"
BGRABitmap has been changed for internal consistency. You can solve this issue by adding "as TBGRABitmap" at the end of the line.

@lainz: you should put a zip file that is compatible with last bgrabitmap zip file, because most people just download zip files.
Title: Re: BGRAControls
Post by: JD on October 01, 2011, 02:12:11 pm
I got 2 errors in the BGRAImageButton.pas file while trying to compile BGRAControls-1.1.0.4 on Linux Mint 11.

Quote
/usr/lib/lazarus/0.9.31/components_extra/bgracontrols/bgraimagebutton.pas(170,12) Error: Incompatible types: got "TBGRACustomBitmap" expected "TBGRAGtkBitmap"
/usr/lib/lazarus/0.9.31/components_extra/bgracontrols/bgraimagebutton.pas(326,12) Error: Incompatible types: got "TBGRACustomBitmap" expected "TBGRAGtkBitmap"
BGRABitmap has been changed for internal consistency. You can solve this issue by adding "as TBGRABitmap" at the end of the line.

@lainz: you should put a zip file that is compatible with last bgrabitmap zip file, because most people just download zip files.

Thanks circular. Casting the operation to "as TBGRABitmap" like you suggested worked perfectly.

JD
Title: Re: BGRAControls
Post by: JD on October 01, 2011, 02:32:16 pm
I've installed it and tested it on Linux Mint 11. The TestBGRAControls demo needs some work. The Flash Player setup example does not work at all. The rest of the examples in the demo either don't work or they crash with an error saying "Error initializing Pixbuf".

Cheers,

JD
Title: Re: BGRAControls
Post by: lainz on October 01, 2011, 06:13:08 pm
I got 2 errors in the BGRAImageButton.pas file while trying to compile BGRAControls-1.1.0.4 on Linux Mint 11.

Quote
/usr/lib/lazarus/0.9.31/components_extra/bgracontrols/bgraimagebutton.pas(170,12) Error: Incompatible types: got "TBGRACustomBitmap" expected "TBGRAGtkBitmap"
/usr/lib/lazarus/0.9.31/components_extra/bgracontrols/bgraimagebutton.pas(326,12) Error: Incompatible types: got "TBGRACustomBitmap" expected "TBGRAGtkBitmap"
BGRABitmap has been changed for internal consistency. You can solve this issue by adding "as TBGRABitmap" at the end of the line.

@lainz: you should put a zip file that is compatible with last bgrabitmap zip file, because most people just download zip files.

Ok.

BGRAControls 1.1.0.5:

-TBGRAButton - small fix for text align.
-BGRAImageButton fixes and speed optimization. Updated bgraimagebutton test project.
-Added Math Game in testbgracontrols.
-Added property 'Tile' in bgraspriteanimation. ToDO: If there is no Sprite loaded and you set 'Tile' to true a division by cero error is shown.
Title: Re: BGRAControls
Post by: lainz on October 01, 2011, 08:19:18 pm
I've installed it and tested it on Linux Mint 11. The TestBGRAControls demo needs some work. The Flash Player setup example does not work at all. The rest of the examples in the demo either don't work or they crash with an error saying "Error initializing Pixbuf".

Cheers,

JD

I've noticed the same problem some time ago with Ubuntu 11.04.

You can delete the BGRAImageButton and BGRAButtons from the Flash Player Setup example and test it again?

If doesn't works try change this line of code:

Code: [Select]
procedure TfrmMain.btnGoFlashPlayerSetupClick(Sender: TObject);
begin
  frmFlashPlayerSetup.ShowModal;
end;   

Code: [Select]
procedure TfrmMain.btnGoFlashPlayerSetupClick(Sender: TObject);
begin
  frmFlashPlayerSetup.Show;
end;   

Also Dibo noticed that:

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.
Title: Re: BGRAControls
Post by: Sternas Stefanos on October 01, 2011, 09:10:13 pm
We solve "Error initializing Pixbuf" on Linux and FreeBSD (CT Ver 2.20)

Unit BGRAImageManipulation
procedure TBGRAImageManipulation.Paint;
begin 
   inherited Paint;
  {$IFDEF WINDOWS}   // 9999 for CodeTyphon
    fVirtualScreen.Draw(Canvas, 0, 0, true);
  {$ELSE}
    fVirtualScreen.Draw(Canvas, 0, 0, false);
  {$ENDIF}
end;

Units: BGRAVirtualScreen and BGRAPanel

procedure xxxxx.Paint;
.....
  {$IFDEF WINDOWS}   // 9999 for CodeTyphon
    FBGRA.Draw(Canvas,0,0,true);
  {$ELSE}
    FBGRA.Draw(Canvas,0,0,false);
  {$ENDIF}
....

Title: Re: BGRAControls
Post by: circular on October 01, 2011, 09:16:20 pm
Thanks !

So apparently, there is a problem when drawing opaque on Linux ?
Title: Re: BGRAControls
Post by: JD on October 01, 2011, 09:23:19 pm
Thanks !

So apparently, there is a problem when drawing opaque on Linux ?

Yes I can confirm that.
Title: Re: BGRAControls
Post by: circular on October 01, 2011, 09:31:52 pm
Maybe mixing gdk_draw_rgb_32_image and gdk_pixbuf_new_from_data makes gdk go crazy.
Title: Re: BGRAControls
Post by: Sternas Stefanos on October 01, 2011, 09:32:55 pm
Thanks !

So apparently, there is a problem when drawing opaque on Linux ?

Yes,
oh and Graphics32 library has the same problem...
We test 10 Linux and 2 FreeBSD distributions
Title: Re: BGRAControls
Post by: circular on October 01, 2011, 09:45:24 pm
Maybe I have an idea...

Does this version (attached) solve the problem ?
Title: Re: BGRAControls
Post by: Sternas Stefanos on October 01, 2011, 09:51:36 pm
No,  Error 'External: SIGFPE'.
(quick test on Debian 64)
Title: Re: BGRAControls
Post by: circular on October 02, 2011, 01:48:47 am
Thanks. I guess I made an error.

Well I really need to get some Linux working...
Title: Re: BGRAControls
Post by: fabienwang on October 02, 2011, 08:45:29 am
Thanks. I guess I made an error.

Well I really need to get some Linux working...
use Virtualbox if you're lazy ;)
Title: Re: BGRAControls
Post by: lainz on October 02, 2011, 10:56:15 am
If you have at least 20gb free install ubuntu and you can switch from windows to ubuntu without any problem.
Title: Re: BGRAControls
Post by: circular on October 02, 2011, 08:52:08 pm
Well I managed to install Ubuntu on Oracle VirtualBox. Thanks.
Title: Re: BGRAControls
Post by: CaptBill on October 02, 2011, 09:24:52 pm
If you just need to boot a linux system to test compiled code you should check out Tinycore. There is no install process like with other distros. Just point VirtualBox at the ISO and it boots preconfigured. No long install process. The whole os loads to ram from 2 files totaling @10mb. Super fast. Much faster than Debian or Ubuntu.

Here is the Tinycore  @11mb with the basic window manager Flwm (you can install all the others KDE Gnome E17 etc)
http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/tinycore_4.0.iso (http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/tinycore_4.0.iso)

Or the full download with all the options/configs called Multicore  @46mb
http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/multicore_4.0.iso (http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/multicore_4.0.iso)

Title: Re: BGRAControls
Post by: circular on October 02, 2011, 09:26:19 pm
Hello people,

I think I solved the pixbuf error. In fact, the pointer was of course nil when bitmap size was zero. New version of BGRABitmap library is on subversion. Can someone confirm the bug is solved ?
Title: Re: BGRAControls
Post by: Sternas Stefanos on October 02, 2011, 09:56:29 pm
No, the problem exists
(Debian64 and Fedora32)
Title: Re: BGRAControls
Post by: circular on October 02, 2011, 09:59:54 pm
Ok.  ;)

Thanks !

Here is the zip file of the fixed version (BGRABitmap 4.9.2) :
https://sourceforge.net/projects/lazpaint/files/src/
Title: Re: BGRAControls
Post by: lainz on October 03, 2011, 12:21:42 am
Nice.

Commit changes:

I've updated again BGRAImageButton to improve speed. Now bitmap and text is only redrawn when is neccesary. The only thing left is this
http://lazarus.freepascal.org/index.php/topic,14836.msg79000/topicseen.html#new
Title: Re: BGRAControls
Post by: avra on October 03, 2011, 09:47:48 am
Thanks. I guess I made an error.

Well I really need to get some Linux working...
use Virtualbox if you're lazy ;)

There is also Portable Ubuntu Remix distribution that you start directly from windows. It's strange when you see Firefox widows both Linux and Windows versions side by side, or Linux terminal that has native Windows application look, but it works well.
http://sourceforge.net/projects/portableubuntu/files/portableubuntu/Version_4

Alternative Ubuntu portable distribution is here:
http://www.andlinux.org

People who prefer Slackware over Ubuntu can try this:
http://www.topologilinux.com
Title: Re: BGRAControls
Post by: fabienwang on October 03, 2011, 09:55:57 am
Thanks. I guess I made an error.

Well I really need to get some Linux working...
use Virtualbox if you're lazy ;)

There is also Portable Ubuntu Remix distribution that you start directly from windows. It's strange when you see Firefox widows both Linux and Windows versions side by side, or Linux terminal that has native Windows application look, but it works well.
http://sourceforge.net/projects/portableubuntu/files/portableubuntu/Version_4

Alternative Ubuntu portable distribution is here:
http://www.andlinux.org

People who prefer Slackware over Ubuntu can try this:
http://www.topologilinux.com

Woow nice one, i didnt know about it.
I remember i tested once Windows Services for UNIX and also cygwin,
but this failed with X (no graphic). Thanks for the tip
Title: Re: BGRAControls
Post by: circular on October 03, 2011, 12:25:38 pm
It's so big (1.5GB) but I'll give it a try.

EDIT : I doesn't work for me. But anyway I've got Linux on a VM.
Title: Re: BGRAControls
Post by: lainz on October 06, 2011, 12:53:08 am
I've updated BGRAControls to 1.1.0.7

https://sourceforge.net/projects/bgracontrols/files/

- BGRAImageButton full speed optimization, you may notice it resizing buttons and simply using it.
- BGRAImageToggleBox: removed. Reason: it doesn't work anymore because all the changes in BGRAImageButton. BTW never worked as a real toggle. Is available if you want it in BGRAControls 1.1.0.6 or older.
- BGRAImageButton, BGRASpriteAnimation & BGRALabelFX: removed usage of 'AutoSize'. Reason: is not right implemented. Need to be implemented overriding 'PreferredSize' (Like in BGRAButton). BTW the property AutoSize was not deleted to prevent error messages if you already are using those controls.
- BGRATextEffectTypes now call
Code: [Select]
FOwner.Perform(CM_FONTCHANGED, 0, 0);
FOwner.Invalidate;
It improves the usage of the Object Inspector in BGRAImageButton 'Shadow' property and LabelFx 'Outline'. Also you can use this unit if you want to add shadow or outline property in your own text-based component.
Title: Re: BGRAControls
Post by: lainz on October 07, 2011, 11:02:48 pm
I've commited changes in git repository:

- BGRAImageButton: new property 'Checked'. It's usefull to create menus based in BGRAImageButton. See image attached.
- BGRAImageButton: new property 'Sound'. If Sound is set to true, when mouse enter 'SoundEnter' will be played, when you click 'SoundClick' will be played. Currently works only under Windows.

Please test :)
Title: Re: BGRAControls
Post by: circular on October 08, 2011, 02:59:13 pm
Works fine for me !  8)
Title: Re: BGRAControls
Post by: lainz on October 08, 2011, 04:12:10 pm
Works fine for me !  8)

 ;)

I've found a memory leak using BGRA.Resample.

I don't know how to solve it. You can update and test it again? This time maximize the form.

Edit: the problem is the Resample Mode. When using simple stretch there is no memory leak.
Title: Re: BGRAControls
Post by: circular on October 09, 2011, 03:11:37 am
I don't understand what to test. I've tested with LazPaint in debug mode, and after resample, there was no memory leak.

EDIT: Ok, I found what you are talking about.
Title: Re: BGRAControls
Post by: lainz on October 15, 2011, 06:18:40 pm
Commit changes:
- Added ModalResult in TBGRAImageButton. DoButtonDown / DoPlaySound only if mouse = mbLeft.
Title: Re: BGRAControls
Post by: Hydexon on October 18, 2011, 07:53:29 pm
If possible to put Glyph Layout property in BGRAButton?, i need this feature for a project thats i developing
Title: Re: BGRAControls
Post by: fabienwang on October 18, 2011, 08:25:06 pm
If possible to put Glyph Layout property in BGRAButton?, i need this feature for a project thats i developing
better usr TBGRAImageButton, it's more adapted for your need.
Title: Re: BGRAControls
Post by: circular on October 18, 2011, 10:58:46 pm
Well, there is already a glyph property, so why not a layout ?

Hydexon, can you try to add this property by yourself using lastest version from subversion ? When you're done, just post it here and someone will update it.
Title: Re: BGRAControls
Post by: Hydexon on October 20, 2011, 11:14:04 pm
Well, i can do it, but i don't know if can affect the gradient drawings, i not very good in the graphics manipulation..., my code to put glyph layouts are based in the SpeedButton.
Title: Re: BGRAControls
Post by: lainz on October 21, 2011, 07:16:31 pm
Quote
Well, i can do it, but i don't know if can affect the gradient drawings, i not very good in the graphics manipulation..., my code to put glyph layouts are based in the SpeedButton.

Ok try it.

I've released bgracontrols 1.1.0.8, another 'build number' increase (i'm not good assigning the version numbers).

Download:
https://sourceforge.net/projects/bgracontrols/files/?

TBGRAImageButton:
- Added Sound (at this moment is not portable - Windows only).
- Added ModalResult property.
- Added Toggle property.
- Added Checked property.
- Added other properties (most used in TButton, some curretly doesn't works like BiDi mode).
- TBGRAImageButton is now descendant of TCustomBGRAImageButton, so you now can create custom image buttons overriding the functions you need and publish only the properties you want.
- Other fixes.

Other:
- Added 'Accent color image button' (Metro UI with TBGRAImageButton) in testbgracontrols project.

Patches and new components, examples, ideas & criticism are welcome.
Title: Re: BGRAControls
Post by: lainz on October 24, 2011, 02:20:27 am
Commit changes:

- Added 'TextCanvas' in TBGRAButton. This allow to use TBGRABitmap.CanvasBGRA.TextRect instead TBGRABitmap.TextOut to have a closer look to the OS fonts ( it needs ClearType , some help ? ) if you choose this the Shadow will not be applied.
- Improved Windows 7 ToolBar example.
Title: Re: BGRAControls
Post by: lainz on October 25, 2011, 08:29:59 pm
Commit changes:

- Added BGRASamples (Is the old known ubgrasamples. Now is part of the library instead as part of a test project).
- Added TBGRAWin7ToolBar (isn't TToolBar descendant. Reason: TToolBar has flickering with themes disabled, also using DoubleBuffered  :(, so at this moment is TBGRAVirtualScreen descendant).
Title: Re: BGRAControls
Post by: circular on October 26, 2011, 02:59:38 am
BGRASamples can be useful to help with BGRAControls.  :)

I'm wondering about using BGRAControls in LazPaint. This would add a dependency so I think this would be reasonable only if there is a real difference.
Title: Re: BGRAControls
Post by: lainz on October 28, 2011, 04:44:55 am
BGRASamples can be useful to help with BGRAControls.  :)

I'm wondering about using BGRAControls in LazPaint. This would add a dependency so I think this would be reasonable only if there is a real difference.

Well now that BGRABitmap has full ClearType support I can say that is usefull to design custom buttons with BGRAButton that will look fine in most OS's that has ClearType support =)

BTW BGRAButton need some improvements, for example try to change from the object inspector the property 'Enabled'. You need to move the button to see the change.

Also you need more controls to use in LazPaint, like ComboBox, a real TToolBar, TTrackBar..

look of the current situation of some bgracontrols:

BGRALabel: well this really need to be coded again, or something because has a lot of code that I'm wondering if is used or something..
SpriteAnimation: the code isn't optimized, so it is really slow.

We need more developers =)
Title: Re: BGRAControls
Post by: felipemdc on October 28, 2011, 06:37:11 am
We need more developers =)

Aren't we just writing the same thing?

http://wiki.lazarus.freepascal.org/Lazarus_Custom_Drawn_Controls

I could use more developers in the Custom Drawn Controls too ;)

Note that Custom Drawn Controls is not just a package, I want to add it inside the LCL and use it as a major building block for a new custom drawn widgeset.

I think that we are all writing the same thing, but our architecture is totally different. BGRAControls and BGRABitmap fix the performance and reliability problem by building on top of the LCL. I want to fix the problem inside the LCL by introducing a new custom drawn widgetset. It will have its own non-native Canvas which should be very fast if correctly optimized, so then TCanvas would go back to being a major development tool instead of each person going to a different secondary library because of problems with the current TCanvas. Of course TCanvas would still lack all kinds of special drawing routines, but those could be implemented as a TFPCustomCanvas descendent which would connect with the inner TLazIntfImage of TCanvas, or with a generated TLazIntfImage for existing widgetsets (I could add something like TCanvas.GetLazIntfImage).

I agree that my approach is totally different from BGRABitmap, so I wouldn't try to convince circular to drop it and work with me, but in this case, lainz, I think we are writing 100% the same thing. By joining efforts we could gain a lot!

Well now that BGRABitmap has full ClearType support I can say that is usefull to design custom buttons with BGRAButton that will look fine in most OS's that has ClearType support =)

How does BGRABitmap implement it's font support? I also need font support in the new customdrawn widgetset =)
Title: Re: BGRAControls
Post by: lainz on October 28, 2011, 03:25:00 pm
Well we're doing the same in a different way. I'm a user of BGRABitmap, I know how to use it but really don't understand how it works inside.

See here:
http://wiki.lazarus.freepascal.org/BGRAControls

I've done only 'BGRAImageButton' / 'BGRASpriteAnimation' / 'BGRALabelFX' (using the bgrabitmap labelfx unit) the hard works was done by others =)

But if I can I will contribute something.

Maybe circular is interested, he know about graphics programming.
Title: Re: BGRAControls
Post by: circular on October 28, 2011, 07:28:29 pm
I agree that my approach is totally different from BGRABitmap, so I wouldn't try to convince circular to drop it and work with me, but in this case, lainz, I think we are writing 100% the same thing. By joining efforts we could gain a lot!
Well I don't really understand what you are doing, but if you need to use routines from BGRABitmap, that's not a problem. You can cut'n'paste whatever you want and only change the direct pixel access part.

EDIT: I've look at customdrawn directory, now I understand. You are right we are doing quite the same thing. I think it would be possible to adapt some BGRABitmap algorithm to use it with FPCanvas. In fact, I noticed that some functions are not implemented in FPCanvas, but to be free to develop I've done my library aside. Moreover I'm working with LCL while the FreePascal team want pure console app.

Quote
Well now that BGRABitmap has full ClearType support I can say that is usefull to design custom buttons with BGRAButton that will look fine in most OS's that has ClearType support =)

How does BGRABitmap implement it's font support? I also need font support in the new customdrawn widgetset =)
In fact my ClearType implementation does not need that the OS has ClearType support. I've done it myself at the pixel level.

About font support, currently BGRABitmap uses internally a TBitmap and the standard Canvas.TextOut function. That's why it's not fast. It would be faster to render directly from TTF files, but it's more complicated to do of course.
Title: Re: BGRAControls
Post by: lainz on October 30, 2011, 01:54:33 pm
Code: [Select]
You can cut'n'paste whatever you want...
The same apply for BGRAControls, is LGPL.

Commit changes:
- I've fixed the math game in testbgracontrols, now with no duplicate numbers in options.
Title: Re: BGRAControls
Post by: lainz on November 01, 2011, 06:21:10 pm
Download BGRAControls-1.1.0.9
https://sourceforge.net/projects/bgracontrols/files/

- Added 'TBGRAWin7ToolBar'. Is a TBGRAVirtualScreen with some default child sizing, and nice Win7 ToolBar background.
- Improved Windows 7 ToolBar example.
- Added 'TextCanvas' in TBGRAButton. Enable to use a ClearType filter in fonts (requires latest version of BGRABitmap).
- Small fixes.
Title: Re: BGRAControls
Post by: Dibo on November 01, 2011, 07:09:29 pm
I agree with felipemdc. Some time ago I found accidentally "Lazarus Custom Drawn Controls". The first thing that came to my mind was "Hey, this is similar to what we do". Reason is simple: Initially, I created this package only as patch for GTK alpha (only two components - TBGRAImageList and TBGRASpeedButton) and then I created some fancy button control which was to demonstrate power of BGRA Bitmap package. This triggered a wave of amazing components created by the Lazarus community.
Idea of "Lazarus Custom Drawn Controls" and "BGRA Controls" is same - nice looking controls which look same on all platforms. BGRA Bitmap is our graver but I think, BGRA Controls package need now some generic class, tools, etc. for creating graphic user controls (especialy for "edit" like controls) which LCDC could have. Maybe those packages could be merged?
Title: Re: BGRAControls
Post by: circular on November 01, 2011, 08:01:32 pm
@lainz:
TextCanvas does not use ClearType. In fact, you need to specify fqFineClearTypeRGB for example. You can use it outside the CanvasBGRA too.

If you want to have the same ClearType as with the standard canvas, then it's not possible yet, but I can add it, so there will be the following qualities :
- fqSystem (without clearType)
- fqSystemClearType (the new one, with ClearType like the canvas renders it)
- fqFineAntialiasing (without ClearType)
- fqFineClearTypeRGB and BGR (with ClearType and fine antialiasing)

@Dibo:
Under this question is the merger of BGRABitmap and FPImage, which cannot be solved because BGRABitmap is deeply linked to TBitmap. In my view, it is possible to copy parts of BGRABitmap to integrate it into FPImage, to add missing functions and new functions. But the dependency to BGRABitmap will still be there.

So, in fact, the merger would be to put existing LCDC controls and BGRA Controls in the same package. This would mean that this package would require BGRABitmap.
Title: Re: BGRAControls
Post by: lainz on November 02, 2011, 03:35:35 am
Finally I can acces the forum, was a recurrent browser problem. Error 324 (net::ERR_EMPTY_RESPONSE).

@Circular

Understood.

If you can do the new fqSystemClearType, when the font height is 0 get the default system font size (like all components in Lazarus).
Title: Re: BGRAControls
Post by: circular on November 02, 2011, 08:01:23 pm
Ok. Default height would apply to fqSystem too.
Title: Re: BGRAControls
Post by: SONFEDAI on November 05, 2011, 10:43:27 pm
Can i change BGRAButton Glyph Position like TBGRASpeedButton.Layout?
Title: Re: BGRAControls
Post by: Dibo on November 06, 2011, 11:18:59 am
Currently not, but thanks for suggestion
Title: Re: BGRAControls
Post by: circular on November 06, 2011, 01:29:10 pm
fqSystemClearType is in BGRABitmap 5.2.

I suggest that the button renders the text like this :
- without TextCanvas, with fqFineAntialising or fqFineClearTypeRGB
- with TextCanvas, with fqSystem or fqSystemClearType

You can add a TextClearType property to choose which one to use.
Title: Re: BGRAControls
Post by: lainz on November 06, 2011, 03:11:37 pm
@Circular

Thankyou, I've commited the changes in bgrabutton.

@Dibo

There is a bug in bgrabutton, when you change 'Enabled' property the button isn't changed, only when you move it in the form.
Title: Re: BGRAControls
Post by: lainz on November 07, 2011, 01:36:45 am
Commit changes:

- Changed BGRASamples buttons to use 'TextCanvas'.
- Fixed AutoSize in BGRAButton using TextCanvas. Changes in bgrawin7toolbar.
- StyleButtons in bgrasamples: now it saves the glyph, button style, down and staticbutton.
Title: Re: BGRAControls
Post by: SONFEDAI on November 07, 2011, 12:58:22 pm
Currently not, but thanks for suggestion
No problem.

I'm testing BGRAControls on Windows CE

But it's too slow...

Is it correct or have my code a problem?

Title: Re: BGRAControls
Post by: circular on November 07, 2011, 02:23:42 pm
Maybe it's because BGRABitmap is not optimized yet for Windows CE.
Title: Re: BGRAControls
Post by: SONFEDAI on November 07, 2011, 07:19:28 pm
The Problem is For Windows CE these Lines in BGRABitmapTypes.Pas (1168. Line)
Quote
procedure InitGamma;
var
  i: integer;
begin
  //the linear factor is used to normalize expanded values in the range 0..65535
  GammaLinearFactor := 65535 / power(255, GammaExpFactor);
  for i := 0 to 255 do
    GammaExpansionTab := round(power(i, GammaExpFactor) * GammaLinearFactor);

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


  GammaExpansionTab[1]   := 1; //to avoid information loss
  GammaCompressionTab[1] := 1;
end;     
Title: Re: BGRAControls
Post by: lainz on November 08, 2011, 07:26:42 pm
@Dibo

Some suggestions for BGRAButton:

- AutoSize: drop down menu isn't calculated. When all shadow values are 0 the text is very near the edges of the button, there is no space between the border as in TButton. When textshadow is false the shadow is calculated anyway. You can see those in 'Win7 ToolBar' test in 'testbgracontrols'.

- Enabled: when I change the property the button isn't updated, only when I move it around in the object inspector.
Title: Re: BGRAControls
Post by: circular on November 08, 2011, 07:50:19 pm
@SONEFEDAI:

You mean these lines take to much time to run ? And afterwards, it's fast enough ?
Title: Re: BGRAControls
Post by: SONFEDAI 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
Title: Re: BGRAControls
Post by: circular 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 ?
Title: Re: BGRAControls
Post by: SONFEDAI on November 08, 2011, 11:39:17 pm
Does it solve the slowness ?
Thanks

Yes solve the problem...

Thanks again
Title: Re: BGRAControls
Post by: circular on November 09, 2011, 04:01:45 pm
Ok. I've updated the code on subversion.
Title: Re: BGRAControls
Post by: lainz 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.
Title: Re: BGRAControls
Post by: circular 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.
Title: Re: BGRAControls
Post by: SONFEDAI on November 10, 2011, 10:36:46 pm
Is it possible Graphic Position Layout?
Title: Re: BGRAControls
Post by: lainz 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.
Title: Re: BGRAControls
Post by: SONFEDAI 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?
Title: Re: BGRAControls
Post by: lainz 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 =)
Title: Re: BGRAControls
Post by: lainz 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.
Title: Re: BGRAControls
Post by: SONFEDAI on November 13, 2011, 12:49:02 pm
Where is the new sources?
Title: Re: BGRAControls
Post by: lainz on November 13, 2011, 03:26:16 pm
Where is the new sources?

In the BGRAControls git repo.
Title: Re: BGRAControls
Post by: circular 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.
Title: Re: BGRAControls
Post by: lainz 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..
Title: Re: BGRAControls
Post by: Tankard on November 16, 2011, 04:07:53 pm
hi,

would it be possible to add the following property to the pulished list?

property Action;

because i hate it to add it all the time i check out a new version. I like to use TAction in my programs. At least to the Label and the button components.

thanks.

greetings
tankard
Title: Re: BGRAControls
Post by: Tankard on November 16, 2011, 06:02:43 pm
if you are using fpc 2.7.1 (64bit version of the compiler) you will get an error compiling the bgrabitmap library.

Error: Can't determine which overloaded function to call
there are two getPixel functions and the compiler doesn't know which function it has to call.


example line 209:
          c2 := bmp.GetPixel(xb + 1, yb + 1);

writing it like:

          c2 := bmp.GetPixel(Integer(xb + 1), Integer(yb + 1));

will do the trick.

added the patch below. i used svn version 341. please also add to the svn. thanks.

Index: bgrafilters.pas
===================================================================
--- bgrafilters.pas   (revision 341)
+++ bgrafilters.pas   (working copy)
@@ -206,11 +206,11 @@
         if diag1.cd < 0.3 then
         begin
           c1 := bmp.GetPixel(xb, yb);
-          c2 := bmp.GetPixel(xb + 1, yb + 1);
+          c2 := bmp.GetPixel(Integer(xb + 1), Integer(yb + 1));
           c := MergeBGRA(c1, c2);
           //restore
           Result.SetPixel(xb * 3 + 2, yb * 3 + 2, bmp.GetPixel(xb, yb));
-          Result.SetPixel(xb * 3 + 3, yb * 3 + 3, bmp.GetPixel(xb + 1, yb + 1));
+          Result.SetPixel(xb * 3 + 3, yb * 3 + 3, bmp.GetPixel(Integer(xb + 1),Integer(yb + 1)));
 
           if (diag1.sd < h1.sd) and (diag1.sd < v2.sd) then
             Result.SetPixel(xb * 3 + 3, yb * 3 + 2, c);
@@ -282,7 +282,7 @@
         for dx := -1 to 1 do
           if (dx <> 0) or (dy <> 0) then
           begin
-            a_pixels[n] := bmp.GetPixel(xb + dx, yb + dy);
+            a_pixels[n] := bmp.GetPixel(Integer(xb + dx),Integer(yb + dy));
             Inc(n);
           end;
 
@@ -707,10 +707,10 @@
     for xb := bounds.Left to bounds.Right - 1 do
     begin
       c[0] := bmp.getPixel(xb, yb);
-      c[1] := bmp.getPixel(xb + idx1, yb + idy1);
-      c[2] := bmp.getPixel(xb + idx2, yb + idy2);
-      c[3] := bmp.getPixel(xb + idx3, yb + idy3);
-      c[4] := bmp.getPixel(xb + idx4, yb + idy4);
+      c[1] := bmp.getPixel(Integer(xb + idx1), Integer(yb + idy1));
+      c[2] := bmp.getPixel(Integer(xb + idx2), Integer(yb + idy2));
+      c[3] := bmp.getPixel(Integer(xb + idx3), Integer(yb + idy3));
+      c[4] := bmp.getPixel(Integer(xb + idx4), Integer(yb + idy4));
 
       sumR   := 0;
       sumG   := 0;
@@ -1455,7 +1455,7 @@
       for dy := -1 to 1 do
         for dx := -1 to 1 do
         begin
-          a_pixels[n] := bmp.GetPixel(xb + dx, yb + dy);
+          a_pixels[n] := bmp.GetPixel(Integer(xb + dx), Integer(yb + dy));
           if a_pixels[n].alpha = 0 then
             a_pixels[n] := BGRAPixelTransparent;
           Inc(n);
Title: Re: BGRAControls
Post by: lainz on November 16, 2011, 07:13:17 pm
if you are using fpc 2.7.1 (64bit version of the compiler) you will get an error compiling the bgrabitmap library.

Error: Can't determine which overloaded function to call
there are two getPixel functions and the compiler doesn't know which function it has to call.


example line 209:
          c2 := bmp.GetPixel(xb + 1, yb + 1);

writing it like:

          c2 := bmp.GetPixel(Integer(xb + 1), Integer(yb + 1));

will do the trick.

added the patch below. i used svn version 341. please also add to the svn. thanks.

Index: bgrafilters.pas
===================================================================
--- bgrafilters.pas   (revision 341)
+++ bgrafilters.pas   (working copy)
@@ -206,11 +206,11 @@
         if diag1.cd < 0.3 then
         begin
           c1 := bmp.GetPixel(xb, yb);
-          c2 := bmp.GetPixel(xb + 1, yb + 1);
+          c2 := bmp.GetPixel(Integer(xb + 1), Integer(yb + 1));
           c := MergeBGRA(c1, c2);
           //restore
           Result.SetPixel(xb * 3 + 2, yb * 3 + 2, bmp.GetPixel(xb, yb));
-          Result.SetPixel(xb * 3 + 3, yb * 3 + 3, bmp.GetPixel(xb + 1, yb + 1));
+          Result.SetPixel(xb * 3 + 3, yb * 3 + 3, bmp.GetPixel(Integer(xb + 1),Integer(yb + 1)));
 
           if (diag1.sd < h1.sd) and (diag1.sd < v2.sd) then
             Result.SetPixel(xb * 3 + 3, yb * 3 + 2, c);
@@ -282,7 +282,7 @@
         for dx := -1 to 1 do
           if (dx <> 0) or (dy <> 0) then
           begin
-            a_pixels[n] := bmp.GetPixel(xb + dx, yb + dy);
+            a_pixels[n] := bmp.GetPixel(Integer(xb + dx),Integer(yb + dy));
             Inc(n);
           end;
 
@@ -707,10 +707,10 @@
     for xb := bounds.Left to bounds.Right - 1 do
     begin
       c[0] := bmp.getPixel(xb, yb);
-      c[1] := bmp.getPixel(xb + idx1, yb + idy1);
-      c[2] := bmp.getPixel(xb + idx2, yb + idy2);
-      c[3] := bmp.getPixel(xb + idx3, yb + idy3);
-      c[4] := bmp.getPixel(xb + idx4, yb + idy4);
+      c[1] := bmp.getPixel(Integer(xb + idx1), Integer(yb + idy1));
+      c[2] := bmp.getPixel(Integer(xb + idx2), Integer(yb + idy2));
+      c[3] := bmp.getPixel(Integer(xb + idx3), Integer(yb + idy3));
+      c[4] := bmp.getPixel(Integer(xb + idx4), Integer(yb + idy4));
 
       sumR   := 0;
       sumG   := 0;
@@ -1455,7 +1455,7 @@
       for dy := -1 to 1 do
         for dx := -1 to 1 do
         begin
-          a_pixels[n] := bmp.GetPixel(xb + dx, yb + dy);
+          a_pixels[n] := bmp.GetPixel(Integer(xb + dx), Integer(yb + dy));
           if a_pixels[n].alpha = 0 then
             a_pixels[n] := BGRAPixelTransparent;
           Inc(n);

Send that patch to circular, that is BGRABitmap not BGRAControls.

hi,

would it be possible to add the following property to the pulished list?

property Action;

because i hate it to add it all the time i check out a new version. I like to use TAction in my programs. At least to the Label and the button components.

thanks.

greetings
tankard

Ok I will add it.
Title: Re: BGRAControls
Post by: lainz on November 16, 2011, 11:25:46 pm
BGRAControls git repository changes:

- Added 'Action' for BGRAButton, BGRALabel, BGRALabelFX.
- Updated BGRAImageButton test now with Facebook buttons.

I've uploaded new / updated / images and text in the BGRAControls wiki article:
http://wiki.lazarus.freepascal.org/BGRAControls

@ codedeep

You can fix your BGRALabel?

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.

Also inside it has some code that is used only by BGRAButton.
Title: Re: BGRAControls
Post by: lainz on November 18, 2011, 09:13:07 pm
Commit Changes:

- Now autosize is perfect also under different dpi settings (to do this the scaling of the size variables is commented OnCreate event of TBGRAButton). BTW if you need to scale those variables see Win7ToolBar example in testbgracontrols.

- MetroUI for BGRAButton looks the same as MetroUI for BGRAImageButton in testbgracontrols.

Title: Re: BGRAControls
Post by: lainz on November 20, 2011, 07:58:04 pm
Commit changes:

- Added new procedure 'DrawButton' in bgrasamples. It allow you to quick draw a double linear gradient button with rounded / squared / bevel borders and inner light.
Title: Re: BGRAControls
Post by: lainz on November 22, 2011, 04:54:20 pm
Added new property BorderStyle in BGRAButton.

Added LightColor in BGRAButton's TBody.

To use this new feature you need to use BGRABitmap latest SVN.
Title: Re: BGRAControls
Post by: lainz on November 23, 2011, 04:32:50 pm
BGRAControls 1.2.0.3
https://sourceforge.net/projects/bgracontrols/files/?

BGRAButton: (see image attached)
- Added BorderStyle: now you can chose betwen bsRound, bsBevel and bsSquare.
- Added BorderStyleDropDown: the same as BorderStyle for the DropDown area.
- Added FlipArrow option: this changes the arrow graphic direction (up if enabled) and the Popup point of the PopupMenu.
- Improved PopupMenu point, now is down the DropDownButton.
- Added 'Action' property.
- Added 'LightColor' in TBody.

BGRASamples:
- Added iOS Elements, FacebookButton, FacebookImageButton, DrawButton, etc..
- Now 'Metro UI' example looks the same as 'Nice Buttons'.

Other:
- Added 'Action' property in some other components.

Win7ToolBar and BGRAButton aren't using dpi scaling (to get perfect AutoSize in standar buttons, dpi scaling of the size variables is usefull in toolbars), you can change the scale if you need it with the procedure 'SetSizeVariables' in BGRAButton (look at Win7ToolBar example).
Title: Re: BGRAControls
Post by: circular on November 24, 2011, 11:59:37 am
Thanks Lainz, these buttons look great.  :)

Here is another example :
Set RoundX and RoundY = 10
Set BorderStyle BottomRight and TopLeft = bsSquare
Set BodyNormal Font Color = clBlack
Set BodyNormal Gradient1 Point1YPercent = 100 and Point2YPercent = 0
Set BodyNormal Gradient2 Point1XPercent = 103, Point1YPercent = 100, Point2XPercent = 100, Point2YPercent = 0
Title: Re: BGRAControls
Post by: lainz on November 24, 2011, 10:13:43 pm
Thanks Lainz, these buttons look great.  :)

Here is another example :
Set RoundX and RoundY = 10
Set BorderStyle BottomRight and TopLeft = bsSquare
Set BodyNormal Font Color = clBlack
Set BodyNormal Gradient1 Point1YPercent = 100 and Point2YPercent = 0
Set BodyNormal Gradient2 Point1XPercent = 103, Point1YPercent = 100, Point2XPercent = 100, Point2YPercent = 0

=) Thanks to you for create BGRABitmap.

Commit Changes:
- Now TBGRAImageButton has AutoSize working.
Title: Re: BGRAControls
Post by: Gintas on November 24, 2011, 10:25:32 pm
Totally kick ass updates! The new buttons drawing feature will allow easily create buttons for
web pages. I was making own web buttons maker from simple gradient and rect shape functions,but now I need
to download the latest BGRAControls version for sure.
Title: Re: BGRAControls
Post by: fredycc on November 25, 2011, 12:18:42 am
Amazing job guys, thanks

Regards.
Title: Re: BGRAControls
Post by: lainz on November 28, 2011, 08:49:39 pm
BGRAControls 1.2.0.4:
https://sourceforge.net/projects/bgracontrols/files/

- Now TBGRAImageButton has AutoSize working.
- Better AutoSize algorithm in TBGRAButton for text with Shadow: now if you have shadow offset with negative integer works fine.
- Added 'AutoSize' in bgralabelfx. Only works with positive shadow offset values (i can't understand how to fix the negative values..)
- Added 'BitmapLoadFromFile' in TBGRAImageButton to allow load .png and other filetypes (it loads the file to a temp TBGRABitmap and then assign to 'Bitmap' property).
- Added 'TextVisible' property in TBGRAImageButton. Usefull if your ImageButton need only images, it saves time because also internally the text isn't updated.
- Added new styles in BGRASamples and TBGRAWin7ToolBar.

Enjoy.

PD: I'm moving me to CustomDrawn controls. Because that has more controls and they will be the Custom Drawn Widgetset.
http://lazarus.freepascal.org/index.php/topic,15209.msg82432/topicseen.html
Title: Re: BGRAControls
Post by: lainz on November 30, 2011, 10:35:21 pm
I'm back  ;)

I can't resist to use BGRABitmap. Commit changes:

Now with TBGRAImageButton you can use 'BitmapOptions' to tell the button the border Width, border Height and other options to get a better result. In the image you can see in the left with bitmapoptions disabled, at the right enabled-

See image attached (screenshot of bgraimagebuttontest2).

The Windows 7 button has 'BitmapOptions.ResampleMode := rmSimpleStretch' and border width and height := 5.
The other button has 'BitmapOptions.ResampleMode := rmFineResample' and border width and height := 2.

This has some bugs but you can try it.
Title: Re: BGRAControls
Post by: lainz on December 01, 2011, 01:50:50 pm
BGRAControls 1.2.0.5
https://sourceforge.net/projects/bgracontrols/files/?

- Added TBGRAImageButton.BitmapOptions.

Now with TBGRAImageButton you can use 'BitmapOptions' to tell the button the border Width, border Height and other options to get a better result and you can create 'textured' Image Buttons. See images attached.

BitmapOptions.Enable := True;
BitmapOptions.FillCenter := True; 
BitmapOptions.BorderWidth := 2;
BitmapOptions.BorderHeight := 2;
Title: Re: BGRAControls
Post by: circular on December 01, 2011, 10:00:56 pm
I've downloaded lastest version of BGRAControls, but it does not seem to work. When bitmap option is not enabled, the image is clipped, and when bitmap option is enabled, it repeats pixels strangely.
Title: Re: BGRAControls
Post by: lainz on December 02, 2011, 12:33:51 am
I've downloaded lastest version of BGRAControls, but it does not seem to work. When bitmap option is not enabled, the image is clipped, and when bitmap option is enabled, it repeats pixels strangely.

You can give me that image?

The image must have 4 states: normal, enter, pressed and disabled, all of the same height and width (this is also for normal ImageButton).

The border is inside the image, you must specify only the width and height of the border in the image.

Try with the attached image:

BorderWidth := 5; BorderHeight:=5;

Or try with the image in this post
http://lazarus.freepascal.org/index.php/topic,12411.msg82590.html#msg82590

BitmapOptions.Enable := True;
BitmapOptions.FillCenter := True; 
BitmapOptions.BorderWidth := 2;
BitmapOptions.BorderHeight := 2;

Or this one:
http://wiki.lazarus.freepascal.org/Image:samplebgraimagebutton.png

BorderHeight := 2; BorderWidth := 2;
Title: Re: BGRAControls
Post by: circular on December 02, 2011, 02:00:13 pm
Ok, now I understand. In fact, everything's fine. I just had to make four images.

I tested the border features, it works fine !  :)

So in fact, you need to have for each state an image which has a border, and inside some content that can be repeated. Then with FillCenter option, it gets repeated while the borders stay as they are.
Title: Re: BGRAControls
Post by: lainz on December 02, 2011, 02:23:00 pm
Ok, now I understand. In fact, everything's fine. I just had to make four images.

I tested the border features, it works fine !  :)

So in fact, you need to have for each state an image which has a border, and inside some content that can be repeated. Then with FillCenter option, it gets repeated while the borders stay as they are.

That description is going to the wiki  :)
Title: Re: BGRAControls
Post by: digeo on December 09, 2011, 11:51:05 am
Hi

I just switched to Lazarus from Delphi and I am very excited about the BGRA based components and libraries.  ;D

Just 2 questions

Is there a method to determine which part of the button has been clicked on when using dropdown style. In other words, the button part or dropdown part.

Can we download a button maker somewhere like an app that you can choose colors etc to design the button with check boxes and color selectors.
Title: Re: BGRAControls
Post by: lainz on December 09, 2011, 04:18:54 pm
Hi

I just switched to Lazarus from Delphi and I am very excited about the BGRA based components and libraries.  ;D

Just 2 questions

Is there a method to determine which part of the button has been clicked on when using dropdown style. In other words, the button part or dropdown part.

Well  use the event 'OnButtonClick'- But seems that doesn't works?

Try the new version BGRAControls 1.2.0.6:
- Now 'OnClick' fires when the button is clicked and 'OnButtonClick' fires when the dropdown part is clicked.

Quote
Can we download a button maker somewhere like an app that you can choose colors etc to design the button with check boxes and color selectors.

No, there isn't a button maker, you can use the Object Inspector.
Title: Re: BGRAControls
Post by: lainz on December 10, 2011, 04:46:57 pm
@Dibo

You can check 'testbgracontrols' and enable the debug in TBGRAButton (line 49) and then check 'bgraimagebuttontest'  and enable the debug in TBGRAImageButton (custombgraimagebutton.inc line 11).

Seems that the button is repainted in some cases that is unnecesary. In TBGRAImageButton I've partially* solved that using the code in TCustomBitmappedButton invalidating only when neccesary:

Code: [Select]
procedure TCustomBitmappedButton.DoButtonDown();
var
  NewState: TBitmappedButtonState;
begin
  NewState := bbsDown;

  case FState of
    bbsNormal, bbsFocused: NewState := bbsDown;
    //  bbsChecked, bbsCheckedSelected: NewState := bbsCheckedDown;
  end;

  if NewState <> FState then
  begin
    FState := NewState;
    Invalidate;
  end;
end;

* Partially because sometimes when AutoSize is enabled the updateBmp is called twice and when I assign the bitmap from code.
Title: Re: BGRAControls
Post by: lainz on December 11, 2011, 03:06:58 pm
BGRAControls 1.2.0.8

https://sourceforge.net/projects/bgracontrols/files/?

1.2.0.8:
- Now the 'enter' state works better when mouse pressed.
- Updated bgraimagebutton test.

1.2.0.7:
TBGRAImageButton:
- Added 'Animation': it's a nice glowing effect when mouse over and pressed. If you want your own animation you can create a control based on TCustomBGRAImageButton.
- Code optimization in 'UpdateBmp' thanks to circular.
Title: Re: BGRAControls
Post by: wcleyton on December 12, 2011, 02:48:13 pm
I tried to compile version 1.2.0.8 with Lazarus-0.9.31-fpc-2.7.1-34124-20111212-win32.exe and did not install the components.

OS: Win XP SP3

Picture of the error attached.
Title: Re: BGRAControls
Post by: lainz on December 12, 2011, 03:03:00 pm
I have too lazarus trunc but FPC 2.4.4 and works.

Try with FPC 2.4.4
Title: Re: BGRAControls
Post by: digeo on December 13, 2011, 12:47:41 pm
 @circular

can you turn that color chooser (color wheel form) from lazpaint into a component to use as color picker? it then return the color value when the dialog is closed.
Title: Re: BGRAControls
Post by: circular on December 13, 2011, 06:57:45 pm
That's a good idea. I may do it someday.
Title: Re: BGRAControls
Post by: lainz on December 13, 2011, 11:29:10 pm
BGRAControls 1.2.0.9
https://sourceforge.net/projects/bgracontrols/files/?

- Added 'Android' buttons in bgraimagebuttontest project. See "NOTICE.txt", if you use that images you need to put the file "NOTICE.txt" with your program.
 http://wiki.lazarus.freepascal.org/BGRAControls#TBGRAImageButton

- Apply ik patch to fix compilation problem in FPC 2.6.0 (rc).
 http://lazarus.freepascal.org/index.php/topic,15513.msg83436/topicseen.html
Title: Re: BGRAControls
Post by: Takeda on December 14, 2011, 05:19:09 am
The component which most active developed.. I love it..  :)

Thank you, Lainz.. ^^

Bit the rock solid.. break the worries about the OpenSource rumors coz It's always maintained and updated.. :)

That's why I love Lazarus, and that's why I always use BGRAControls + BRGABitmap.. :)

Salute..
-MT-
Title: Re: BGRAControls
Post by: circular on December 14, 2011, 02:21:51 pm
Lainz & Circular, the winning team !   8)

And we should not forget about Dibo, the father (or mother?) of BGRAControls  :D
Title: Re: BGRAControls
Post by: lainz on December 14, 2011, 03:17:09 pm
=) also thanks to felipemdc their code of TCustomBitmappedButton save-me millons of unnecesary 'invalidate'  ::)
Title: Re: BGRAControls
Post by: lainz on December 16, 2011, 02:52:54 pm
If someone is using BGRAImageButton or BGRAControls panels they can find usefull UI images from dribble. Some are free to grab and use something like this : http://dribbble.com/shots/349637-Modern-UI-Kit?list=tags&tag=button, or you can contact the designers if you want to use for commercial.

Another free here http://dribbble.com/shots/347981-User-Interface-Design-kit-Free-Download-/attachments/16655
Title: Re: BGRAControls
Post by: lainz on December 18, 2011, 12:02:50 am
I've added some 'LoadFromFile' in TCustomBGRAImageButton.

Code: [Select]
{
* Usage *
  button.LoadFromFile(some_path + 'button.ini');
  button.BitmapLoadFromFile(some_path + button.BitmapFile);

* Sample button file 'button.ini' *
  [default]
  ; Image
  Animation = 1
  BitmapFile = button.png
  ; BitmapOptions
  BorderHeight = 5
  BorderWidth = 5
  Enable = 0
  FillBottom = 0
  FillCenter = 0
  FillRight = 0
  FillTop = 0
  ; Sound
  Sound = 1
  SoundClick = click.wav
  SoundEnter = enter.wav
  ; Text
  Caption = button
  TextVisible = 1
  FontColor = rgb(255,255,255)
  FontName = Candara
  FontHeight = 30
  ; Size
  Left = 10
  Top = 10
  Width = 300
  Height = 300
  ; Shadow
  ShadowVisible = 1
  ShadowAlpha = 255
  ShadowColor = rgb(150,120,100)
  ShadowOffsetX = 5
  ShadowOffsetY = 5
  ShadowRadius = 2
}   
Title: Re: BGRAControls
Post by: SONFEDAI on December 23, 2011, 12:22:55 am
I've added some 'LoadFromFile' in TCustomBGRAImageButton.
Can you add ImagePosition for BGRAButton?
Title: Re: BGRAControls
Post by: lainz on December 23, 2011, 03:55:41 am
I've added some 'LoadFromFile' in TCustomBGRAImageButton.
Can you add ImagePosition for BGRAButton?

That is?
Title: Re: BGRAControls
Post by: SONFEDAI on December 23, 2011, 07:33:31 pm
That is?
Yu have added new functions...

Can you add Image Position for BGRAButton?
Title: Re: BGRAControls
Post by: lainz on December 23, 2011, 10:22:37 pm
That is?
Yu have added new functions...

Can you add Image Position for BGRAButton?

But what you mean with Image Position? The Glyph?
Title: Re: BGRAControls
Post by: SONFEDAI on December 23, 2011, 11:08:23 pm
But what you mean with Image Position? The Glyph?
Like TSpeedButton.Layout

Glyph is Top, Bottom, Left or Right

Title: Re: BGRAControls
Post by: digeo on December 28, 2011, 10:28:46 pm
For those interested, I have started a new thread for a Windows app I created for button design GUI using BGRA library and Lazarus 0.9.30.

http://forum.lazarus.freepascal.org/index.php/topic,15634.0.html (http://forum.lazarus.freepascal.org/index.php/topic,15634.0.html)
Title: Re: BGRAControls
Post by: JD on January 07, 2012, 12:10:21 am
Hi there,

I just tried the latest version of BGRAControls and I noticed that there are memory leaks whenever the controls are placed on a form and then the application is executed.

JD
Title: Re: BGRAControls
Post by: lainz on January 07, 2012, 03:39:04 am
Hi there,

I just tried the latest version of BGRAControls and I noticed that there are memory leaks whenever the controls are placed on a form and then the application is executed.

JD

Try bgracontrols 1.2.1.1
https://sourceforge.net/projects/bgracontrols/files/?

- Solved a memory leak in BGRAShape (no other memory leak found by me)
- Added bgrabitmapthemeutils (from bitmapthemeutils project in sf)
Title: Re: BGRAControls
Post by: JD on January 07, 2012, 08:33:54 pm
Hi there,

I just tried the latest version of BGRAControls and I noticed that there are memory leaks whenever the controls are placed on a form and then the application is executed.

JD

Try bgracontrols 1.2.1.1
https://sourceforge.net/projects/bgracontrols/files/?

- Solved a memory leak in BGRAShape (no other memory leak found by me)
- Added bgrabitmapthemeutils (from bitmapthemeutils project in sf)

I just updated to BGRAControls 1.2.1.1 and the memory leak is still there. See attached screenshot.
Title: Re: BGRAControls
Post by: lainz on January 07, 2012, 10:22:12 pm
Hi there,

I just tried the latest version of BGRAControls and I noticed that there are memory leaks whenever the controls are placed on a form and then the application is executed.

JD

Try bgracontrols 1.2.1.1
https://sourceforge.net/projects/bgracontrols/files/?

- Solved a memory leak in BGRAShape (no other memory leak found by me)
- Added bgrabitmapthemeutils (from bitmapthemeutils project in sf)

I just updated to BGRAControls 1.2.1.1 and the memory leak is still there. See attached screenshot.

Well I can't see that. If you can provide an example project, or a patch if you found where the leak is.
Title: Re: BGRAControls
Post by: JD on January 07, 2012, 11:12:34 pm
Hi there,

I just tried the latest version of BGRAControls and I noticed that there are memory leaks whenever the controls are placed on a form and then the application is executed.

JD

Try bgracontrols 1.2.1.1
https://sourceforge.net/projects/bgracontrols/files/?

- Solved a memory leak in BGRAShape (no other memory leak found by me)
- Added bgrabitmapthemeutils (from bitmapthemeutils project in sf)

I just updated to BGRAControls 1.2.1.1 and the memory leak is still there. See attached screenshot.

Well I can't see that. If you can provide an example project, or a patch if you found where the leak is.


All I did was open an empty project and then I added a BGRAControl (any one - the result is the same). I run the project and because I have my "Use Heaptric unint" option checked, after I close the running project, I get the memory leak error .
Title: Re: BGRAControls
Post by: lainz on January 07, 2012, 11:20:48 pm
Hi there,

I just tried the latest version of BGRAControls and I noticed that there are memory leaks whenever the controls are placed on a form and then the application is executed.

JD

Try bgracontrols 1.2.1.1
https://sourceforge.net/projects/bgracontrols/files/?

- Solved a memory leak in BGRAShape (no other memory leak found by me)
- Added bgrabitmapthemeutils (from bitmapthemeutils project in sf)

I just updated to BGRAControls 1.2.1.1 and the memory leak is still there. See attached screenshot.

Well I can't see that. If you can provide an example project, or a patch if you found where the leak is.


All I did was open an empty project and then I added a BGRAControl (any one - the result is the same). I run the project and because I have my "Use Heaptric unint" option checked, after I close the running project, I get the memory leak error .

I get no memory leak.
Title: Re: BGRAControls
Post by: JD on January 08, 2012, 04:20:58 pm
Hi there,

I just tried the latest version of BGRAControls and I noticed that there are memory leaks whenever the controls are placed on a form and then the application is executed.

JD

Try bgracontrols 1.2.1.1
https://sourceforge.net/projects/bgracontrols/files/?

- Solved a memory leak in BGRAShape (no other memory leak found by me)
- Added bgrabitmapthemeutils (from bitmapthemeutils project in sf)

I just updated to BGRAControls 1.2.1.1 and the memory leak is still there. See attached screenshot.

Well I can't see that. If you can provide an example project, or a patch if you found where the leak is.


All I did was open an empty project and then I added a BGRAControl (any one - the result is the same). I run the project and because I have my "Use Heaptric unint" option checked, after I close the running project, I get the memory leak error .

I get no memory leak.

Maybe it's a question of semantics. Maybe I don't know what a memory leak is. Maybe my system is junk!

In any case, I can't attach a sample project because the size of the zipped project is 332KB which is greater than the 250KB maximum size of the attachment on this forum.

My Free Pascal compiler options are as shown in the attachment. Notice that the "Use Heaptric unit" option is checked. That is what tells me I have a memory leak.

JD
Title: Re: BGRAControls
Post by: lainz on January 08, 2012, 05:12:27 pm
I know how to enable the heaptrc unit =)

With latest bgracontrols release, latest bgrabitmap svn, latest lazarus svn and fpc 2.6.0 I have no memory leak. So maybe the memory leak is in your lazarus, if someone can test it to be sure it will be nice.
Title: Re: BGRAControls
Post by: JD on January 08, 2012, 08:44:59 pm
I know how to enable the heaptrc unit =)

With latest bgracontrols release, latest bgrabitmap svn, latest lazarus svn and fpc 2.6.0 I have no memory leak. So maybe the memory leak is in your lazarus, if someone can test it to be sure it will be nice.

The latest bgrabitmap svn did the trick. Thanks.
Title: Re: BGRAControls
Post by: lainz on January 09, 2012, 03:37:17 am
BGRAControls 1.2.1.3

Download: https://sourceforge.net/projects/bgracontrols/files/

Changes BGRAControls 1.2.1.3
- Size matters: now 'test' projects are all in one (except for testbuttoneditor and testbgraimagemanipulation), and the images used are loaded from file (it reduces space used too).
- Small fixes in BGRAImageButton.LoadFromFile (loading the shadow.color).

Changes BGRAControls 1.2.1.2
- Improved bgrabitmapthemeutils (now has Fill'Border', resample and draw modes, also you can create from tbgrabitmap, tbitmap, filename and stream)
(there is a TBitmap version of the bitmapthemeutils here https://sourceforge.net/projects/bmpthemeutils/ with less options at this time)

BGRABitmapThemeUtils unit is like the code used to do the 'BitmapOptions' custom resample in BGRAImageButton, with new features:
- The bitmap with borders can be resampled to smaller sizes than the original bitmap.
- Is usefull for 'n' number of images (after was only 4)
- Different sources to create the output (tbgrabitmap, tbitmap, filename and stream)

- Added testbgrabitmapthemeutils
Hopefully with this small example you can understand how it works.

- BGRAImageButton now is using bgrabitmapthemeutils.*

*By default now 'BitmapOptions' are always enabled. Check always the bitmapoptions, also if you have a plain image without borders, in that case set BorderWidth and BorderHeight to zero and it will work like with the old bitmap options enable set to false.

- Fixed examples: there is a problem (don't know where if in Lazarus or in TBGRABitmap) that 'broke' TBitmap's when are converted to TBGRABitmap, I've solved that using 32bit images. ( http://lazarus.freepascal.org/index.php/topic,15657.msg84872.html#msg84872 )

Any patches, suggestions are welcome.
Title: Re: BGRAControls
Post by: lainz on January 14, 2012, 12:41:26 am
In the git repository there is a new component (based on bgrabutton / bgraimagebutton and others). Is another button component, like bgrabutton, but it now handles the 'Disabled' state.

It has less options than BGRAButton but can be added more. Notice that it is in development and it can change at all.

This is an example code how to use it. As you can see all the states has 'Border' and 'Shadow' and also Alpha values for each color value.

I think that adding a dependency between states can cause confusion, and only will be really usefull for the object inspector, for now if you set the style by code you can use 'Assign' to copy all the 'Common' properties between states.

Code: [Select]
procedure Windows7StyleButton(AButton: TBGRANeoButton);
begin

  { Common }
  with AButton.StyleNormal do
  begin
    Border.RoundX := 3;
    Border.RoundY := 3;
    Border.OuterWidth := 1;
    Border.InnerColorAlpha := 175;
    Border.InnerWidth := 1;
    //Text.Font.Height := 20;
    Text.Font.Color := clBlack;
    Text.Quality := fqSystemClearType;
    Shadow.Alpha := 0;
    //Shadow.OffsetX := 1;
    //Shadow.OffsetY := 1;
    //Shadow.Radius := 1;
  end;

  AButton.StyleHover.Assign(AButton.StyleNormal);
  AButton.StyleActive.Assign(AButton.StyleNormal);
  AButton.StyleDisabled.Assign(AButton.StyleNormal);

  with AButton.StyleNormal do
  begin
    Border.OuterColor := RGBToColor(112, 112, 112);
    Gradient1.Color1 := RGBToColor(242, 242, 242);
    Gradient1.Color2 := RGBToColor(235, 235, 235);
    Gradient2.Color1 := RGBToColor(221, 221, 221);
    Gradient2.Color2 := RGBToColor(207, 207, 207);
  end;

  with AButton.StyleHover do
  begin
    Border.OuterColor := RGBToColor(60, 127, 177);
    Gradient1.Color1 := RGBToColor(234, 246, 253);
    Gradient1.Color2 := RGBToColor(217, 240, 252);
    Gradient2.Color1 := RGBToColor(190, 230, 253);
    Gradient2.Color2 := RGBToColor(167, 217, 245);
  end;

  with AButton.StyleActive do
  begin
    Border.OuterColor := RGBToColor(44, 98, 139);
    Border.InnerColorAlpha := 100;
    Gradient1.Color1 := RGBToColor(229, 244, 252);
    Gradient1.Color2 := RGBToColor(196, 229, 246);
    Gradient2.Color1 := RGBToColor(152, 209, 239);
    Gradient2.Color2 := RGBToColor(104, 179, 219);
    GradientPosition := 0.55;
  end;

  with AButton.StyleDisabled do
  begin
    Border.OuterColor := RGBToColor(173, 178, 181);
    Gradient1.Color1 := RGBToColor(244, 244, 244);
    Gradient1.Color2 := RGBToColor(244, 244, 244);
    Gradient2.Color1 := RGBToColor(244, 244, 244);
    Gradient2.Color2 := RGBToColor(244, 244, 244);
    Text.Font.Color := $006D6D6D;
  end;

end;
Title: Re: BGRAControls
Post by: digeo on January 14, 2012, 11:56:03 am
@Lainz

Is it possible to add to sourceforge for download? I do not use git.

Thanks
Title: Re: BGRAControls
Post by: lainz on January 14, 2012, 02:41:24 pm
@Lainz

Is it possible to add to sourceforge for download? I do not use git.

Thanks

ok, I will add it in the beta folder
https://sourceforge.net/projects/bgracontrols/files/beta/?

Title: Re: BGRAControls
Post by: Takeda on January 14, 2012, 09:11:07 pm

ok, I will add it in the beta folder
https://sourceforge.net/projects/bgracontrols/files/beta/?

Wow.. I really love it.. :)
This is the best way for everyone that didn't use git..

BTW, if you use svn, then many people would capable to download it on ".tar.gz" format, since Sourceforge also provide it.. :)

Well, many big thanks..

Regards,
Matsuki, Takeda.
Title: Re: BGRAControls
Post by: lainz on January 14, 2012, 09:44:16 pm
I know, but my admin rights are limited, so I can't create a new repository in the project.

BTW we will ask dibo, I've no problem mantaining both git and svn.
Title: Re: BGRAControls
Post by: Takeda on January 14, 2012, 10:45:54 pm
I know, but my admin rights are limited, so I can't create a new repository in the project.

BTW we will ask dibo, I've no problem mantaining both git and svn.

Love to hear that.. :)
Hope DiBo would be agree with us.. Amien..

Lazarus with BGRABitmap + BGRAControl + CostumDrawnControl -> The Rocket.. Excellent..

Well, Many big thanks for your dedication, for your times, and salute for your dedication..^^

Regards,
matsuki, takeda.
Title: Re: BGRAControls
Post by: typo on January 15, 2012, 02:13:36 pm
On trying to compile bgrabitmappack.lpk I have the following error messages:

C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(13,24) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(15,41) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(16,17) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(16,31) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(21,23) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(22,22) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(37,35) Error: Identifier not found "ScanNextPixelProc"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(13,24) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(15,41) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(16,17) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(16,31) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(21,23) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(22,22) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(37,35) Error: Identifier not found "ScanNextPixelProc"
C:\lazarus\components\bgracontrols-1.2.1.3\bgrapolygon.pas(1411) Fatal: There were 14 errors compiling module, stopping


What should I do?
Title: Re: BGRAControls
Post by: lainz on January 16, 2012, 01:15:06 am
Code: [Select]
On trying to compile bgrabitmappack.lpk I have the following error messages:

C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(13,24) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(15,41) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(16,17) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(16,31) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(21,23) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(22,22) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(37,35) Error: Identifier not found "ScanNextPixelProc"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(13,24) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(15,41) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(16,17) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(16,31) Error: Identifier not found "MemScanCopy"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(21,23) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(22,22) Error: Identifier not found "pscan"
C:\lazarus\components\bgracontrols-1.2.1.3\renderdensity256.inc(37,35) Error: Identifier not found "ScanNextPixelProc"
C:\lazarus\components\bgracontrols-1.2.1.3\bgrapolygon.pas(1411) Fatal: There were 14 errors compiling module, stopping

This is bgracontrols, you should ask Circular in the BGRABitmap thread / forum.

Code: [Select]
Love to hear that..
Hope DiBo would be agree with us.. Amien..

Lazarus with BGRABitmap + BGRAControl + CostumDrawnControl -> The Rocket.. Excellent..

Thanks to Dibo that opened the SVN repo, now I've commited the current Git to Svn:

http://bgracontrols.svn.sourceforge.net/viewvc/bgracontrols/
Title: Re: BGRAControls
Post by: lainz on January 18, 2012, 08:12:53 pm
I've updated a bit BGRANeoButton. This unit is an example, it's usefull to learn how to create your own button with bgrabitmap. BTW read the BGRAImageButton and BGRAButton code  :) All in this unit can be overriden. I've not added 'invalidate' messages in types and AutoSize, add your own according to your programming needs.

BGRAControls 1.3.0.0 is available in Git and Svn, also you can download as zip here:
https://sourceforge.net/projects/bgracontrols/files/?

I've not much time to keep updating this if someone want to keep updating contact Dibo.
Title: Re: BGRAControls
Post by: lainz on January 19, 2012, 09:49:20 pm
Here an example of BGRAImageButton usage with professional (and free) ui images from Dribbble.

Thanks to Jonathan Moreira (Black UI Kit) and Alex Patrascu (Black UI 1st Edition) - search them in dribbble, those ui are free for personal and commercial use -.

Hopefully when Custom Drawn Controls has more controls working at 100% we can use those images to have professional UI working in Lazarus.

PD: there is an attached project.
Title: Re: BGRAControls
Post by: fredycc on January 19, 2012, 11:56:02 pm
Great and amazing job, thanks a lot.  ;D

Regards
Title: Re: BGRAControls
Post by: lainz on January 22, 2012, 03:59:16 am
I'm 'porting' bitmapthemeutils drawer to bgracontrols, in order to do that in the bgracontrols way, i'm using to draw only bgrabitmap, some canvas for text calculations and to do the drawing in the control of course =)

You need also installed CustomDrawnControls from latest lazarus SVN.

Here a screenshot, as you can see the first button is using bgra fonts (fqAntialiased).

The bgra.fontheight seems fit at 1.15 of canvas.gettextheight in the procedure AssignFontToBGRA:

Code: [Select]
Dest.FontHeight := round(Source.GetTextHeight('QWERTY') * 1.15);
In windows there are only 3 font kind that I can see: default (cleartype), nonAntialiased and Antialiased, the other always do the same as default. So I've created the conversion procedure in that way. If you can show me a screenshot with 7 custom drawn buttons with each font quality in other OS's with the default drawer maybe I can optimize it.

The code is available in the GIT and SVN repository of BGRAControls at sourceforge.
Title: Re: BGRAControls
Post by: circular on January 23, 2012, 11:15:28 am
Hello Lainz,

Maybe there is a problem with the font sign. You can try to change the sign (using -Height instead of Height). The behavior of TFont height was different on Windows and on Linux, so I chose apply a sign inversion if needed. Unfortunately, the result may be the opposite of the expected behavior. In BGRABitmap, a positive Height value always the size of the letters, not the size of the whole text line. A negative value is the size of the whole text line. And the property FontFullHeight is always positive and is the size of the whole text line.

Hope this helps.

In AssignFontToBGRA function, in the case statement, you can assign fqProof to fqFineClearType, so we have all of them.
Title: Re: BGRAControls
Post by: lainz on January 24, 2012, 07:45:37 pm
Ok I will do some test to fully understand.

I've added fqProof as fqFineClearTypeRGB. Thanks!

Also I've added BGRAControls 1.3.0.1:
https://sourceforge.net/projects/bgracontrols/upload/

(also you can get the latest GIT or SVN from that site)

- Added customdrawn_windows7 drawer: the main advantages with the one in bitmapthemeutils is that this uses only bgrabitmap. Some things was fixed like the progressbar now looks closer to the original one. I've added win7_dpi option so you can set the dpi, this changes some images like the checkboxes and radiobuttons size. Another new option is win7_checkbox_use_default_tickmark with this you can change from the default 'v' tickmark to the hidden and never used in Windows 'x' tickmark (this is true?)..
- Working in this drawer: button, statictext, checkbox, radiobutton and progressbar.
- Note: of course this drawer is using CustomDrawnControls package, for those that never used it.
Title: Re: BGRAControls
Post by: lainz on January 27, 2012, 03:07:16 am
For those that liked the Windows 7 Drawer now you can easily change between Aero and the Windows 8 Aero Lite styles in the same drawer!

See image attached =)

Download BGRAControls 1.3.0.2:
https://sourceforge.net/projects/bgracontrols/files/?

Patches are welcome  :'(
Title: Re: BGRAControls
Post by: lainz on February 13, 2012, 12:08:14 am
I've updated the bgracontrols customdrawn_win7 drawer with the 'luna' theme (Windows XP theme).

More info and screenshot here:
http://lazarus.freepascal.org/index.php/topic,15209.msg86606.html#msg86606
Title: Re: BGRAControls
Post by: lainz on March 01, 2012, 05:48:07 pm
BGRAControls 1.4.0.0
(maybe the last bgracontrols as you know it!)

Download zip file:
https://sourceforge.net/projects/bgracontrols/files/

Download from svn or git:
https://sourceforge.net/projects/bgracontrols/develop

Changes:

customdrawn_win7
- Added 'Aero Lite' ( Windows 8 )
- Added 'Luna' ( Windows XP )

other
- Small fixes in BGRAImageButton and BGRANeoButton.
- Package option "Add package unit to uses clause" is now unchecked by default (this reduce exe size). With this option lazarus compile only used components, not all.
Title: Re: BGRAControls
Post by: bp on March 08, 2012, 10:26:19 am
Hm, should the IDE built with svn bgracontrols/bgrabitmap work on windows XP? All I'm get is a high CPU utilization on start and then program silently exits.
Title: Re: BGRAControls
Post by: lainz on March 08, 2012, 03:51:53 pm
Hm, should the IDE built with svn bgracontrols/bgrabitmap work on windows XP? All I'm get is a high CPU utilization on start and then program silently exits.

Which IDE?
Title: Re: BGRAControls
Post by: bp on March 08, 2012, 05:16:18 pm
Which IDE?
Sorry, Lazarus by itself.
Title: Re: BGRAControls
Post by: lainz on March 08, 2012, 05:56:20 pm
Which IDE?
Sorry, Lazarus by itself.

I've tested only in Win7 and works fine.
Title: Re: BGRAControls
Post by: bp on March 09, 2012, 04:07:17 am
I've tested only in Win7 and works fine.
Ok, I've done some low level trace and determined, that exception occurs in  CreateWindowExW() called from TCDWidgetSet.CreateAppHandle. Just for a test, CreateAppHandle() was replaced by the code from win32 widgets and it worked fine, but then more exceptions occurred in the other place(s) which I can not determine.
Title: Re: BGRAControls
Post by: Joemanza on March 29, 2012, 02:56:59 pm
still pretty new to programing in general, would it be possible to have wordwraping written into the bgrabutton component of the bgracontrols package? unfortunatley I dont have enough know how to do it myself.
Title: Re: BGRAControls
Post by: Dibo on March 29, 2012, 09:06:47 pm
I am working on new version of BGRAControls. It will be redesigned totally. I will try add wordwraping support too. Coming soon...
Title: Re: BGRAControls
Post by: circular on March 31, 2012, 12:18:45 am
Dibo, please make sure the font height is the same with standard controls. You may need to invert the font height sign to do this.
Title: Re: BGRAControls
Post by: lainz on April 02, 2012, 12:51:33 am
Dibo really it will be redesigned totally? there are a lot of components..

BTW if you are doing some kind of 'style drawer' (gradients, borders, shapes, phong shading, styled text..) BGRAButton, BGRAFlashProgressBar, BGRAKnob and BGRAShape will be easy to re-create.

The others are 'VirtualScreen' or fully working with bitmaps. The customdrawn_windows7 it's using the same code used in BGRAImageButton (bitmapthemeutils.pas) and the code isn't complex.

Don't forget the custom drawn.. those needs only a nice style and patches =)
Title: Re: BGRAControls
Post by: LA.Center on April 02, 2012, 08:54:37 am
Maybe a dumb question, but why are you redesigning? They are already very good.
Title: Re: BGRAControls
Post by: lainz on April 02, 2012, 05:17:54 pm
Maybe Dibo want to be perfect controls =)

The reasons are all explained by the users in this thread. Basically all of BGRAButton:
- Glyph positioning
- Word wrap
- Custom style of disabled state

BGRAVirtualScreen / BGRAPanel:
- Transparency

BGRAImageButton / BGRASpriteAnimation / BGRAImageManipulation:
- Gain speed, those are a bit slow

etc..
Title: Re: BGRAControls
Post by: lainz on April 14, 2012, 12:03:04 am
*SVN and GIT update*
- Small fix in BGRABitmapThemeUtils. Now vertical progressbar in customdrawn_win7 will be scaled correctly.

(the power of a single line of code..)

BTW if someone know or want to speed up this unit It will be greatly appreciated.
Title: Re: BGRAControls
Post by: lainz on April 20, 2012, 04:57:37 pm
Another update for BGRAControls git and svn.

* Fixed font height (at least for Windows)
* Added some default drawing for TCDScrollBar
* Added some default drawing for the 'Slider'

The drawer isn't getting closer to the original Windows style (for now) but at least it's usefull to change the bitmaps and easily get a new look. BTW patches are welcome.
Title: Re: BGRAControls
Post by: picstart on April 21, 2012, 05:36:53 pm
Upgraded to brgabitmappack 5.7.1 brgacontros 1.4 . Package inspector shows them installed without error. Opened an existing ( prior to the upgrade) project that uses brgacontrols and recompiled..it compiles without error but at run time it errors as below.
brgabutton1.BodyChecked.LightWidth unknown property LightWidth
same with button2 and button3 ( there are 3 buttons on the form.
Is there a simple way to fix this short of reworking the whole form?

Observations
buttons are part of a brgapanel and if I create a new test project  the buttons work.
If I delete the buttons in the existing (erroring )project and recreate them by copying the button code into the new buttons the error persists. Yes lightwidth is in the object inspectors property list... It's as if there is a hidden dependency that ties it back to a time when lightwidth didn't exist.
Title: Re: BGRAControls
Post by: lainz on April 22, 2012, 07:11:21 pm
I have no idea.. I always set the bgrabutton style by code.
Title: Re: BGRAControls
Post by: Dibo on April 22, 2012, 07:50:12 pm
By BodyChecked you mean BodyClicked?
Title: Re: BGRAControls
Post by: picstart on April 22, 2012, 08:13:26 pm
Yes Bodyclicked.Lightwidth. My error in copying down the error pop up on running the code.What makes me concerned is that a compile and run should be sufficient and transparent  but if there are hidden dependencies perhaps into some xml file that points to earlier versions such that the compile isn't against the latest components as specified by the packages installed and the IDE version and the FPC version.
When things work Lazarus creates a pleasant exe that can be moved to other directories and is self contained enough to run in a new directory ( no need to move run time libraries).
Title: Re: BGRAControls
Post by: digeo on April 25, 2012, 12:30:32 pm
I am trying to compile the customdrawn_win7 demo with BGRA demos. I receive errors for missing customdrawncontrols. Where can I download?

Any suggestions?
Title: Re: BGRAControls
Post by: lainz on May 04, 2012, 03:18:30 pm
I am trying to compile the customdrawn_win7 demo with BGRA demos. I receive errors for missing customdrawncontrols. Where can I download?

Any suggestions?

search in the wiki, I always get the latest customdrawncontrols with the latest lazarus svn.

----------------

BGRAControls is changing at all, see in this post:
http://lazarus.freepascal.org/index.php/topic,16828.0.html

This is the last update for the current BGRAControls ver. 1.4.0.1
https://sourceforge.net/projects/bgracontrols/

Basically all changes related to customdrawn_win7 drawer (also changes that affect TBGRAImageButton). Enjoy.

r27
Added some default drawing for the 'Slider'.
---------------------
r26
Added some default drawing for TCDScrollBar.
---------------------
r25
Fix in AssignFontToBGRA font height.
---------------------
r24
Small fix in BGRABitmapThemeUtils. Now vertical progressbar in customdrawn_win7 will be scaled correctly.
---------------------
r23
Added 'DrawButtonWithArrow' for ComboBox.
---------------------
r22
Small fix in customdrawn_win7 to work with the latest customdrawn available.
---------------------
Title: Re: BGRAControls
Post by: digeo on May 07, 2012, 01:06:16 pm
I added StaticButton property to have button with no states. The BGRAButton had this property as well.

Made small change to BGRANeoButton draw procedure:

Code: [Select]
procedure TCustomBGRANeoButton.DrawButton;
begin
  if Enabled and not StaticButton then
    case FState of
      gbsNormal: begin
                     DrawBody(StyleNormal);
                     DrawText(StyleNormal);
                 end;
      gbsHover:  begin
                     DrawBody(StyleHover);
                     DrawText(StyleHover);
                 end;
      gbsActive: begin
                     DrawBody(StyleActive);
                     DrawText(StyleActive);
                 end;
    end
  else
  begin
    DrawBody(StyleDisabled);
    DrawText(StyleDisabled);
  end;

  if Enabled and StaticButton then
  begin
    DrawBody(StyleNormal);
    DrawText(StyleNormal);
  end;
end;
Title: Re: BGRAControls
Post by: lainz on May 09, 2012, 05:16:21 pm
I added StaticButton property to have button with no states. The BGRAButton had this property as well.

Made small change to BGRANeoButton draw procedure:

Code: [Select]
procedure TCustomBGRANeoButton.DrawButton;
begin
  if Enabled and not StaticButton then
    case FState of
      gbsNormal: begin
                     DrawBody(StyleNormal);
                     DrawText(StyleNormal);
                 end;
      gbsHover:  begin
                     DrawBody(StyleHover);
                     DrawText(StyleHover);
                 end;
      gbsActive: begin
                     DrawBody(StyleActive);
                     DrawText(StyleActive);
                 end;
    end
  else
  begin
    DrawBody(StyleDisabled);
    DrawText(StyleDisabled);
  end;

  if Enabled and StaticButton then
  begin
    DrawBody(StyleNormal);
    DrawText(StyleNormal);
  end;
end;

Also you can assign the normal state to all the others.

BTW if you do it in one of those ways, when you mouse over and clic the button it will be repainted and that is unnecesary for a static component.
Title: Re: BGRAControls
Post by: digeo on May 19, 2012, 11:32:45 pm
is it possible to draw a bgra container control transparent like in attachment? I find this is possible with a bgra button but the button decent from different control than the bgra panel or virtualscreen and the button is not a container.
Title: Re: BGRAControls
Post by: lainz on May 20, 2012, 03:42:25 am
At least I know that is not possible in a easy way. I remember that if you 'copy the background' and put it as background of the control (don't know how) you can get a transparent panel.

TBGRAButton is TGraphicControl descendant, the others are TPanel or TCustomControl descendant.

If you solve your problem please tell us

https://groups.google.com/group/borland.public.delphi.vcl.components.writing/browse_thread/thread/90f253093d15820e/9385f971b8bf50a4

http://delphicikk.atw.hu/listaz.php?id=1341&oldal=1

http://www.delphigroups.info/2/5/320584.html

http://www.delphigroups.info/3/2/174853.html
Title: Re: BGRAControls
Post by: lainz on May 20, 2012, 05:47:31 pm
Update, added owner drawn ListBox and ComboBox in testbgracontrols (git and svn)

Title: Re: BGRAControls
Post by: bambamns on May 21, 2012, 12:12:49 am
Hi,

Does BGRAControls work with WinCe ?

I tried (today) to compile a simple test application with just a few labels but it can not be done.
Title: Re: BGRAControls
Post by: lainz on May 21, 2012, 03:10:41 am
I've no idea.
Title: Re: BGRAControls
Post by: digeo on May 21, 2012, 03:42:34 pm
I think i made a good enough replica. Could be imroved with more time.

Use BGRAGraphicControl and draw all the text and gradient and borders.

A lot more coding but nice effect
Title: Re: BGRAControls
Post by: digeo on May 21, 2012, 11:13:13 pm
I am trying to load png from file using:
Code: [Select]
bmp := TBGRABitmap.Create('emoticon_evilgrin.png');
bmp.Draw(canvas, 10, 10, True);
bmp.Free;
I receive sigsev error and program stops here (-->):
Code: [Select]
procedure TBGRADefaultBitmap.DoAlphaCorrection;
var
  p: PBGRAPixel;
  n: integer;
begin
  if CanvasAlphaCorrection then
  begin
    p := FData;
    for n := NbPixels - 1 downto 0 do
    begin
-->      if (longword(p^) and $FFFFFF <> 0) and (p^.alpha = 0) then
        p^.alpha := FCanvasOpacity;
      Inc(p);
    end;
  end;
  FAlphaCorrectionNeeded := False;
  InvalidateBitmap;
end;

No further messages. Any suggestions?
Title: Re: BGRAControls
Post by: JD on May 21, 2012, 11:30:07 pm
I think i made a good enough replica. Could be imroved with more time.

Use BGRAGraphicControl and draw all the text and gradient and borders.

A lot more coding but nice effect

I like what you did there. How did you do it? Can you provide some code snippets?
Title: Re: BGRAControls
Post by: digeo on May 22, 2012, 08:54:23 am
I am still trying to figure out how to draw the icons from a bgraimagelist onto the BGRAGraphicControl.

I use getimage from imagelist to load the icon into a bitmap value, but to convert from TBitmap to TBGRACustomBitmap.

I get errors with the draw procedure as I described above.
Title: Re: BGRAControls
Post by: Dibo on May 23, 2012, 07:01:32 pm
New release 2.0 alpha.

Hi,
I could not do everything that I had planned, because I had only a few hours in a week for that.
Notice that version 2.0 is incompatible with 1.XX edition, because most of classes are renamed and some are deleted. This same with properties.
All changes mostly affect to three controls (BGRAButton, BGRAPanel, BGRALabel) of which I am the author (except BGRALabel). I created copy of them and renamed to TBCButton, TBCPanel and TBCLabel. Old controls are still on palette, but they are deprecated and will be deleted in future (when all demos will be moved to new one). Wiki pages will be updated on stable version.

Major changes:
Detail changes:

TODO:

New version is available only from git/svn repo. If you find a bug, please report on which repo, because I worked on git and maybe I didn't move all changes to svn repo.

Regards and sorry for my english, it was hard to explain everything in my non-native language ;)
Title: Re: BGRAControls
Post by: lainz on May 23, 2012, 09:15:52 pm
Everyone has frozen with your post =) Nice I'm testing it.

- New default theme (lainz theme from BGRA Button Gallery)

You'll make me cry like a child =)
Title: Re: BGRAControls
Post by: Rails on May 23, 2012, 09:52:08 pm

Regards and sorry for my english, it was hard to explain everything in my non-native language ;)

Your English is fine. My Polish is nonexistent.

Great work.   8)

Title: Re: BGRAControls
Post by: lainz on May 24, 2012, 12:06:50 am
Someone has tested it on Windows? I can't get the Font looks like in BGRAButton with 'TextCanvas' property.
Title: Re: BGRAControls
Post by: Dibo on May 24, 2012, 01:16:49 am
Yes, I expected this error. This is new property for me (not implemented by me). I saw that it only change font height (it get it from font, what does it mean?). I thought that RenderText from BCTools can do everything so I ignored it but forgot note it, sorry, can you explain what does it mean or apply patch (maybe it could be expanded in RenderText method?)?
Title: Re: BGRAControls
Post by: Dibo on May 24, 2012, 01:26:06 am
Everyone has frozen with your post =) Nice I'm testing it.

- New default theme (lainz theme from BGRA Button Gallery)

You'll make me cry like a child =)

:D . My style was ugly :P (my mind was focused on technical matters, not the artistic ;) )
Title: Re: BGRAControls
Post by: Dibo on May 24, 2012, 01:41:57 am

Regards and sorry for my english, it was hard to explain everything in my non-native language ;)

Your English is fine. My Polish is nonexistent.

Great work.   8)
Thanks .  My english knowledge is only from old computer games or programming documentation :) . How do you know that I'm Polish?
BTW I Invite you to euro 2012 (if you like football, because I don' t:P ) and sorry for our roads
Title: Re: BGRAControls
Post by: lainz on May 24, 2012, 01:48:31 am
I know. I can program or design, not both things at the same time. If I program my designs sucks, If I design I can't manage to solve any problem =)

TextCanvas I've implemented to draw exactly like Windows default text drawing (only with font size 0 not for custom font sizes). I've seen that setting FontAntialias to True is very similar.

The thing is that the Drawing that is performed at design time is different that when I compile the program. See image attached, at the left a BGRAButton, at the middle a BCButton, and the other is a Windows button. PD: I've set the same caption for all just to visually compare them.
Title: Re: BGRAControls
Post by: Rails on May 24, 2012, 01:55:02 am

Regards and sorry for my english, it was hard to explain everything in my non-native language ;)

Your English is fine. My Polish is nonexistent.

Great work.   8)
Thanks .  My english knowledge is only from old computer games or programming documentation :) . How do you know that I'm Polish?
BTW I Invite you to euro 2012 (if you like football, because I don' t:P ) and sorry for our roads

You profile says your location is Poland.   :D

Thanks for the invite. I have not been to Poland, but would like to visit there someday. Alas, it won't be this year.

Title: Re: BGRAControls
Post by: hallenberger on May 24, 2012, 08:34:20 am
New release 2.0 alpha.

Hi,
I could not do everything that I had planned, because I had only a few hours in a week for that.
Notice that version 2.0 is incompatible with 1.XX edition, because most of classes are renamed and some are deleted. This same with properties.
All changes mostly affect to three controls (BGRAButton, BGRAPanel, BGRALabel) of which I am the author (except BGRALabel). I created copy of them and renamed to TBCButton, TBCPanel and TBCLabel. Old controls are still on palette, but they are deprecated and will be deleted in future (when all demos will be moved to new one). Wiki pages will be updated on stable version.


Thank you for your work.

I'm using lazarus on windows (daily snapshot). If I install the new version of bgracontrols from svn then all my old projects, which use the old brgacontrols could not be opened :-((
Lazarus told me, that the controls could not be found!



Title: Re: BGRAControls
Post by: Dibo on May 24, 2012, 06:00:25 pm
Which controls you are using in those projects? This version strongly differs from previous but I left the old components (but they will be removed in the future)
Title: Re: BGRAControls
Post by: hallenberger on May 25, 2012, 09:41:57 am
Which controls you are using in those projects? This version strongly differs from previous but I left the old components (but they will be removed in the future)

I use TBGRALabel, TBGRAPanel, TBGRAButton.
Title: Re: BGRAControls
Post by: Dibo on May 25, 2012, 12:47:31 pm
Ok, BGRAPanel file was missing.
Now you should be able to open your projects. But remember, those controls (with TBGRA prefix) are deprecated and there is nothing new for them. You should change controls in your project to equivalent with TBC prefix.
Regards
Title: Re: BGRAControls
Post by: hallenberger on May 25, 2012, 01:28:54 pm
Ok, BGRAPanel file was missing.
Now you should be able to open your projects. But remember, those controls (with TBGRA prefix) are deprecated and there is nothing new for them. You should change controls in your project to equivalent with TBC prefix.
Regards

Thank you!

With the new version, 2 projects could be opened and compiled.

Regards
Title: Re: BGRAControls
Post by: lainz on May 25, 2012, 01:47:10 pm
Ok, BGRAPanel file was missing.
Now you should be able to open your projects. But remember, those controls (with TBGRA prefix) are deprecated and there is nothing new for them. You should change controls in your project to equivalent with TBC prefix.
Regards

Thank you!

With the new version, 2 projects could be opened and compiled.

Regards

That's true partially. Remember to change all your TBGRA with TBC where available. This is an alpha version, when it get released all old controls will be deleted.
Title: Re: BGRAControls
Post by: hallenberger on May 25, 2012, 02:11:51 pm
That's true partially. Remember to change all your TBGRA with TBC where available. This is an alpha version, when it get released all old controls will be deleted.

I will change the controls, but to do that, I must have the chance to open and change the project.
;-)

regards
Title: Re: BGRAControls
Post by: lainz on May 25, 2012, 03:02:31 pm
That's true partially. Remember to change all your TBGRA with TBC where available. This is an alpha version, when it get released all old controls will be deleted.

I will change the controls, but to do that, I must have the chance to open and change the project.
;-)

regards

 ;) BTW you can load the lfm and edit the component name (for those than just will download the release)..
Title: Re: BGRAControls
Post by: circular on May 25, 2012, 06:24:26 pm
Hi folks.

I've looked at the code of bc controls, that's a nice work. I have some remarks about bctools :

Sorry for not looking at it before, my mind was somewhere else.

Regards,
Title: Re: BGRAControls
Post by: Dibo on May 25, 2012, 07:19:39 pm
Thanks for tips :)
RenderBorder and RenderBackground should be merged in some way, because it is needed to draw the border and the background at the sametime using TBGRAMultishapeFiller so that the junction between border and background is perfect. RenderBackground contains some start of it for the bbsGradient, but does not draw the border at this moment, which makes the use of TBGRAMultishapeFiller useless
Good point, but I don't know how object TBGRAMultishapeFiller work. I think code which already exists was not written by me
Quote
AssignBCFont should not assign automatically to Canvas font because accessing Canvas causes a TBitmap to be needed, which may require some processing if there is no direct access of bitmap data available. It should assign to Canvas only if it is going to be used.
I needed canvas to calculate font height. Maybe I better create temporary canvas to do it.
Quote
I do not know if it is an error, but the use of RoundRectAntialias with TRect does not follow windows TRect convention. TRect bottom-right coordinate should be pixel coord+1, so there should be a -1.
What does it mean? I didn't test it on windows yet.
Quote
in RenderText, it is useless to create tmp, text can be drawn directly.
Right. Temp is unnecessary (but if text has shadow then I still need some other bgra bitmap for blur filter)
Quote
in RenderArrow, it is useless to create temp, it is possible to clip using ClipRect property. I am puzzled by the for loop drawing 6 times the same thing. A matter of antialising ?[/li][/list]
Right. About the loop - I don't know why it is there, I don't remember this code :)
Title: Re: BGRAControls
Post by: circular on May 25, 2012, 08:32:32 pm
RenderBorder and RenderBackground should be merged in some way, because it is needed to draw the border and the background at the sametime using TBGRAMultishapeFiller so that the junction between border and background is perfect. RenderBackground contains some start of it for the bbsGradient, but does not draw the border at this moment, which makes the use of TBGRAMultishapeFiller useless
Good point, but I don't know how object TBGRAMultishapeFiller work. I think code which already exists was not written by me
To draw antialiased junctions, create one TBGRAMultishapeFiller, add the shapes, call Draw, then free the object. The polygon order property specifies how to take into account the order in which shapes are added. The existing code does all this, except it does not add a shape for the border.

Quote
Quote
AssignBCFont should not assign automatically to Canvas font because accessing Canvas causes a TBitmap to be needed, which may require some processing if there is no direct access of bitmap data available. It should assign to Canvas only if it is going to be used.
I needed canvas to calculate font height. Maybe I better create temporary canvas to do it.
Quote
Yes, you can for example overload this function, with TCanvas parameter or TBGRABitmap parameter.

Quote
Quote
I do not know if it is an error, but the use of RoundRectAntialias with TRect does not follow windows TRect convention. TRect bottom-right coordinate should be pixel coord+1, so there should be a -1.
What does it mean? I didn't test it on windows yet.
No it's not about Windows, it's about TRect structure. For example if you have a rectangle that goes horizontally from pixel zero to pixel one, it has a width of 2, and coordinates (0,2). In fact, the 2 in the coordinates is outside of the rectangle. See what I mean ? With RoundRectAntialias, you need to specify the pixel, so it would take (0,1) as parameters.

Quote
Quote
in RenderText, it is useless to create tmp, text can be drawn directly.
Right. Temp is unnecessary (but if text has shadow then I still need some other bgra bitmap for blur filter)
You're right.

Quote
About the loop - I don't know why it is there, I don't remember this code :)
I suppose you can simply remove the loop (and in fact, I think it must be removed because applying a color 6 times with some alpha changes in fact the resulting alpha).
Title: Re: BGRAControls
Post by: lainz on May 25, 2012, 09:16:36 pm
The MultishapeFiller was added by circular to add the inner light.

I've added the loop, remove it. That was before when the arrow has aliased borders (if not a perfect triangle it looks terrible).

I can't get cleartype working, what I'm doing wrong, this is from bctest (check bcsamples BCButtonWindows7 procedure), and the other is a BGRAButton (bgrasamples).

In BGRAButton TextCanvas is just for this:

  if FTextCanvas then
  begin
    FBGRANormal.FontHeight := FBodyNormal.FFont.Height;
    FBGRANormal.FontQuality := fqSystemClearType;
  end   

Edit: I remember that if you draw text with cleartype in a transparent bitmap cleartype is never shown.
Title: Re: BGRAControls
Post by: Dibo on May 26, 2012, 05:36:59 pm
I'll try to do something about it. But I do not really understand the specificity of "ClearType" and all this "transparent" stuff. Can anyone give me a short course? :P
Title: Re: BGRAControls
Post by: lainz on May 26, 2012, 08:08:18 pm
I'll try to do something about it. But I do not really understand the specificity of "ClearType" and all this "transparent" stuff. Can anyone give me a short course? :P

Well I've learned with the class of circular and Wikipedia.

ClearType is a thechnology for better rendering of fonts in LCD displays. It is used in Windows (maybe in others too). If you see in the image I've attached, at the right button the pixels has some colors around the black in the font, that is ClearType.

But this only works for non-transparent stuff. Which this mean? You can't draw with ClearType in a transparent BGRABitmap. It needs a background. So you need to draw all in the same bitmap, the background and the font. If the background is 'BGRAPixelTransparent' the font never apply ClearType.
Title: Re: BGRAControls
Post by: circular on May 26, 2012, 08:52:34 pm
That's right Lainz. Where is the attachment ?

You can also use LazPaint with some text white on black, and apply ClearType filter, or the contrary, for example if you copy what is on the screen with the web browser, and zoom it.

It's about using subpixels red/green/blue.
Title: Re: BGRAControls
Post by: lainz on May 26, 2012, 09:00:45 pm
That's right Lainz. Where is the attachment ?

You can also use LazPaint with some text white on black, and apply ClearType filter, or the contrary, for example if you copy what is on the screen with the web browser, and zoom it.

It's about using subpixels red/green/blue.

Its in the previous post.

http://lazarus.freepascal.org/index.php/topic,12411.msg93609.html#msg93609
Title: Re: BGRAControls
Post by: circular on May 26, 2012, 10:40:19 pm
Oh ok. Seems like I'm not completely awake.
Title: Re: BGRAControls
Post by: Dibo on May 28, 2012, 01:14:41 pm
I commited new version (svn and git) 2.0.2 alpha

Changes:
- I solved problem with cleartype (thanks for article, I used temporary bitmap for text draw without background, so cleartype never appear).
- I solved problem with TextCanvas property which was in old BCButton. Now BCButton (and all other controls which are using TBCFont and RenderText method) has "text canvas" drawing as default, so property is unnecessary. I learned more about FontQuality. This is interesting: if font quality is fqSystem or fqSystemClearType and font height is 0 then LCL automatically calculate default font height (like in standard lazarus controls, circular - this is what I want to get in this topic: http://www.lazarus.freepascal.org/index.php/topic,16638.0.html . So much trouble and it was enough only to set the height to 0 and font quality on fqSystem or fqSystemClearType), but if font quality is in other type, then I must calculate text height manually. Note: GTK interface is exception here. GTK has as default fqFineAntialiasing until problem with strange background with this type will be solved
- Fixed FontStyle bug. You could not write "empty" style to DFM/LFM. Instead, fsbold was read
- FontAntialias property is deleted from TBCFont type (now you use only FontQuality instead) so you probably will have some errors when opening old projects (which stored this property in LFM). Try to clear this properties (lazarus should suggest this)

PS. Can someone confirm some bug on other interface than GTK? It appear on changing FontQuality. On my GTK interface, often when I change value from fqSystemClearType to fqSystem then lazarus crash. I get empty dialog and when I close it, Lazarus is terminating.

Regards
Title: Re: BGRAControls
Post by: lainz on May 30, 2012, 04:25:26 pm
Nice.

I'ts possible to draw a gradient light? something like this
http://dribbble.com/shots/581129-Fonts-Window-UI?list=popular&offset=4

It is white (with alpha 100?) to transparent.
Title: Re: BGRAControls
Post by: Dibo on May 30, 2012, 04:47:37 pm
Currently not, there is only ColorOpacity property for bbsColor style. And global opacity for whole control.
But this sound interesting. This could be done by replacing all TColor properties to TBGRAPixel type which has opacity property. Then support for transparency will be added automatically in all cases where color is used. ColorOpacity for each Color property will be unnecessary. There is only one problem: standard color dialog in object inspector will disappear, but we could create own color dialog (which inherit from standard lazarus color dialog), add opacity edit and connect this dialog to TBGRAPixel class type. There is not much to do and the functionality can be useful in other controls. I'll see what I can do.
Title: Re: BGRAControls
Post by: Dibo on May 30, 2012, 06:33:47 pm
It's not so easy as I thought. TBGRAPixel is record and this kind of property can't be published. So the fastest way is add opacity property for each color in TBCGradient or (to get effect mentioned in above post) create own property type TBCPixel and function BCPixel2BGRA which will return TBGRAPixel for BGRABitmap methods. I must check first how this could be work...
Title: Re: BGRAControls
Post by: lainz on May 30, 2012, 11:20:19 pm
I say for example:

Border.LightColor := clWhite;
Border.LightOpacity := 100;

Border.LightColor2 := clWhite;
Border.LightOpacity2 := 0;

Border.LightDirection := ldVertical; // or ldHorizontal..

BTW will be amazing a color editor with alpha. If it too hard to do just with the separate opacity is ok for me.

Another thing:
- What happened with negative shadow offset values?
Title: Re: BGRAControls
Post by: KpjComp on May 31, 2012, 01:08:54 am
Quote
It's not so easy as I thought. TBGRAPixel is record and this kind of property can't be published

What you would normally do is wrap a record structure into wrapper class, it's this then you publish.
eg. Say you wanted to publish a TRect structure, again this is a record type you could do this.

Code: [Select]
TRectProperty = class(TPersistent)
    public
      Rect:TRect;
    published
      property Left  :Longint read Rect.Left   write Rect.Left;
      property Top   :Longint read Rect.Top    write Rect.Top;
      property Right :Longint read Rect.Right  write Rect.Right;
      property Bottom:Longint read Rect.Bottom write Rect.Bottom;
    end;     

You could then assign your custom Object Inspector to this class.

If placing your TBGRAPixel into a TPersistent class directly is not ideal, eg. like how I've placed the TRect as part of the public interface.  You could possible create using a PBGRAPixel pointer, and create Getter/Setters functions instead.
Title: Re: BGRAControls
Post by: circular on May 31, 2012, 01:39:20 am
@Dibo: you can use the code of LazPaint for the color dialog if you want.
Title: Re: BGRAControls
Post by: Dibo on May 31, 2012, 03:33:29 pm
@KpjComp - I considered such solution and this is probably the best solution. But I am thinking... TColor has 4 bytes in memory, now new color will be as object instance so it will take ~40 bytes in memory. I've always had optimization manias, do you think guys that this might be a problem today? :P . E.g. BCButton using 7 color properties in each state, so we have 21 colors * 4 bytes = 84 bytes. Now it will be 840 bytes. I wondered, is it possible to create 8 byte TBCColor = Int64 and store standard TColor (4 byte) and alpha value (as 5th byte) in this type?

@Circular - thanks
Title: Re: BGRAControls
Post by: KpjComp on May 31, 2012, 06:44:19 pm
Quote
color will be as object instance so it will take ~40 bytes in memory.

To keep memory low, you could actually get it back down to 4 bytes in 32 bit, & 8 bytes in 64bit, +the number of bytes for the actual record.

Basically you could late bind your TPersistent class,  you can do this by checking on your getter if the TPersistent class has been assigned.  You would also set the stored property to false, and use the TFiler way of storing property data so that the TPersistent class doesn't get even initialized on form load.  IOW: This TPersistent class is just for used in the Property Editor, and at RunTime wouldn't be needed as long as you access the record structure directly.

eg. something like this on the getter
Code: [Select]
property ColorProp:TMyColorProp read getColorProp write setColorProp;

function MyClass.getColorProp;
begin
  if not assigned(fMyColorProp) then
     fColorProp := TMyColorProp.Create(@MyColor);
  result := fColorProp;
end;
   
Title: Re: BGRAControls
Post by: Dibo on June 01, 2012, 10:43:18 am
I figure out another possibility. What do you think about this?
Code: Pascal  [Select][+][-]
  1. TBCColor = Int64; // 8 byte ordinal type
  2.  
  3. // Conversion functions
  4. function BCColor2BGRA(const ABCColor: TBCColor): TBGRAPixel;
  5. var
  6.   c: TColor;
  7.   a: Byte;
  8. begin
  9.   // Read 4 bytes to get TColor
  10.   Move(ABCColor,c,SizeOf(c));
  11.   // Read 5th byte to get alpha channel
  12.   Move(PChar(@ABCColor)[SizeOf(c)],a,SizeOf(a));
  13.   Result := ColorToBGRA(c,a);
  14. end;
  15.  
  16. function BGRA2BCColor(const ABGRA: TBGRAPixel): TBCColor;
  17. var c: TColor;
  18. begin
  19.   c := BGRAToColor(ABGRA);
  20.   Result := Color2BCColor(c,ABGRA.alpha);
  21. end;
  22.  
  23. function Color2BCColor(const ACol: TColor; const AAlpha: Byte): TBCColor;
  24. begin
  25.   // Write 4 bytes color
  26.   Move(ACol,Result,SizeOf(TColor));
  27.   // Write 1 byte alpha channel as 5th byte
  28.   Move(AAlpha,PChar(@Result)[SizeOf(TColor)],SizeOf(AAlpha));
  29. end;
  30.  
So, we have ordinal type TBCColor which has 8 byte size, so we can store TColor (4 bytes) and alpha channel (1 byte). This is ordinal type so it can be published in object inspector like normal TColor, but TBCColor will be connected to our color dialog which handle all conversions (using above conversion functions). No objects needed. What do you think about this solution?
Title: Re: BGRAControls
Post by: KpjComp on June 01, 2012, 01:01:21 pm
Quote
What do you think about this solution?

Sounds good.

If your not bothered about TColor, then wound't 4 bytes be enough for RGBA.  The only thing I think TColor gives you extra is NamedColors & SystemColors.  If your wanting to keep this aspect, then the 8 byte storage seems logical.

My other idea was to create a Component Editor, and not just a property editor.  Here you have full control, and storage is whatever form you wish.
Title: Re: BGRAControls
Post by: circular on June 03, 2012, 12:15:26 pm
It's a good idea, but I suppose it will not be compatible depending on the byte order (low endian / big endian). So I advise you to use instead a record that has absolute position, and to use two different definition for the record depending on the byte order with compiler directive.
Title: Re: BGRAControls
Post by: Dibo on June 03, 2012, 12:26:49 pm
It's a good idea, but I suppose it will not be compatible depending on the byte order (low endian / big endian).
What does it mean?
Title: Re: BGRAControls
Post by: circular on June 03, 2012, 12:48:56 pm
Depending on the processor, bytes in integer may be stored in a different order.

On Intel (low endian), the number 256 is stored as : 00 01 00 00 (the second byte is multiplied by 256, and so on)
Whereas it can be stored as : 00 00 01 00 (which seems more naturel when we read it like that)

So if you store the TColor clBlue = $00FF0000 in memory, on Intel, it will be stored as : 00 00 FF 00, where as on big endian, it will be stored as : 00 FF 00 00. That's not an issue in general, but if you want to store this TColor inside an int64, you need to take care of the position inside the int64.

For example, if you store a TColor and an alpha value with low endian :
(clBlue, alpha=128) => ( 00 00 FF 00 80 00 00 00 ) = $0000008000FF0000 (on low endian)

it will be different with high endian :
(clBlue, alpha=128) => ( 00 FF 00 00 80 00 00 00 ) = $00FF000080000000 (on big endian)

If you want the same result, you need to store it from the end :
(clBlue, alpha=128) => ( 00 00 00 80 00 FF 00 00 ) = $0000008000FF0000 (on big endian)
Title: Re: BGRAControls
Post by: Dibo on June 03, 2012, 01:58:15 pm
Even if I use Move method which write data from left to right?

BTW: Lainz, I see that TBCGradient has StartColorOpacity and EndColorOpacity so gradient light is possible. I thought that it doesn't has
Title: Re: BGRAControls
Post by: circular on June 03, 2012, 03:54:24 pm
You can use Move that will not change the endian order of what you are copying, but you need to choose carefully the destination. Here it is an int64. In low endian, the low longword is at the begining (so at the same address, and you can do a move like you do), but in big endian, the low longword is at +4 bytes. So when it will be converted to a string that represents the value, you will get a different result if you don't take this offset into account.

Note that you can simply do :
value64 := int64(color32) + (int64(alpha8) shl 32);

and
color32 := value64 and $ffffffff;
alpha8 := (value64 shr 32) and $ff;

In this case, it will work the same on any platform (it will be automatically stored as big endian or low endian). But it will use int64 operations which can be slow.
Title: Re: BGRAControls
Post by: lainz on June 03, 2012, 07:54:07 pm
Even if I use Move method which write data from left to right?

BTW: Lainz, I see that TBCGradient has StartColorOpacity and EndColorOpacity so gradient light is possible. I thought that it doesn't has

Thanks Dibo BTW now I noticed that doesn't matter =) I can use ImageButton or CustomDrawn with any textured bitmap inside wich already has the gradient light and that's all.
Title: Re: BGRAControls
Post by: Dibo on June 04, 2012, 01:38:02 am
But I'm curious. StartColorOpacity and EndColorOpacity can do effect posted by your image example?
BTW: I can't find property responsible for negative shadow in old bgrabutton which you mentioned. How does it worked? I want add it in bcbutton
Title: Re: BGRAControls
Post by: lainz on June 04, 2012, 02:55:50 am
But I'm curious. StartColorOpacity and EndColorOpacity can do effect posted by your image example?
BTW: I can't find property responsible for negative shadow in old bgrabutton which you mentioned. How does it worked? I want add it in bcbutton

Yes at least for the middle buttons, the corner buttons (left .. right) has the light a bit different (zoom with your fav paint app), but that doesn't matter, if BCButton need to add code to draw each kind of button in dribbble we will get crazy, so just add the neccesary things for you and 'on demand'  ;)
http://dribbble.com/shots/581129-Fonts-Window-UI?list=popular&offset=4

Was just the same property, the code responsible for doing the drawing and the autosize depending of the value of the shadow offset is the code I've changed. Check line 717 (and also 737) in BGRAButton unit. And maybe (I don't remember) some code in the DrawText.
Title: Re: BGRAControls
Post by: Dibo on June 04, 2012, 08:25:08 pm
I have commited new version (svn&git). BCFont can handle now negative text shadow offset
Title: Re: BGRAControls
Post by: lainz on June 05, 2012, 11:30:04 pm
I have commited new version (svn&git). BCFont can handle now negative text shadow offset

Nice it works!
Title: Re: BGRAControls
Post by: lainz on July 09, 2012, 08:01:30 pm
I'm now with Windows 8, the desktop UI is really much faster...

The ribbon apps now don't has selected group animations with focus, no animations at all (jus a fade for the tabs), no gradients. Also the ribbon groups (groups of controls I say) are just separated with a single pixel line.

Most controls are plain color with a border, and a slight fade animation.

It has less 3d elements than Win9x.

Imagine you can draw an UI with MsPaint: this is Windows 8.

----------------

Metro: the apps in the 'Start' has very slight gradients with a single pixel border, and a double border of more pixels when it's selected. Those has basically text and scalable images, but some has also bitmaps. All the UI of Metro has a color as background or a picture, a color for selected items, a color for hover, lines, etc.. no gradients no bitmaps, only scalable images.

Just some animations but that's all.

The UI is more minimalist than Android.

----------------

Maybe I'm missing something..
Title: Re: BGRAControls
Post by: LA.Center on July 11, 2012, 09:25:12 am
I think you are looking at Metro Basic Style which is designed for PC's that don't meet the min. hardware requirements, have also a look at Metro Aero Style which is quite attractive, translucent, and colorful if you ask me.
Title: Re: BGRAControls
Post by: lainz on July 16, 2012, 11:57:01 pm
What are the min for metro aero?

Well today is launched the new office beta, i will check it too, seems that has the ribbon like in the prev versions.

Edit: office is like another metro app (style) with the same windows ribbon..
Title: Re: BGRAControls
Post by: LA.Center on July 18, 2012, 07:11:22 am
@lainz
I think the minimum Computer Rating is 2.0 to be able to have Aero, but there are also limitations like if you have Home Basic Edition then Aero is not supported etc.

You can check your rating from the System Control Panel and click on the "Windows Experience Index" or "Your computer is not rated yet" link
Title: Re: BGRAControls
Post by: lainz on July 18, 2012, 05:01:13 pm
I'll check it, BTW aero is working in Desktop, but not in Metro. I'm using the release preview of Win 8.

BTW if I have free time I'll start to do something, maybe using BGRA or maybe with custom drawn.
Title: Re: BGRAControls
Post by: Tankard on July 23, 2012, 05:11:19 pm
Hi guys,

i have some problems with TBCPanel,  i fixed some part of it.
If you want to use the Rounding property for the panel you get an nasty black color at the corners. See for it attached picture named notOK.png. With the fix addressed below you can get the result seen in the attachment nearlyOk.png.

What still isn't working, is if you're using a rounded panel on a panel or a background image and above that a rounded panel. You will get the same result you see in the picture nearlyOk.png.

Does anybody have a solution for that problem?
Adding
Code: [Select]
FBGRA.GetImageFromCanvas(Canvas,0,0); to the Render function doesn't work either.


I changed the procedure TCustomBCPanel.DrawControl  to the following code:
Code: [Select]
procedure TCustomBCPanel.DrawControl;
begin
  inherited DrawControl;
  if FBGRA.NeedRender then
    Render;
  if Assigned (FRounding) then
    if (FRounding.RoundX<>0) and (FRounding.RoundY<>0) then
      FBGRA.Draw(Self.Canvas, 0, 0, False)
    else
      FBGRA.Draw(Self.Canvas, 0, 0)
  else
    FBGRA.Draw(Self.Canvas, 0, 0);
end;         
Title: Re: BGRAControls
Post by: Dibo on July 25, 2012, 10:20:59 pm
Thanks Tankard for your patch, I will check it soon, I'm now on holidays ;)
Title: Re: BGRAControls
Post by: Gintas on July 26, 2012, 04:56:34 pm
I am getting a distorted image when using most of the BGRAControls like TBGRAImageButton,TBGRAButton and it's same with BGRA uEControls.

The result is on attached image. The TImage control works just fine and TBGRAImageButton displays the images totally wrong. Seems to be some problem by getting image from TPicture.
I am using Windows XP 32-bit with a CodeTyphon 2.70 (Lazarus 1.1.0,FPC 2.7.1)   and latest BGRAControls
from today SVN.
Title: Re: BGRAControls
Post by: Dibo on August 02, 2012, 09:34:37 pm
Does anybody have a solution for that problem?
Adding
Code: [Select]
FBGRA.GetImageFromCanvas(Canvas,0,0); to the Render function doesn't work either.
This is known problem of controls which not inherit from TGraphicControl, but from TCustomControl (containers like TPanel etc.). Some user posted on this forum "hack" for windows, but problem still exists on other interfaces
Title: Re: BGRAControls
Post by: Dibo on August 02, 2012, 09:41:08 pm
I commited new version 2.0.4

Changes:
Title: Re: BGRAControls
Post by: picstart on August 03, 2012, 07:10:54 pm
Possible issue with BGRAIMageButton 1.ORC1 FPC2.6 WIN7 32 bit.
A   BGRAIMageButton is placed on a form and a bmp associated with it. Alone the button performs OK.
Now suppose the caption is ButtonA and in the IDE the button is copied and pasted to the Form.
A new button now exists ButtonA has BGRAIMageButton1 and the new one BGRAIMageButton2.
BGRAIMageButton2 's caption is changed to ButtonB. This is repeated so the form has Buttons A..D
Now if any of buttons B thru D get programatically checked then then Button A will show the checked image instead.
It is as if there is a pointer to the button image display state that is left always pointing to Button A ( the original that was cloned by copy paste) Info code is BGRAIMageButtonx.Checked:=true where x is 2 thru 4
The work around is not to do this and create the buttons one by one using the BGRA Controls component palette.
Title: Re: BGRAControls
Post by: circular on August 04, 2012, 11:16:45 pm
Apparently there is a problem with resizing and autosize with BGRALabelFX.

This code seems to fix those issues :
Code: [Select]
unit BGRALabelFX;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Controls, Graphics,
  BGRABitmap, BGRABitmapTypes, BGRATextFXTypes, BGRATextFX, types;

type

  { TBGRALabelFX }

  TBGRALabelFX = class(TGraphicControl)
  private
    FBGRA:    TBGRABitmap;
    FTextEffect: TBGRATextEffect;
    FOutline: TBGRATextEffectOutline;
    FShadow:  TBGRATextEffectShadow;
    FPreviousCaption: string;
    FPreviousFont: TFont;
  protected
    procedure Paint; override;
    procedure RealSetText(const Value: TCaption); override;
    procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
      WithThemeSpace: boolean); override;
    procedure UpdateTextEffect;
  public
    function Draw: TBGRABitmap;
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    property Action;
    property Align;
    property AutoSize;
    property Caption;
    property Font;
    property PopupMenu;
    property Outline: TBGRATextEffectOutline Read FOutline Write FOutline;
    property Shadow: TBGRATextEffectShadow Read FShadow Write FShadow;
    property OnClick;
    property OnDblClick;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
    property OnMouseEnter;
    property OnMouseLeave;
  end;

procedure Register;

implementation

uses
  LResources;

procedure Register;
begin
  {$I bgralabelfx_icon.lrs}
  RegisterComponents('BGRA Controls', [TBGRALabelFX]);
end;

{ TBGRALabelFX }

procedure TBGRALabelFX.RealSetText(const Value: TCaption);
begin
  inherited RealSetText(Value);

  if Value <> FPreviousCaption then Invalidate;
  InvalidatePreferredSize;
  AdjustSize;
end;

procedure TBGRALabelFX.CalculatePreferredSize(var PreferredWidth,
  PreferredHeight: integer; WithThemeSpace: boolean);
var
  s: TSize;
  ax, ay: integer;
begin
  UpdateTextEffect;
  s.cx := FTextEffect.Width;
  s.cy := FTextEffect.Height;

  if FShadow.Visible then
  begin
    if FShadow.OffsetX < 0 then
      ax := (FShadow.OffsetX) - (FShadow.OffsetX * 2)
    else
      ax := FShadow.OffsetX;

    if FShadow.OffsetY < 0 then
      ay := (FShadow.OffsetY) - (FShadow.OffsetY * 2)
    else
      ay := FShadow.OffsetY;

    Inc(s.cx, 2 * ax + 2 * FShadow.Radius);
    Inc(s.cy, 2 * ay + 2 * FShadow.Radius);
  end;

  PreferredWidth := s.cx;
  PreferredHeight := s.cy;
end;

procedure TBGRALabelFX.UpdateTextEffect;
var NewCaption: string;
begin
  if FTextEffect = nil then exit;
  NewCaption := Caption;
  if (NewCaption <> FPreviousCaption) or
    (Font.Name <> FPreviousFont.Name) or
    (Font.Style <> FPreviousFont.Style) or
    (Font.Quality <> FPreviousFont.Quality) or
    (Font.Orientation <> FPreviousFont.Orientation) or
    (Font.Pitch <> FPreviousFont.Pitch) or
    (Font.Height <> FPreviousFont.Height) or
    (Font.CharSet <> FPreviousFont.CharSet) then
  begin
    FreeAndNil(FTextEffect);
    FTextEffect := TBGRATextEffect.Create(NewCaption, Font, True);
    FPreviousFont.Assign(Font);
    FPreviousCaption := NewCaption;
  end;
end;

procedure TBGRALabelFX.Paint;
var
  cx, cy, px, py: integer;
  ax, ay: integer;
  shx, shy: integer;
begin
  ax := 0;
  ay := 0;

  if FShadow.Visible then
  begin
    if FShadow.OffsetX < 0 then
      ax := (FShadow.OffsetX) - (FShadow.OffsetX * 2)
    else
      ax := FShadow.OffsetX;

    if FShadow.OffsetY < 0 then
      ay := (FShadow.OffsetY) - (FShadow.OffsetY * 2)
    else
      ay := FShadow.OffsetY;

    ax := 2 * ax + 2 * FShadow.Radius;
    ay := 2 * ay + 2 * FShadow.Radius;
  end;

  UpdateTextEffect;

  InvalidatePreferredSize;
  AdjustSize;

  FBGRA.Free;
  FBGRA := TBGRABitmap.Create(FTextEffect.Width + ax,
    FTextEffect.Height + ay);

  { taCenter }
  cx := trunc((FBGRA.Width - FTextEffect.Width) / 2);
  cy := trunc((FBGRA.Height - FTextEffect.Height) / 2);
  px := trunc((Width - FBGRA.Width) / 2);
  py := trunc((Height - FBGRA.Height) / 2);

  if FShadow.OffsetX < 0 then
    shx := - FShadow.OffsetX + FShadow.Radius
  else
    shx := 2 * FShadow.OffsetX + integer(FSHadow.Radius);

  if FShadow.OffsetY < 0 then
    shy := - FShadow.OffsetY + FShadow.Radius
  else
    shy := 2 * FShadow.OffsetY + integer(FShadow.Radius);

  if FShadow.Visible then
    FTextEffect.DrawShadow(FBGRA, shx,
      shy,
      FShadow.Radius, ColorToBGRA(FShadow.Color, FShadow.Alpha));

  if FOutline.Visible then
    FTextEffect.DrawOutline(FBGRA, cx + FOutline.OffsetX, cy + FOutline.OffsetY,
      ColorToBGRA(FOutline.Color, FOutline.Alpha));

  FTextEffect.Draw(FBGRA, cx, cy, ColorToBGRA(Font.Color, 255));

  FBGRA.Draw(Self.Canvas, px, py, False);
end;

function TBGRALabelFX.Draw: TBGRABitmap;
begin
  Result := FBGRA.Duplicate as TBGRABitmap;
end;

constructor TBGRALabelFX.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  SetInitialBounds(0, 0, 24, 24);
  Font.Height := 24;
  FBGRA := TBGRABitmap.Create;
  FTextEffect := TBGRATextEffect.Create(Caption, Font, True);
  FPreviousCaption:= Caption;
  FPreviousFont := TFont.Create;
  FPreviousFont.Assign(Font);
  FOutline := TBGRATextEffectOutline.Create(Self);
  FShadow := TBGRATextEffectShadow.Create(Self);
  //
  AutoSize := True;
  FShadow.OffsetX := 0;
  FShadow.OffsetY := 0;
  FShadow.Radius := 5;
end;

destructor TBGRALabelFX.Destroy;
begin
  FBGRA.Free;
  FTextEffect.Free;
  FPreviousFont.Free;
  FOutline.Free;
  FShadow.Free;
  inherited Destroy;
end;

end.
Title: Re: BGRAControls
Post by: lainz on August 07, 2012, 12:42:19 am
Thanks for the fix, Dibo you can apply it?

picstart, if you can fix this bug, i'm not using lazarus for a long time..
Title: Re: BGRAControls
Post by: Hydexon on August 07, 2012, 10:49:16 pm
An extension for TGroupBox?, for example an Office-2007 Styled Groupbox?
Title: Re: BGRAControls
Post by: Dibo on August 08, 2012, 12:29:35 am
I commited version 2.0.5 with TBGRALabelFx fix, thanks circular

i'm not using lazarus for a long time..
Tell us with whom you betray us ;D
Title: Re: BGRAControls
Post by: circular on August 08, 2012, 07:13:19 pm
Let's show compassion for Lainz. We are free to choose any tribe we want.  8)
Title: Re: BGRAControls
Post by: lainz on August 09, 2012, 12:47:41 am
Basically for study =) I need to graduate at my current career that isn't directly related with programming.

The main thing is I like a lot of tribes of very different interests!
Title: Re: BGRAControls
Post by: lainz on August 13, 2012, 04:52:39 pm
anyway, lazarus has a mystical power that keeps them coming back

- testbgracontrols repaired (removed nonexistent property in bcpanel) in SVN (please update GIT with this).
Title: Re: BGRAControls
Post by: circular on August 16, 2012, 03:44:15 pm
lol

Well the only mystical power I can see in Lazarus is that it is non obscure programming thanks to Pascal syntax. :)
Title: Re: BGRAControls
Post by: JD on August 16, 2012, 04:39:38 pm
lol

Well the only mystical power I can see in Lazarus is that it is non obscure programming thanks to Pascal syntax. :)

I fully agree. That is the only hypnotic power that Lazarus /FPC has over its users.  :D
Title: Re: BGRAControls
Post by: lainz on September 01, 2012, 07:54:48 pm
Well now we have lazarus 1.0 and now it comes with customdrawn.

- Small fix to 'customdrawn_win7' that comes with BGRAControls (in SVN repo).
Title: Re: BGRAControls
Post by: circular on September 08, 2012, 07:24:20 pm
Yes, Customdrawn is rather cool.
Title: Re: BGRAControls
Post by: Dibo on September 08, 2012, 07:29:56 pm
I tried Custom Drawn lately. It looks very promising, but seems that TCDListview is not done yet?
Title: Re: BGRAControls
Post by: lainz on September 10, 2012, 02:58:06 am
There are some other 'skins' (drawers) for custom drawn others than the only one I've done? (also that don't come with Lazarus please =)
Title: Re: BGRAControls
Post by: lainz on October 07, 2012, 12:25:32 am
I think that a new kind of button can be PhongButton, like bgraknob drawing style.

Instead using a Hover state, this has 2 colors, one for the normal stage and other for the pressed one.

The hover is a light moving around, like in the BGRABitmap tutorial 9.

it remembers me the Windows 7 effect in the taskbar icons.

Attached a picture and basically the same code used in the tutorial with text and controls to change some of the values.

PD; try changing the line 75 with this, is really amazing =)

  phong.DrawRectangle(Bitmap,rect(20,20,Bitmap.Width - 20,Bitmap.Height - 20),10,SpinEdit2.Value,color1, True, []);   
Title: Re: BGRAControls
Post by: Dibo on October 07, 2012, 11:55:44 am
Looks great :)
Title: Re: BGRAControls
Post by: martinrame on October 11, 2012, 12:42:36 pm
I'm using TBGRAVirtualScreen for drawing into a quite big area that adapts to window size, some times this area can be full screen, and could contain many objects, like lines, circles and pictures, more or less like a photoshop picture.

I'm wondering if this component has "regions". This way, when I only need to refresh part of the bitmap, it will be faster than repainting the whole component.
Title: Re: BGRAControls
Post by: lainz on October 14, 2012, 10:38:01 pm
As I know it hasn't regions.

- Updated BGRAControls SVN: small fixes in Custom Drawn Windows 7 Drawer. If someone has patches for this drawer are greatly apreciated.
- There's a problem creating TBGRAMultiSliceScaling from INI, can't set some properties. (To see the problem check the customdrawn_windows7).
Title: Re: BGRAControls
Post by: circular on October 20, 2012, 12:45:31 pm
Here is a patch :
- using lastest svn of BGRABitmap with unit BGRASliceScaling
- optimization of slice scaling loading
- modified skin files :
  o Using ".\" to specify ini folder
  o "Repeat" to defined repeat options for all items, "Repeat1","Repeat2"... to define repeat options for a specific item

EDIT: patch posted
Title: Re: BGRAControls
Post by: lainz on October 20, 2012, 04:50:40 pm
Thankyou, now it loads much faster.

Dibo please update Git repository.
Title: Re: BGRAControls
Post by: lainz on October 21, 2012, 10:39:33 pm
I've uploaded BGRAControls 2.0.6.0 alpha:

https://sourceforge.net/projects/bgracontrols/files/?

I think that people can help us to improve it since BGRAControls 1.4.0.1

Please use latest lazarus SVN and BGRABitmap SVN with this version.

Changes:
- Added BC Controls.
- Removed deprecated units (see readme.txt)
- Improved Custom Drawn Windows 7 Drawer
- Improved BGRAImageButton with BGRASliceScaling
- Added more test projects
Title: Re: BGRAControls
Post by: Dibo on October 22, 2012, 12:09:34 pm
Good idea, thanks
Title: Re: BGRAControls
Post by: Dibo on October 22, 2012, 05:04:39 pm
I have synchronized git with svn
Title: Re: BGRAControls
Post by: lainz on October 22, 2012, 05:56:33 pm
I have synchronized git with svn

Thanks =)

- I have my own suggestions to the package xD:
-- BGRASpriteAnimation is really slow, I need to recreate this with BGRASliceScaling
-- BGRAImageButton can be faster, is using BGRASliceScaling, but it needs improvements.
-- Win7ToolBar: also this can use BGRASliceScaling and load the background from an image, and use BGRAImageButton instead BGRAButton, to have unique looks.
-- Also panels can have unique looks easily using BGRASliceScaling. We can store inside the bitmap the borders and the fill for the panel.
Title: Re: BGRAControls
Post by: Dibo on October 22, 2012, 06:49:53 pm
What exactly do BGRASliceScaling? I saw posts about it on forum, but never had enough time to look at it
Title: Re: BGRAControls
Post by: circular on October 22, 2012, 07:54:02 pm
It resizes an image, but the 9 slices (3 horizontally and 3 vertically) are scaled separately, so that you can have an image of a small button and stretch it nicely.
Title: Re: BGRAControls
Post by: Dibo on October 22, 2012, 08:39:39 pm
Is it faster than redrawing whole button?
Title: Re: BGRAControls
Post by: lainz on October 23, 2012, 03:42:13 am
Is it faster than redrawing whole button?

Is faster than BGRAImageButton (that was using BGRABitmapThemeUtils) because the code for slice scaling the image is optimized by circular =)

Is faster than BGRASpriteAnimation because in BGRASpriteAnimation I strp each frame of the bitmap in each frame redraw, the whole component isn't optimized. With a TTimer and a TBGRAMultiSliceScaling I can load and draw each frame faster.

It can be faster than drawing from BGRABitmap (well, I don't know), because for example I can apply effects to the button in Photoshop (i.e layer styles) and save it to a png file, then load with BGRASliceScaling and is just stretching and drawing a bitmap, all the effects are in the plain png.

To understand how it works, test the customdrawn_windows7 and see the code, for example, to draw a button or to draw a progress bar.

Edit: or just run the customdrawn_windows7 project and clic 'Debug' button, and move the sliders to change the progressbar percent, you'll understand it quickly.
Title: Re: BGRAControls
Post by: Dibo on October 23, 2012, 02:06:08 pm
I can't run this demo, I get SIGSEGV error in line 285 of BGRASliceScaling unit. But I understand how it working. This bring me old idea which you are implementing.
Creating GUI by using gimp/photoshop is much easier than doing this programatically. So I wanted create some style manager (or custom drawn drawer) which only manage mouse and controls states, and all styles are just PNG images. Drawing ready png image should be faster than whole complicated mathematic drawing. This solution powered by BGRABitmap tools give unlimited possibilities for creating modern and nice looking GUI like in web applications. I'm realy impressend with BGRAImageButton and it animation property.
Just imagine this GUI sliced to separated png files and managed by style manager:
http://dribbble.s3.amazonaws.com/users/13307/screenshots/562878/attachments/42390/Full-size.jpg

But I stuck with resizing problem and seems that your slice tool is solution
Title: Re: BGRAControls
Post by: Osvaldo Arruda on October 23, 2012, 02:30:55 pm
when the novel ends and when the bug will be fixed in svn and posted for us to test? I can not install the component in Lazarus 1.0.3
Title: Re: BGRAControls
Post by: Dibo on October 23, 2012, 02:40:40 pm
You mean bug in ubuntu (GTK)? I found what was a problem and waiting for response on lazarus bugtracker. If you don't want wait for solution, you can easily fix it:

1. Open file BGRAGtkBitmap.pas from BGRABitmap package
2. Go to method TBGRAGtkBitmap.DrawTransparent
3. Replace this existing code:
Code: Pascal  [Select][+][-]
  1.   gdk_pixbuf_render_to_drawable(FPixBuf,
  2.     TGtkDeviceContext(ACanvas.Handle).Drawable,
  3.     TGtkDeviceContext(ACanvas.Handle).GC,
  4.     0,0,
  5.     TGtkDeviceContext(ACanvas.Handle).Offset.X+Rect.Left,
  6.     TGtkDeviceContext(ACanvas.Handle).Offset.Y+Rect.Top,
  7.     Width,Height,
  8.     GDK_RGB_DITHER_NORMAL,0,0);  
  9.  

by:
Code: Pascal  [Select][+][-]
  1.   gdk_pixbuf_render_to_drawable(FPixBuf,
  2.     TGtkDeviceContext(ACanvas.Handle).Drawable,
  3.     TGtkDeviceContext(ACanvas.Handle).GC,
  4.     0,0,
  5.     TGtkDeviceContext(ACanvas.Handle).ClipRect.X+Rect.Left,
  6.     TGtkDeviceContext(ACanvas.Handle).ClipRect.y+Rect.Top,
  7.     Width,Height,
  8.     GDK_RGB_DITHER_NORMAL,0,0);  
  9.  

4. Rebuild/reinstal BGRABitmap package
Title: Re: BGRAControls
Post by: Osvaldo Arruda on October 23, 2012, 02:52:13 pm
the problem may be that, but it is not the only.

[ unit bgragtkbitmap.pas ]

{$IFDEF LCLgtk2}
type TGtkDeviceContext = TGtk2DeviceContext;
{$ENDIF}

/home/osvaldo/lazarus/components/bgrabitmap/bgragtkbitmap.pas(70,44) Error: Identifier not found "TGtk2DeviceContext"

???
Title: Re: BGRAControls
Post by: Dibo on October 23, 2012, 02:54:32 pm
Comment this type
Title: Re: BGRAControls
Post by: lainz on October 23, 2012, 03:11:59 pm
I can't run this demo, I get SIGSEGV error in line 285 of BGRASliceScaling unit. But I understand how it working. This bring me old idea which you are implementing.
Creating GUI by using gimp/photoshop is much easier than doing this programatically. So I wanted create some style manager (or custom drawn drawer) which only manage mouse and controls states, and all styles are just PNG images. Drawing ready png image should be faster than whole complicated mathematic drawing. This solution powered by BGRABitmap tools give unlimited possibilities for creating modern and nice looking GUI like in web applications. I'm realy impressend with BGRAImageButton and it animation property.
Just imagine this GUI sliced to separated png files and managed by style manager:
http://dribbble.s3.amazonaws.com/users/13307/screenshots/562878/attachments/42390/Full-size.jpg

But I stuck with resizing problem and seems that your slice tool is solution

Exactly. I you has the PSD source is easy to export each button to PNG and then slice scale.
Title: Re: BGRAControls
Post by: Osvaldo Arruda on October 23, 2012, 03:41:35 pm
Very good, but ... the executable size, hehehehe

thanks all
Title: Re: BGRAControls
Post by: Dibo on October 23, 2012, 04:06:16 pm
Very good, but ... the executable size, hehehehe
?
Exactly. I you has the PSD source is easy to export each button to PNG and then slice scale.
What about this SIGSEGV error?
Title: Re: BGRAControls
Post by: lainz on October 23, 2012, 04:27:48 pm
Very good, but ... the executable size, hehehehe
?
Exactly. I you has the PSD source is easy to export each button to PNG and then slice scale.
What about this SIGSEGV error?

I think that the executable size is about putting all the bitmaps in the 'Bitmap' property, that Isn't recommendable, maybe in future in BGRAImageButton I'll delete that property and just use directly the bitmap property of the BGRASliceScaling.

About the error I've no idea, I'm using Windows, latest svn of BGRA and latest svn of Lazarus.
Title: Re: BGRAControls
Post by: Dibo on October 23, 2012, 09:04:40 pm
Lainz, could you create some simple tutorial how to use BGRASliceScaling?  I can't run demo on linux
Title: Re: BGRAControls
Post by: lainz on October 24, 2012, 12:42:30 am
Lainz, could you create some simple tutorial how to use BGRASliceScaling?  I can't run demo on linux

Well If this test project works for you, the problem is in TBGRAMultiSliceScaling and not in TBGRASliceScaling.

If this doesn't works, I've no idea.

How to use it: change the size of the Window. And if you want to hide the red lines, edit the code and set the boolean value to false.
Title: Re: BGRAControls
Post by: circular on October 24, 2012, 06:59:27 pm
It's not about speed, but about having various kinds of buttons, that would be complicated to do otherwise.
Title: Re: BGRAControls
Post by: lainz on October 25, 2012, 02:58:05 pm
Ok.

BTW Dibo it works or not for you?
Title: Re: BGRAControls
Post by: Dibo on October 25, 2012, 03:37:31 pm
Yes, it is working very well. I forgot to answer
Title: Re: BGRAControls
Post by: lainz on October 25, 2012, 04:01:47 pm
Yes, it is working very well. I forgot to answer

All or just the test. Maybe in the custom drawn drawer there's some problem with the path in the ini.
Title: Re: BGRAControls
Post by: Dibo on October 25, 2012, 04:07:27 pm
Working test project which you attached. Demo from BGRAControls package still doesn't work
Title: Re: BGRAControls
Post by: lainz on October 25, 2012, 07:31:02 pm
I have to reinstall linux, 22gb are ok for ubuntu, lazarus and bgra?
Title: Re: BGRAControls
Post by: fabienwang on October 25, 2012, 10:10:09 pm
I have to reinstall linux, 22gb are ok for ubuntu, lazarus and bgra?

yes, quite enough !
Title: Re: BGRAControls
Post by: lainz on October 26, 2012, 04:03:23 am
Well but first.

Dibo test again the customdrawn_windows7 in the svn repo project, I've updated the 'aero' skin.ini with the relative path.

If doesn't works, attached there are 2 test.

Test1 folder:
- TBGRAMultiSliceScaling from ini

Test2 folder:
- TBGRAMutliSliceScaling from png and options inside the code

-- If Test1 doesn't works, try to modify the path of the bitmap in the ini. If also doesn't works try test 2.
Title: Re: BGRAControls
Post by: Dibo on October 26, 2012, 12:54:20 pm
customdrawn_windows7 still doesn't work after svn update. But attached Test1 and Test2 working fine
Title: Re: BGRAControls
Post by: lainz on October 26, 2012, 02:14:15 pm
Thankyou! Well is something in the drawer.
Title: Re: BGRAControls
Post by: lainz on October 27, 2012, 04:30:06 am
Test it again :P

I've changed the '\' with "pathdelim" in svn.

If doesn't works, please check the debugger line where the drawer do the error, not in the bgraslicescaling.pas unit, in customdrawn_windows7.pas the 'blue' points that appear in the source code editor..

PD: i'm saying the 'blue pints in the source code editor' because I don't know how to name it
Title: Re: BGRAControls
Post by: Dibo on October 27, 2012, 12:06:12 pm
Now it is working. Thanks!
Title: Re: BGRAControls
Post by: Osvaldo Arruda on October 27, 2012, 01:07:19 pm
http://www.lazarus.freepascal.org/index.php/topic,18714.0.html

http://www.lazarus.freepascal.org/index.php/topic,18713.0.html


Do not come to opine about the bugs found? This is how we do, support zero ... alright

 :-[
Title: Re: BGRAControls
Post by: lainz on October 27, 2012, 01:14:36 pm
Now it is working. Thanks!

=)

http://www.lazarus.freepascal.org/index.php/topic,18714.0.html

http://www.lazarus.freepascal.org/index.php/topic,18713.0.html


Do not come to opine about the bugs found? This is how we do, support zero ... alright

 :-[

=)
Title: Re: BGRAControls
Post by: freeman35 on October 29, 2012, 06:08:26 pm
Hello,
I installed BGRA bitmap and controls packs, when I put bgrabitmap on new empty form, not painting. IDE move and change size on form, but component not draw, anythink. No color no caption. But, if move bgrabutton's left-top corner to form's  left,top corner (left=1 and top=1) , can see all.(color & caption etc.)  if resize button from bottom & rigth corner of bgra button its okey, but if move button by mouse, painting allways start left=1, top=1 point of form('s canvas I think). Button not painting. not just bgrabutton, All control is same, if I put more then one button, allof them paint 1,1 point
In demo programs is same no error wile building and running but no any painting, just empty form. This bug buttons, labels, BGRAImageButton draw picture similar, add bitmap, not draw, but move by mouse to left,top corner of form, draw then, Canvas coordinate left&top always 1. Work like this

2 time I delete all lazarus and freepascal & reinstall, I tryed snapshot build lazarus aswell
My sytem is
debian wheezy
Kernel 3.2.0.3 AMD64
KDE 4.8.4
compiz 0.8.4
lazarus 1.1 20121029
fpc 2.6.0.6
Title: Re: BGRAControls
Post by: Dibo on October 29, 2012, 06:45:20 pm
@freeman35: Look at this temporary solution: http://www.lazarus.freepascal.org/index.php/topic,12411.msg105592.html#msg105592

Some major changes are implementing in GTK in lazarus from SVN, I reported it on bugtracker. But I see that you are using KDE, so maybe this same issue with QT
Title: Re: BGRAControls
Post by: freeman35 on October 29, 2012, 09:26:05 pm
@Dibo Thank you very much. Now everythink is work well.
Thank you fast answer. I was left delphi and windows. I'm trying as long as 5 weeks debian and lazarus. I was bored 'cos not much detail YET about lazarus. But your answer and your help been happy me :)
I hope so many people use lazarus and be popular
Title: Re: BGRAControls
Post by: Dibo on October 29, 2012, 09:50:11 pm
Nice to hear that you solved this problem, but where you did changes? On GTK source or QT? I know that this problem occur only on GTK but you are using KDE so QT widgetset should be a target (or you have changed targed in project options). Lazarus team are implementing some major changes on svn and i have no response on bug tracker topic, so I don't know what's going on
Title: Re: BGRAControls
Post by: circular on October 29, 2012, 10:06:34 pm
It seems that replacing offset by cliprect does work. Should I change BGRABitmap source to this ? I fear it will not work anymore on older versions, and also this just does not make sense. I mean there is no guarantee that the clipping rectangle be equals to the canvas offset.
Title: Re: BGRAControls
Post by: Osvaldo Arruda on October 29, 2012, 10:48:48 pm
should yes. not need compatibility with earlier versions.

It seems that replacing offset by cliprect does work. Should I change BGRABitmap source to this ? I fear it will not work anymore on older versions, and also this just does not make sense. I mean there is no guarantee that the clipping rectangle be equals to the canvas offset.
Title: Re: BGRAControls
Post by: freeman35 on October 30, 2012, 10:06:46 am
@Dibo Sorry for late answer
I did what wrote on your sended link, thats all.
TBGRAGtkBitmap.DrawTransparent in BGRAGtkBitmap.pas  changeed "Offset" to "ClipRect" and then rebuild.
In first message I was write my system. Debian wheezy amd64, KDE 4.8.4 & gnome 3.4.2  I tested in gnome too and no problem, bitmaps, labels are normal painting now.
I'm new in linux and lazarus, so actually use everything is default settings. and sorry I didn't understand yet GTK and QT whats mean. yet :( I'm still learning mode :)
How to test. Open new project and put components on form. Project options, lazarus options etc. all settings is default.
Title: Re: BGRAControls
Post by: circular on October 30, 2012, 10:55:48 am
Ok so what I did I updated SVN with ClipRect fix, and did not publish a new version of BGRABitmap yet. So people that want to use last SVN for Lazarus and BGRABitmap can, and people that just use Lazarus 1.0 can stay with last zip. Alright?
Title: Re: BGRAControls
Post by: Dibo on October 30, 2012, 12:53:50 pm
Sounds good
Title: Re: BGRAControls
Post by: lainz on October 30, 2012, 03:26:34 pm
It has sense.
Title: Re: BGRAControls
Post by: lainz on November 04, 2012, 05:12:19 am
Hi, I've updated the svn with a small change, but hope it help to someone interested to create nice skins for their applications:

- Updated customdrawn_windows7, added 'extra' folder, basically it's the same than 'aero' with 2 differences, it has a 3d button with shadow, really nice, and the progress bar (as you'll see, it needs to improve the code when drawing the progress in the lowest positions).. well that's all for now, if I can find some nice UI in PSD format I can try to do a skin from that =)
Title: Re: BGRAControls
Post by: lainz on December 07, 2012, 02:28:36 pm
Hi again, I've changed the 'aerolite' (That comes in Windows 8, but isn't the default theme) folder and resources to 'aerow8' (Aero Windows 8 ).

Check the screenshot, and dowload it in the BGRAControls SVN repository.
Title: Re: BGRAControls
Post by: lainz on December 17, 2012, 09:59:39 pm
Hi amazing people at lazarus and users of this bgra controls package yeaahh..  %)

In the BGRAControls SVN repo there is a new wip component that will replace TBGRAImageButton: TBCImageButton.

The new features are:
- Stretch, Center and Proportional properties, like TImage.
- Now it's using al BGRASliceScaling features like AutoDetectRepeat, RepeatMiddleHorizontal and RepeatMiddleVertical (to improve speed and create textured buttons)
-  new component called TBCGraphicButton (TBCGraphicControl descendant - this component makes it more than ordered and precise -) wich has basic button behavior (no graphics), TBCCustomImageButton is inherited from this.

Attached a test with the images you already know, notice that now you can set top, bottom, left and right border options!!! (the old one has 2).

- ToDo: whole.. but just test it. and if you can help me or completely destroy and optimize my component thanks :)

PD: you can enable and disable debug like in TBGRAImageButton.. just write 'off' in the define debug.
Title: Re: BGRAControls
Post by: Dibo on December 18, 2012, 07:41:29 am
Looks great. I still have no time to test BGRASliceScaling in action :/
Title: Re: BGRAControls
Post by: lainz on December 26, 2012, 05:13:00 pm
Looks great. I still have no time to test BGRASliceScaling in action :/

Oh well check this:

(You need the 'terrain.png' attached).

Code: [Select]
  public
    { public declarations }
    textures: TBGRAMultiSliceScaling;
  end;

...

const
  mapa =
    '5555555559' +
    '5777777759' +
    '5777777759' +
    '5333333359' +
    '5222222259' +
    '5222222259' +
    '5555555559';

...

procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
const
  bloquew = 48;
  bloqueh = 48;
var
  n, n1, n2: integer;
  r: TRect;
begin
  n1 := 0;
  n2 := 0;

  for n := 1 to length(mapa) do
  begin
    r.Left := bloquew * n1;
    r.Top := bloqueh * n2;
    r.Right := r.Left + bloquew;
    r.Bottom := r.Top + bloqueh;
    case mapa[n] of
      '0'..'7': textures.Draw(StrToInt(mapa[n]),bitmap, r, false); 
      '9':
      begin
        n1 := -1;
        Inc(n2);
      end;
    end;
    Inc(n1);
  end;

end;

procedure TForm1.FormCreate(Sender: TObject);
var
  i: integer;
begin
  textures := TBGRAMultiSliceScaling.Create('terrain.png',0,0,0,0,8,sdHorizontal);
  for i:=0 to high(textures.SliceScalingArray) do
    textures.SliceScalingArray[i].ResampleMode:=rmSimpleStretch;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  textures.free;
end;
Title: Re: BGRAControls
Post by: lainz on December 31, 2012, 02:58:21 am
In my previous post I've shown an example with BGRASliceScaling and a map created from a string.

Now I've uploaded to BGRAControls SVN the 'Puzzle!' game source code. (http://lazarus.freepascal.org/index.php/topic,19367.msg110437/topicseen.html#new)

- Any improvements to this game are welcome.

Features:
- Phong Shading.
- FullScreen / Scaling.
- Sound (in Windows).
- Gamepad control (in Windows).
- Mouse and Keyboard control.
- Map loading, example:

Code: [Select]
  Game1: TGameMap = (map: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567809.-'; solve: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.-'; mapW: 8; mapH: 8;
  blockW: 128; blockH: 128; background: nil);

- Etc..

It comes with 12 levels, a level commented, and a game-over level

Enjoy, go and improve this code  8)
Title: Re: BGRAControls
Post by: digeo on January 25, 2013, 09:48:29 pm
How do I go about adding a white layer to an image to give better glass effect. I have a bgravirtualscreen as taskbar. then i copy the background image behind this bar and apply blur. I need better glass effect, like adding a white transparent layer.

So far I have:
Code: [Select]
procedure TfrmMain.vsTaskBarRedraw(Sender: TObject; Bitmap: TBGRABitmap);
var
   img : TBGRABitmap;
begin
  // Copy desktop area behind taskbar
  img := BackGroundImage.GetPart(vsTaskBar.BoundsRect) as TBGRABitmap;

  BGRAReplace(img, img.FilterBlurRadial(20, rbFast));

  Bitmap.PutImage(0, 0, img, dmSet);

  img.Free;
end;
Title: Re: BGRAControls
Post by: lainz on January 26, 2013, 01:48:49 am
How do I go about adding a white layer to an image to give better glass effect. I have a bgravirtualscreen as taskbar. then i copy the background image behind this bar and apply blur. I need better glass effect, like adding a white transparent layer.

So far I have:
Code: [Select]
procedure TfrmMain.vsTaskBarRedraw(Sender: TObject; Bitmap: TBGRABitmap);
var
   img : TBGRABitmap;
begin
  // Copy desktop area behind taskbar
  img := BackGroundImage.GetPart(vsTaskBar.BoundsRect) as TBGRABitmap;

  BGRAReplace(img, img.FilterBlurRadial(20, rbFast));

  Bitmap.PutImage(0, 0, img, dmSet);

  img.Free;
end;

And that layer you say is an image, a semi-transparent rectangle or what?

If is an image you can do

Code: [Select]
var
  bmpLayer: TBGRABitmap;

begin
  bmpLayer := TBGRABItmap.Create('image.png'); // add this OnCreate event of the form to create the bitmap only one time

  // i Don't know the coordinates you're using
  bitmap.PutImage(0,0, bmpLayer, dmDrawWithTransparency,100) ; // the last parameter is the level of transparency

bmpLayer.Free; // add this OnDestroy event

If is a rectangle

Code: [Select]
// i Don't know the coordinates you're using; see how we create the color BGRA(255,255,255,100) // the last parameter is the level of transparency
bitmap.Rectangle(0,0,width,height,BGRAWhite,BGRA(255,255,255,100),dmDrawWithTransparency);
Title: Re: BGRAControls
Post by: lainz on January 26, 2013, 02:40:53 am
maybe you're looking for something like this;

the bitmaps:
http://www.spectrumglass.com/stained-glass/img/products/cathedrals/1808RR.jpg
http://2.bp.blogspot.com/-F-uEEEmXvBk/UJ0zM0_i82I/AAAAAAAAAzk/6hF2f7CfUEI/s1600/fractal-art-pl2.jpg

the code:

Code: [Select]
unit umain;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
  BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes;

type

  { TForm1 }

  TForm1 = class(TForm)
    vsGlass: TBGRAVirtualScreen;
    procedure vsGlassRedraw(Sender: TObject; Bitmap: TBGRABitmap);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

  { TGlass }

  TGlass = class
  private
    FBackground, FLayer: TBGRABitmap;
    FBlur: integer;
    procedure SetFBackground(AValue: TBGRABitmap);
    procedure SetFBlur(AValue: integer);
    procedure SetFLayer(AValue: TBGRABitmap);
  public
    constructor Create;
    destructor Destroy; override;
    property BlurLevel: integer read FBlur write SetFBlur;
    property Background: TBGRABitmap read FBackground write SetFBackground;
    property Layer: TBGRABitmap read FLayer write SetFLayer;
    procedure Draw(Bitmap: TBGRABitmap; GlassRect: TRect; DrawLayer: boolean);
  end;

var
  Form1: TForm1;
  glassbkg: TGlass;

implementation

{ TGlass }

procedure TGlass.SetFBackground(AValue: TBGRABitmap);
begin
  if FBackground = AValue then
    Exit;
  FBackground := AValue;
end;

procedure TGlass.SetFBlur(AValue: integer);
begin
  if FBlur = AValue then
    Exit;
  FBlur := AValue;
end;

procedure TGlass.SetFLayer(AValue: TBGRABitmap);
begin
  if FLayer = AValue then
    Exit;
  FLayer := AValue;
end;

constructor TGlass.Create;
begin
  inherited Create;
  FBackground := TBGRABitmap.Create(0, 0);
  FLayer := TBGRABitmap.Create(0, 0);
  FBlur := 10;
end;

destructor TGlass.Destroy;
begin
  FBackground.Free;
  FLayer.Free;
  inherited Destroy;
end;

procedure TGlass.Draw(Bitmap: TBGRABitmap; GlassRect: TRect; DrawLayer: boolean);
var
  tbmp, tbkg, tlay: TBGRABitmap;
begin
  tbkg := TBGRABitmap.Create;
  BGRAReplace(tbkg, FBackground.Resample(Bitmap.Width, Bitmap.Height));
  if DrawLayer then
  begin
    tlay := TBGRABitmap.Create;
    BGRAReplace(tlay, FLayer.Resample(Bitmap.Width, Bitmap.Height));
  end;
  bitmap.PutImage(0, 0, tbkg, dmDrawWithTransparency);
  tbmp := tbkg.GetPart(GlassRect) as TBGRABitmap;
  BGRAReplace(tbmp, tbmp.FilterBlurRadial(BlurLevel, rbFast));
  if DrawLayer then
  begin
    tbmp.PutImage(0, 0, tlay, dmDrawWithTransparency);
    tlay.Free;
  end;
  bitmap.PutImage(GlassRect.Left, GlassRect.Top, tbmp, dmDrawWithTransparency);
  tbkg.Free;
  tbmp.Free;
end;

{$R *.lfm}

{ TForm1 }

procedure TForm1.vsGlassRedraw(Sender: TObject; Bitmap: TBGRABitmap);
var
  r: TRect;
begin
  r := Rect(0, Bitmap.Height - 75, Bitmap.Width, Bitmap.Height);
  glassbkg.Draw(Bitmap, r, True);
  bitmap.Rectangle(r, BGRA(0, 0, 0, 25), BGRA(0, 0, 0, 25),
    dmDrawWithTransparency);
  bitmap.DrawHorizLine(0, r.Top, r.Right, BGRA(0, 0, 0, 100));
  bitmap.DrawHorizLine(0, r.Top + 1, r.Right, BGRA(255, 255, 255, 100));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  glassbkg := TGlass.Create;
  glassbkg.Background.LoadFromFile('fractal-art-pl2.jpg');
  glassbkg.Layer.LoadFromFile('1808RR.jpg');
  glassbkg.Layer.AlphaFill(15);
  glassbkg.BlurLevel := 15;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  glassbkg.Free;
end;

end.
Title: Re: BGRAControls
Post by: digeo on January 26, 2013, 09:16:52 am
The last example is exactly what I was looking for. Love this library but sooo much to learn still.
Title: Re: BGRAControls
Post by: lainz on January 27, 2013, 10:40:28 pm
The last example is exactly what I was looking for. Love this library but sooo much to learn still.

The learning of this library never finish :)
Title: Re: BGRAControls
Post by: circular on January 28, 2013, 09:12:11 pm
 :)

I can suggest you to use BlendImageOver instead of PutImage :
Code: [Select]
BlendImageOver(x, y: integer; Source: TBGRACustomBitmap; operation: TBlendOperation; AOpacity: byte = 255;
        ALinearBlend: boolean = false);

In the code above :
Code: [Select]
bitmap.BlendImageOver(GlassRect.Left, GlassRect.Top, tbmp, boLighten, 255, True);
Linear blending is recommended for speed.
Title: Re: BGRAControls
Post by: lainz on January 29, 2013, 01:06:28 pm
Thanks I will try it.
Title: Re: BGRAControls
Post by: mora on February 04, 2013, 09:50:01 pm
Hello.

Thanks for nice BGRAControls components set.
I use it in my application and I've made some changes to TBCButton. May be someone will find it usefull too.

Here they are: 

1 ImageList and ImageIndex support
2. Improve TAction support
3. ClickOffset - boolean to disable text and glyph offset on mouse down
4. DropDownMenu - separate popup menu for drop down actions
5. DropDownArrow - boolean property to always show drop down arrow (even without bbtDropDown style)

In attachment is zip with modified BCButton.pas from last SVN revision and sample project.


Title: Re: BGRAControls
Post by: lainz on February 04, 2013, 10:33:20 pm
Thanks.

I've added your test and modifications. Really nice additions =)

I've tested it and works, but also other users please test.
Title: Re: BGRAControls
Post by: mora on February 05, 2013, 08:48:00 am
Thank you, lainz  :)

Here's another small suggestion:

May be it makes sense to make some TCustomBCButton methods (e.g. Render, RenderState) protected and virtual.
I guess it would be usefull in descendants.
Title: Re: BGRAControls
Post by: lainz on February 05, 2013, 02:08:13 pm
Ok, do the improvements you need and then publish a patch or the file again, so you can directly test if fit your needs, and then I can upload the changes.
Title: Re: BGRAControls
Post by: lainz on February 13, 2013, 02:33:23 am
Hi, I've updated BCGameGrid, it just works :D

PD: What you think about load from file / save to file TComponent descendants? http://stackoverflow.com/questions/698536/saving-a-tobject-to-a-file
Title: Re: BGRAControls
Post by: circular on February 13, 2013, 11:16:35 am
Hello, here is an optimization for game maze :
Title: Re: BGRAControls
Post by: lainz on February 13, 2013, 06:02:52 pm
Thankyou! I've updated SVN. @Dibo please update GIT.
Title: Re: BGRAControls
Post by: circular on February 13, 2013, 08:12:33 pm
Now I suppose it is fast enough for example to draw a phong shaded metal ball that runs through the maze.  8-)
Title: Re: BGRAControls
Post by: lainz on February 14, 2013, 03:37:20 am
Amazing speed =)

If you want add the phong shaded metal ball it will be nice to see.
Title: Re: BGRAControls
Post by: circular on February 14, 2013, 05:55:39 pm
Alright, here it is :
Title: Re: BGRAControls
Post by: lainz on February 15, 2013, 01:04:36 pm
Added. It's really funny better than a single block :)
Title: Re: BGRAControls
Post by: mora on February 15, 2013, 02:30:06 pm
Hi, all.

I've made some other improvements to BCButton:

1. DropDown optimization - preventing menu re show if user click button
    with menu already visible
2. DropDownPosition - dropdown area position - left (default) or bottom.
3. DropDownStyle - hottrack style of dropdown area - separate (default) or
    common (whole button)
4. ShowCaption - show/hide button caption
5. Some refactoring and bug fixing :)

I've modified sample project to better show these additions.
Also, I've included BCButton style (mora.bcbtn) which is used in my
application.

Please, see zip  in attachment and check this out.

----

I'm using BCPanel and BCButton to create nice looking toolbars :) (see. sample project) In normal state buttons have transparent background, but text is looks fuzzy.
Is there a way to fix it?

Title: Re: BGRAControls
Post by: lainz on February 15, 2013, 09:14:51 pm
Thanks. There was an option TextVisible in BGRAButton but seems that was removed for BCButton. Now is 'ShowCaption'  :D

Amazing!!! Let me attach a picture, is like a new component now!

Quote
I'm using BCPanel and BCButton to create nice looking toolbars  (see. sample project) In normal state buttons have transparent background, but text is looks fuzzy.
Is there a way to fix it?

Yes there's a way, don't use ClearType in fonts, instead use the BGRA style for drawing fonts...

Or don't use a transparent background if you want to use ClearType.
Title: Re: BGRAControls
Post by: mora on February 16, 2013, 08:37:47 pm
Glad to hear you like it :)

Quote
Or don't use a transparent background if you want to use ClearType.

Thank you, lainz. I've already found this :)
Title: Re: BGRAControls
Post by: circular on February 19, 2013, 12:21:55 am
Hello,

There seem to be a problem with BGRALabelFX with the latest version of BGRABitmap. The component crashes with the message "Access violation".

I'm not sure how to debug this.
Title: Re: BGRAControls
Post by: lainz on February 19, 2013, 04:28:35 am
I think that BGRATextFX component should be deleted, we have BCLabel that replaces it.

MM.. seems that BCLabel doesn't have 'Outline'.. Is the only missing property. For all others BCLabel is better.
Title: Re: BGRAControls
Post by: circular on February 19, 2013, 09:58:08 am
In this case, I would suggest to use the new font renderers in latest BGRABitmap.
http://wiki.freepascal.org/BGRABitmap_tutorial_Font_rendering
Title: Re: BGRAControls
Post by: lainz on February 19, 2013, 06:44:03 pm
Updates:
- Removed BGRALabel and BGRALabelFX- Instead use BCLabel. TODO: add new effects in BCLabel: http://wiki.freepascal.org/BGRABitmap_tutorial_Font_rendering

I don't know how to update the code without break the other controls that are using the BCFont.. it will be nice to have all the new effects in all the controls. So I left this job to Dibo that know how it works..

- I've added 'BCGameGrid' but maybe it should be optimized like circular optimized the 'maze game'.. or if is slower anyway remove or replace with other thing. Also improve the 'mouse' events.
Title: Re: BGRAControls
Post by: lainz on February 22, 2013, 04:07:07 pm
Hi, I think that is time to another alpha bgracontrols-2.0.8.0-alpha.zip

Download:
https://sourceforge.net/projects/bgracontrols/files/?

Removed
Dibo wants to remove old BGRA named controls when the new BC ones replaces them, well, just those:
- BGRALabel, BGRALabelFX: removed, use BCLabel instead that has a lot of new features like background, border, a lot of positions for caption, etc... Things to do: add the new font effects.

No other was removed by this reason:
- Some controls depends on others: Windows 7 ToolBar component needs BGRAButton. At least for now, If I update the toolbar we can delete BGRAButton.

Other changes:
- Added BCImageButton (- BGRAImageButton contains the Animation effect and I need to include in this new component, so it was not deleted for now).
- Added BCGameGrid
- Added more examples (some games), the folders was reorganized, so you can find the examples in a categorized way (BGRA named ones, BC named ones, and the extra examples).
- Improved examples (yes, is the best thing I do..) for example Custom Drawn Windows 7 now works on Linux (except for text, it has a 'yellow' background if I remember right, but you can change the ClearType for other and works)
- Added a lot of improvements to BCButton thanks to mora
Title: Re: BGRAControls
Post by: lainz on February 22, 2013, 06:46:43 pm
On SVN Revision 100: I've updated the package options, I've enabled optimization level 3 (-O3), Keep certain variables in registers(-Or).

Now each test project has two build modes: Debug (debug and Heaptrc unit) and Test (optimized for speed and executable size - smartlink, no debug, optimization level 3), by default this is the selected).

Everything seems to work fine, except BGRAImageButton test.
Title: Re: BGRAControls
Post by: Dibo on February 22, 2013, 06:48:00 pm
I must also update GIT
Title: Re: BGRAControls
Post by: Dibo on February 22, 2013, 07:13:15 pm
Ok. I commited all changes from SVN to GIT repo
Title: Re: BGRAControls
Post by: lainz on February 22, 2013, 07:21:12 pm
Thanks :)
Title: Re: BGRAControls
Post by: lainz on February 26, 2013, 09:24:50 pm
Hi all, I was trying to implement load from zip file for Custom Drawn Windows 7, seems that the files are loaded, but it has an error I can't find.. Try SVN bgracontrols\test_extra\slicescaling_customdrawn_win7.

Edit: If I comment line 440 (in the drawer unit) it works, but I get the heap  :o
Title: Re: BGRAControls
Post by: circular on February 27, 2013, 10:40:34 am
You can add parameter ABitmapOwner=True now when creating slice scaling.
Title: Re: BGRAControls
Post by: lainz on March 08, 2013, 03:03:54 am
BGRAControls 2.1

Important! Don't open old projects with this "version", save all your images stored inside controls before!

Note: I've checked it a lot, but if you found an unused file from an old component tell us.
Note2: If you want to use old components: You will need to update your projects with the new components from now, or use the older version or a mixed one that you can build by yourself :)

The goal of this was to remove outdated components and replace with the newest ones.

Styles: If you don't know the styles can be changed from style files in the IDE for BCPanel and BCButton, so you can use the old styles in a new form, you don't need anymore the bgrasamples unit.

Replaced components (removed):
- BGRAButton > BCButton
- BGRANeoButton > BCButton
- BGRAImageButton > BCImageButton
- BGRAPanel > BCPanel
- BGRABitmapThemeUtils, slicescaling > BGRASliceScaling (in BGRABitmap)
- Win7ToolBar + BGRAButton > BCPanel + BCButton (or BGRAVirtualScreen + BCButton)

Unused units / projects (removed):
- test_bgracontrols removed (it's hard to preserve because mostly uses BGRAButton and BGRAImageButton, BTW most controls are self-explanatory so is not neccesary)
- test_bgraneobutton removed
- bgratextfxtypes (used in removed BGRALabelFX) removed
- bgrasamples removed (used in Win7ToolBar and BGRAButton / BGRAImageButton styles / test_bgracontrols)
- bgrabitmapthemeutils removed
- slicescaling_editor (removed, there are other good examples, like customdrawn_win7)
- button-editor (removed, there are other good examples, like BCButton itself)

Components in this version:
"BC" Named:
- BCButton
- BCGameGrid
- BCImageButton
- BCLabel
- BCPanel

"BGRA" Named:
- BGRAProgressBar
- BGRAGraphicControl
- BGRAImageList
- BGRAImageManipulation
- BGRAKnob
- BGRAShape
- BGRASpeedButton
- BGRASpriteAnimation
- BGRAVirtualScreen
Title: Re: BGRAControls
Post by: lainz on March 08, 2013, 05:37:30 pm
I've updated the wiki:
http://wiki.lazarus.freepascal.org/BGRAControls
Title: Re: BGRAControls
Post by: Dibo on March 08, 2013, 05:50:59 pm
Great job :)
Title: Re: BGRAControls
Post by: lainz on March 08, 2013, 11:04:00 pm
Great job :)

Finally we get it :)

BGRAControls 2.1.0.1-alpha

Only 3 changes:
- I've updated the BCButton default styles to look exactly to the BGRAButton ones (missing border 'light').
- I've updated Windows 7 ToolBar style for BCPanel to look better.
- I've added a new component called TBCXButton with test project:
http://wiki.lazarus.freepascal.org/BGRAControls#BCXButton
This control doesn't has default properties, it's supposed that you will override this control and add all the things you wish.
Title: Re: BGRAControls
Post by: circular on March 09, 2013, 09:28:13 am
Congratulations guys  :)
Title: Re: BGRAControls
Post by: lainz on March 09, 2013, 10:24:24 pm
Thanks, you contributed a lot without BGRABitmap this is not possible :)

On SVN I've added more filters, the 'Instagram' (Because I don't have a better name...). I'll close the BCFilters thread, now I'll keep updating here.

See image attached. Looks really old :)
Title: Re: BGRAControls
Post by: circular on March 10, 2013, 02:43:31 am
Yeah, like printed on an old piece of paper.
Title: Re: BGRAControls
Post by: lainz on March 10, 2013, 03:16:03 am
Yeah, like printed on an old piece of paper.

You need to see the penguins on TV, in test_bcfilters project  ::)
Title: Re: BGRAControls
Post by: mora on March 10, 2013, 07:35:47 am
Quote
Finally we get it

Realy great job :)
TBCXButton - is just what I need :)
Thansk a lot.
Title: Re: BGRAControls
Post by: lainz on March 10, 2013, 06:26:50 pm
Quote
Finally we get it

Realy great job :)
TBCXButton - is just what I need :)
Thansk a lot.

Finally someone is using that control! I've created this long time ago, it's inherited from TBCGraphicButton that's the real base for custom buttons (this comes from the old bgraneobutton unit, that no one used never xD, that comes from things I've learned with CDButton + BGRAButton and BGRAImageButton).

enjoy :)
Title: Re: BGRAControls
Post by: lainz on March 18, 2013, 04:50:15 am
Hi people!

SVN changes:
Added bceffect.pas unit. This unit is for adding effects like transitions for bc controls. At this time only includes fading.

Fade In, Fade Out, Fade In Out: I've tested it a lot with different values, I think it will work with most 'FadingStep' values.

How to use: Added test project in extra folder, I don't want to lose it :)

Just add the unit to uses, add a Timer and a BGRA Graphic Control, but you can add other controls to get the properties.

Improvements are welcome.
Title: Re: BGRAControls
Post by: lainz on March 25, 2013, 02:58:42 am
Hi, I've updated BCFilters and now are easier to use:

Variable of type record (advanced record)
Code: [Select]
var
  Fade: TFading;

Init:

Code: [Select]
begin

  Fade.Mode := fmFadeInOut;
  Fade.Step := 17;
  Fade.Reset;

end;

OnTimer:

Code: [Select]
begin
  vs1.RedrawBitmap; // for example invalidate a virtual screen
end;

When you draw:

Code: [Select]
begin
  Bitmap.FillRect(0, 0, vs1.Width, vs1.Height, BGRA(0, 0, 0, Fade.Execute), dmFastBlend);  // execution gives the alpha value for fading!
end;

If you change the properties you must call
Code: [Select]
  Fade.Reset; to ensure all will work fine, BTW is not neccesary if you know what values you're using. Is not called automatically to reset only when you modify all the properties you want OR when you want.

Fading modes are the same:
Code: [Select]
  TFadingMode = (fmFadeIn, fmFadeOut, fmFadeInOut);
But if you want FadeOutIn you can:
Code: [Select]
  {
  FadeOutIn = use fmFadeInOut and the next values:
  TFading.Mode := fmFadeInOut;
  TFading.Alpha := 255;
  TFading.Up := True;
  }   
Title: Re: BGRAControls
Post by: circular on March 25, 2013, 10:37:23 am
That's interesting.

I can't find this update, neither on svn nor on git.
Title: Re: BGRAControls
Post by: lainz on March 25, 2013, 12:11:01 pm
That's interesting.

I can't find this update, neither on svn nor on git.

Is BGRAControls SVN 122, the file is BCEffect.pas,

http://bgracontrols.svn.sourceforge.net/viewvc/bgracontrols/bceffect.pas?view=log

 and maybe chek the text_extra folder. There is a folder called effect_fading.
Title: Re: BGRAControls
Post by: circular on March 25, 2013, 07:48:38 pm
Ok, thanks.

I propose those modifications :
Title: Re: BGRAControls
Post by: lainz on March 26, 2013, 03:42:03 am
Ok, thanks.

I propose those modifications :

Thanks, added on SVN. I need to update the examples that uses this unit. Done.

Now it rocks.
Title: Re: BGRAControls
Post by: circular on March 26, 2013, 01:52:11 pm
Hello again,

Here is a patch to add Duration property to specify the duration in milliseconds of the fade. And an update for the test project.
Title: Re: BGRAControls
Post by: lainz on March 26, 2013, 03:11:59 pm
Done!
Title: Re: BGRAControls
Post by: lainz on March 27, 2013, 09:44:49 pm
BGRAControls 2.2 new features:
- BCEffect unit with TFading. Fading example (This includes a Form Fading effect for Windows).
- Speed up controls and tests using Blend instead PutImage when needed.
- BCImageButton has fading animation by default.
- BCXButton test now uses Themes unit (with this you can do something like a native custom button)
- BCFilters has more filters.

Download:
http://sourceforge.net/projects/bgracontrols/files/bgracontrols-2.2.zip/download
Title: Re: BGRAControls
Post by: BigChimp on March 30, 2013, 02:25:46 pm
BGRAControls package didn't compile for me on FPC trunk with an error in bceffect.pas that a protected section was not allowed in records. Changing it to public helped:
Quote
Index: bceffect.pas
===================================================================
--- bceffect.pas        (revision 129)
+++ bceffect.pas        (working copy)
@@ -31,7 +31,7 @@
     FDuration: integer;
     FPrevDate: TDateTime;
     FElapsedMsAccumulator: integer;
-  protected
+  public
     procedure SetFAlpha(AValue: byte);
     procedure SetFMode(AValue: TFadingMode);
     procedure SetFAlphaStep(AValue: byte);

Thanks,
BigChimp
Title: Re: BGRAControls
Post by: fbadriawan on April 05, 2013, 05:22:12 am
@lainz: what about merging these controls become ribbon control as a single control???
Title: Re: BGRAControls
Post by: Fahmy Rofiq on April 05, 2013, 03:40:38 pm
BGRAControls SVN error while compiling, using Lazarus trunk, please help, thanks,,,
Quote
D:\Programming\Lazarus\LCL\BGRAControls\bcfilters.pas(131,61) Error: Identifier not found "int32or64"
D:\Programming\Lazarus\LCL\BGRAControls\bcfilters.pas(132,23) Error: Identifier not found "int32or64"
D:\Programming\Lazarus\LCL\BGRAControls\bcfilters.pas(132,48) Error: Identifier not found "int32or64"
D:\Programming\Lazarus\LCL\BGRAControls\bcfilters.pas(132,74) Error: Identifier not found "int32or64"
D:\Programming\Lazarus\LCL\BGRAControls\bcfilters.pas(139,1) Fatal: There were 4 errors compiling module, stopping
Title: Re: BGRAControls
Post by: circular on April 11, 2013, 12:10:25 am
You can replace int32or64 by NativeInt.
Title: Re: BGRAControls
Post by: digeo on April 23, 2013, 03:49:16 pm
Dont know if I am missing something somewhere, but when using BCpanel with flat bevel look, top and left side "borders" still visible. This is the same color as the form. In the screenshot i have a black BCpanel with blue child panel and border visible.

settings:
bevelinner/outer = bvNone
borderstyle = bpsBorder
Title: Re: BGRAControls
Post by: circular on May 04, 2013, 06:12:04 pm
Someone raised an issue about missing borders of TBCButton here:
http://www.lazarus.freepascal.org/index.php/topic,20724.0.html
Title: Re: BGRAControls
Post by: Dibo on May 14, 2013, 04:59:06 pm
Sourceforge notified me about new SVN and GIT links. I updated wiki:
http://wiki.freepascal.org/BGRAControls#SVN

Old links works but don't know how long
Title: Re: BGRAControls
Post by: digeo on August 02, 2013, 03:03:36 pm
Is it possible to have the BCbutton caption below the icon like in the sample image? I have tried the state fontex properties but it just misaligns the caption to the image.
Title: Re: BGRAControls
Post by: iannak on August 30, 2013, 10:01:06 pm
Hi, Dibo!

I've found a bug into BCButton. For example, put on the form one BCButton, one PopupMenu, one GroupBox and one DateEdit control or one FileNameEdit control inside the groupbox. Assign the PopupMenu to the DropDownMenu property of BCButton. Run the program. Now, when you press the BCButton and the dropdown menu is popped up then, if you press the button of DateEdit control or FileNameEdit control, the corresponding dialog is not appeared (calendar or fileopen dialog respectively). Only if you click outside of the groupbox first, then the dialogs are working.
How it's possible to find a solution for this situation?
Thank's in advance.
Title: Re: BGRAControls
Post by: Dibo on August 30, 2013, 11:42:33 pm
Hi iannak.

Thanks for reporting. Did you try with other (standard) controls like TToolbar->TToolButton->DropDownMenu? I did quick test with your example and on my OS (Kubuntu linux) I need to do two clicks to show dialog. First click hide popupmenu and second shows dialog. Same with TToolbar so seems that it is "normal" behavior. Are you saying that even second click doesn't work? Try with TToolButton. If same problem then it could be issue in LCL. If not then I'll take a look in TBCButton source

Regards
Title: Re: BGRAControls
Post by: iannak on August 31, 2013, 09:39:06 am
Dibo, thank you for your immediate answer!
I have tryed your exsample and it works just fine. After pressing the toolbar button I press a DateEdit which is inside the groupbox and it works with first click. The dropdown closes and the calendar appears at the same time, with first click.
With BCButton it does not work at all, as much as you want to click inside the groupbox, until you click once outside it.
If you want, just for reference, you can try the TMenuButton from LuiControls. It works fine in this situation.

I have Windows XP SP3
Lazarus 1.0.12 Stable with FPC 2.6.2

In my case I use BCButton with dropdown menu and when a menuitem is clicked, a new form is created dynamically, in which there are some controls inside a groupbox and they are not working. Until I return in main form, click again the BCButton twice (once to open the dropdown again and once to close it), and then the controls on the dynamically created form are get to work normally.
I think it's somethig with DropDownClosed procedure of TCustomBCButton class. May be I'm wrong of course.
Thank you again!
Waiting for solution.
Title: Re: BGRAControls
Post by: Dibo on August 31, 2013, 03:17:39 pm
Hmm, TMenuButton is using similar technique to show up menu. I don't have windows platform to debug it. TMenuButton is calling Application.ProcessMessages before popup. You can try if it help:

1. Open BCButton.pas
2. In method TCustomBCButton.MouseDown add line Application.ProcessMessages before FDropDownMenu.PopUp(x, y);
3. Reinstall BGRA Controls package
Title: Re: BGRAControls
Post by: iannak on September 01, 2013, 12:56:14 am
I tryed your suggestion, but nothing. It's not working. I think the problem is after the dropdown menu closes, not before popup. It looks like some  kind of locking on popup which should be unlocked after dropdown closes.
Title: Re: BGRAControls
Post by: iannak on September 03, 2013, 09:55:46 am
Hi, Dibo!
Any other idea? I have noticed that this is happened only with groupbox as parent of Dateedit. For excample with Panel as parent it's workkiing fine. Also if you open the dropdown and then close it with a second click on Bcbutton, then it's working. Even if you don't do the second click on BCButton, but click on the title bar of the window > drag the mouse over the BCButton > Mouse Up on the BCButton. Then the Dateedit also works.
Title: TBGRAImageManipulation multiple crop areas
Post by: MaxM74 on October 13, 2013, 10:33:50 pm
Hi i've done the multiple crop areas support in TBGRAImageManipulation,
see the attachment for details.

Thanks.
Title: Re: BGRAControls
Post by: Dibo on October 20, 2013, 02:23:23 pm
Sorry for delay. I'm not in home. I'll comit your changes tomorrow. Thanks
Title: Re: BGRAControls
Post by: MaxM74 on October 28, 2013, 09:10:16 pm
not yet posted on sourceforge.
Title: Re: BGRAControls
Post by: Dibo on October 29, 2013, 10:29:25 am
I added your patch. Thanks! Can you check if everything is ok?

BTW: Lainz do you still have write permissions on SVN? Sourceforge changed sources paths and I can't understand new permission manager
Title: Re: BGRAControls
Post by: MaxM74 on October 31, 2013, 01:54:34 pm
All OK.
if i have other patchs in the future i will send to you.

Thanks
Title: Re: BGRAControls
Post by: Deepaak on January 19, 2014, 07:54:39 am
Is development of BGRA Controls is still active.
Title: Re: BGRAControls
Post by: Dibo on January 19, 2014, 01:57:55 pm
Well, I don't have enough time now to develop new features  :(
Title: Re: BGRAControls
Post by: exdatis on January 19, 2014, 03:30:10 pm
Take it easy and don't worry. Best regards and thank you very much for an amazing graphic library, to the team.
Title: Re: BGRAControls
Post by: freeman35 on February 18, 2014, 03:18:43 pm
Is svn down? or what is svn link?
Title: Re: BGRAControls
Post by: exdatis on February 19, 2014, 07:09:23 am
http://forum.lazarus.freepascal.org/index.php/topic,23619.msg141256.html#msg141256
Title: Re: BGRAControls
Post by: lainz on March 27, 2014, 06:22:41 pm
Hi, I'll try to add streaming, 'LoadFromFile' and 'SaveToFile' with LResources for BCButton, and maybe other component that benefit from that..
Title: Re: BGRAControls
Post by: lainz on March 28, 2014, 10:46:38 pm
I added your patch. Thanks! Can you check if everything is ok?

BTW: Lainz do you still have write permissions on SVN? Sourceforge changed sources paths and I can't understand new permission manager

I don't have access, sourceforge and his changes..

---

Here it is, well I've not touched nothing and only I've added the methods LoadFromFile, SaveToFile and OnFindClass. Patch file attached.

The output is something like the '.bcbtn' but with less information.

I think it's ok to just store the 'style' and nothing more that that, but i don't know how to limit the data that will be streamed only in the saved file without touching the published things that works inside the object inspector on the ide.

As is it streams position, size, the StateClicked, StateHover, StateNormal, DropDown settings, Opacity.. Caption and some others..

By the other hand if something is missing the way to fix:

if it's a SubComponent set TheComponent.SetSubComponent(True) after creating.
if it's a custom property: http://forum.lazarus.freepascal.org/index.php/topic,24011.msg144123.html#msg144123

I think that Dibo used something like this when he added the 'DummyProperty' that's used to load and save from file but that only works in the object inspector.

Code: [Select]
object BCButton1: TBCButton
  Left = 8
  Height = 33
  Top = 8
  Width = 123
  StateClicked.Background.Color = clBlack
  StateClicked.Background.ColorOpacity = 255
  StateClicked.Background.Gradient1.StartColor = 8404992
  StateClicked.Background.Gradient1.StartColorOpacity = 255
  StateClicked.Background.Gradient1.DrawMode = dmSet
  StateClicked.Background.Gradient1.EndColor = 4194304
  StateClicked.Background.Gradient1.EndColorOpacity = 255
  StateClicked.Background.Gradient1.ColorCorrection = True
  StateClicked.Background.Gradient1.GradientType = gtRadial
  StateClicked.Background.Gradient1.Point1XPercent = 50
  StateClicked.Background.Gradient1.Point1YPercent = 100
  StateClicked.Background.Gradient1.Point2XPercent = 0
  StateClicked.Background.Gradient1.Point2YPercent = 0
  StateClicked.Background.Gradient1.Sinus = False
  StateClicked.Background.Gradient2.StartColor = clWhite
  StateClicked.Background.Gradient2.StartColorOpacity = 255
  StateClicked.Background.Gradient2.DrawMode = dmSet
  StateClicked.Background.Gradient2.EndColor = clBlack
  StateClicked.Background.Gradient2.EndColorOpacity = 255
  StateClicked.Background.Gradient2.ColorCorrection = True
  StateClicked.Background.Gradient2.GradientType = gtLinear
  StateClicked.Background.Gradient2.Point1XPercent = 0
  StateClicked.Background.Gradient2.Point1YPercent = 0
  StateClicked.Background.Gradient2.Point2XPercent = 0
  StateClicked.Background.Gradient2.Point2YPercent = 100
  StateClicked.Background.Gradient2.Sinus = False
  StateClicked.Background.Gradient1EndPercent = 100
  StateClicked.Background.Style = bbsGradient
  StateClicked.Border.Color = clBlack
  StateClicked.Border.ColorOpacity = 255
  StateClicked.Border.LightColor = clWhite
  StateClicked.Border.LightOpacity = 255
  StateClicked.Border.LightWidth = 0
  StateClicked.Border.Style = bboNone
  StateClicked.Border.Width = 1
  StateClicked.FontEx.Color = 16770790
  StateClicked.FontEx.EndEllipsis = False
  StateClicked.FontEx.FontQuality = fqSystemClearType
  StateClicked.FontEx.Height = 0
  StateClicked.FontEx.SingleLine = True
  StateClicked.FontEx.Shadow = True
  StateClicked.FontEx.ShadowColor = clBlack
  StateClicked.FontEx.ShadowColorOpacity = 255
  StateClicked.FontEx.ShadowRadius = 2
  StateClicked.FontEx.ShadowOffsetX = 1
  StateClicked.FontEx.ShadowOffsetY = 1
  StateClicked.FontEx.Style = [fsBold]
  StateClicked.FontEx.TextAlignment = bcaCenter
  StateClicked.FontEx.WordBreak = False
  StateHover.Background.Color = clBlack
  StateHover.Background.ColorOpacity = 255
  StateHover.Background.Gradient1.StartColor = 16744448
  StateHover.Background.Gradient1.StartColorOpacity = 255
  StateHover.Background.Gradient1.DrawMode = dmSet
  StateHover.Background.Gradient1.EndColor = 8404992
  StateHover.Background.Gradient1.EndColorOpacity = 255
  StateHover.Background.Gradient1.ColorCorrection = True
  StateHover.Background.Gradient1.GradientType = gtRadial
  StateHover.Background.Gradient1.Point1XPercent = 50
  StateHover.Background.Gradient1.Point1YPercent = 100
  StateHover.Background.Gradient1.Point2XPercent = 0
  StateHover.Background.Gradient1.Point2YPercent = 0
  StateHover.Background.Gradient1.Sinus = False
  StateHover.Background.Gradient2.StartColor = clWhite
  StateHover.Background.Gradient2.StartColorOpacity = 255
  StateHover.Background.Gradient2.DrawMode = dmSet
  StateHover.Background.Gradient2.EndColor = clBlack
  StateHover.Background.Gradient2.EndColorOpacity = 255
  StateHover.Background.Gradient2.ColorCorrection = True
  StateHover.Background.Gradient2.GradientType = gtLinear
  StateHover.Background.Gradient2.Point1XPercent = 0
  StateHover.Background.Gradient2.Point1YPercent = 0
  StateHover.Background.Gradient2.Point2XPercent = 0
  StateHover.Background.Gradient2.Point2YPercent = 100
  StateHover.Background.Gradient2.Sinus = False
  StateHover.Background.Gradient1EndPercent = 100
  StateHover.Background.Style = bbsGradient
  StateHover.Border.Color = clBlack
  StateHover.Border.ColorOpacity = 255
  StateHover.Border.LightColor = clWhite
  StateHover.Border.LightOpacity = 255
  StateHover.Border.LightWidth = 0
  StateHover.Border.Style = bboNone
  StateHover.Border.Width = 1
  StateHover.FontEx.Color = clWhite
  StateHover.FontEx.EndEllipsis = False
  StateHover.FontEx.FontQuality = fqSystemClearType
  StateHover.FontEx.Height = 0
  StateHover.FontEx.SingleLine = True
  StateHover.FontEx.Shadow = True
  StateHover.FontEx.ShadowColor = clBlack
  StateHover.FontEx.ShadowColorOpacity = 255
  StateHover.FontEx.ShadowRadius = 2
  StateHover.FontEx.ShadowOffsetX = 1
  StateHover.FontEx.ShadowOffsetY = 1
  StateHover.FontEx.Style = [fsBold]
  StateHover.FontEx.TextAlignment = bcaCenter
  StateHover.FontEx.WordBreak = False
  StateNormal.Background.Color = clBlack
  StateNormal.Background.ColorOpacity = 255
  StateNormal.Background.Gradient1.StartColor = 4194304
  StateNormal.Background.Gradient1.StartColorOpacity = 255
  StateNormal.Background.Gradient1.DrawMode = dmSet
  StateNormal.Background.Gradient1.EndColor = 8405056
  StateNormal.Background.Gradient1.EndColorOpacity = 255
  StateNormal.Background.Gradient1.ColorCorrection = True
  StateNormal.Background.Gradient1.GradientType = gtLinear
  StateNormal.Background.Gradient1.Point1XPercent = 0
  StateNormal.Background.Gradient1.Point1YPercent = 0
  StateNormal.Background.Gradient1.Point2XPercent = 0
  StateNormal.Background.Gradient1.Point2YPercent = 100
  StateNormal.Background.Gradient1.Sinus = False
  StateNormal.Background.Gradient2.StartColor = 8405056
  StateNormal.Background.Gradient2.StartColorOpacity = 255
  StateNormal.Background.Gradient2.DrawMode = dmSet
  StateNormal.Background.Gradient2.EndColor = 4194304
  StateNormal.Background.Gradient2.EndColorOpacity = 255
  StateNormal.Background.Gradient2.ColorCorrection = True
  StateNormal.Background.Gradient2.GradientType = gtRadial
  StateNormal.Background.Gradient2.Point1XPercent = 50
  StateNormal.Background.Gradient2.Point1YPercent = 100
  StateNormal.Background.Gradient2.Point2XPercent = 0
  StateNormal.Background.Gradient2.Point2YPercent = 0
  StateNormal.Background.Gradient2.Sinus = False
  StateNormal.Background.Gradient1EndPercent = 60
  StateNormal.Background.Style = bbsGradient
  StateNormal.Border.Color = clBlack
  StateNormal.Border.ColorOpacity = 255
  StateNormal.Border.LightColor = clWhite
  StateNormal.Border.LightOpacity = 255
  StateNormal.Border.LightWidth = 0
  StateNormal.Border.Style = bboNone
  StateNormal.Border.Width = 1
  StateNormal.FontEx.Color = 16770790
  StateNormal.FontEx.EndEllipsis = False
  StateNormal.FontEx.FontQuality = fqSystemClearType
  StateNormal.FontEx.Height = 0
  StateNormal.FontEx.SingleLine = True
  StateNormal.FontEx.Shadow = True
  StateNormal.FontEx.ShadowColor = clBlack
  StateNormal.FontEx.ShadowColorOpacity = 255
  StateNormal.FontEx.ShadowRadius = 2
  StateNormal.FontEx.ShadowOffsetX = 1
  StateNormal.FontEx.ShadowOffsetY = 1
  StateNormal.FontEx.Style = [fsBold]
  StateNormal.FontEx.TextAlignment = bcaCenter
  StateNormal.FontEx.WordBreak = False
  Caption = 'BCButton1'
  Color = clNone
  DropDownWidth = 16
  DropDownArrowSize = 8
  GlobalOpacity = 255
  ParentColor = False
  Rounding.RoundX = 12
  Rounding.RoundY = 12
  Rounding.RoundOptions = []
  RoundingDropDown.RoundX = 1
  RoundingDropDown.RoundY = 1
  RoundingDropDown.RoundOptions = []
  TextApplyGlobalOpacity = False
end
Title: Re: BGRAControls
Post by: lainz on April 08, 2014, 04:12:29 am
Hi Dibo and circular, since no one of us is updating this I've created a new repo
http://forum.lazarus.freepascal.org/index.php/topic,24176.0.html
Title: Re: BGRAControls
Post by: Dibo on April 10, 2014, 10:31:59 am
Sorry for my delayed response. I'm working at full time and don't have enough time to develop this set of controls like before. Thanks again to lainz for keeping it alive! I'm closing this topic. New official topic is here:
http://forum.lazarus.freepascal.org/index.php/topic,24176.0.html
TinyPortal © 2005-2018