License: I know nothing about licensing. I added GNU from Lazarus wizard. Just download and do what you want. It is free
@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.
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
What this component should do? Draw PNG image as button in different states?
Because I looked quickly at your source and I saw that you don't draw images but only draw gradients etc.
Dibo:
I think I should create some lazarus wiki page for BGRA Controls. I can't add more screens in first post Tongue
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)
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)
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;
{*** 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);
New version 1.0.8.0
Nice :) . I see it is worth developing further
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
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. ::)
Updated BGRAButton Gallery with more examples, enjoy those buttons!I like the office button !
http://wiki.lazarus.freepascal.org/BGRAButton_Gallery
Here it is (attached zip).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...)Do you mean a like TCheckBox ?
QuoteEdit: 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 ?
Do you plan to extend it to other components like TEdit, TMemo, etc. ?Yes, If I find some time ;)
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
For Windows users: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)
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).
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.
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;
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.
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);"
Hi all,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 ?
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 remember the compiler directive to check FPC version.
I'm under Mac OS X 10.6.7 with last snapshot (svn rev. 30406) fpc 2.4.2 and last components/bgraHi all,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 ?
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?
picstart, I cannot tell you because I am using CodeTyphon.
@Shebuka:Hi, I'm trying with png images now at it hase same strange behavior...
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).
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.
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.
@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
@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
Thanks :)
New version 1.0.9.7
Changes:Details: http://wiki.lazarus.freepascal.org/BGRAControls
- 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
Download: http://sourceforge.net/projects/bgracontrols/files/
Regards
Ouch. Sorry, I missed your post.
New version 1.0.9.8
Changes:Details: http://wiki.lazarus.freepascal.org/BGRAControls
- TBGRAImageButton - Now has alpha support with BGRABitmap
- TBGRAImageButton - BitmapHeight property is no longer neccesary
Download: https://sourceforge.net/projects/bgracontrols/files/
BGRAButton has a fixed Font for the Caption. The Standard button allows a choice of Font.Look in the BodyNormal, BodyHover, and BodyClicked properties.
Maybe BGRAButton requires any special font to go into the Glyph?
Hey Dibo, i have a suggestion to improve TBGRAButton:Ok
Add a BodyDisabled TBody property, so we can put a custom gradient
when the button is disabled.
Exactly. I remind that this package have demo of TBGRAButton :)BGRAButton has a fixed Font for the Caption. The Standard button allows a choice of Font.Look in the BodyNormal, BodyHover, and BodyClicked properties.
Maybe BGRAButton requires any special font to go into the Glyph?
You can define here the font, the gradients, etc.
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.
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
New version 1.0.9.5
Changes:Details:http://wiki.lazarus.freepascal.org/BGRAControls
- 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
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?
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.
Lainz
Here is a lrs for bgraimagebutton
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. 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.
1. Memory LeakThat'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.
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.
@emersoncavalcanti:
Thanks for the update. I'm too tired to check everything. I suppose everything is ok except about memory leak.1. Memory LeakThat'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.
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.
I could not update the image demonstration on Wiki. Can you explain how to do it?
// Calculate aspect ratio
if (imageHeight <> 0) then
XYAspect := imageWidth / imageHeight
else
XYAspect := 1;
Hello Dibo.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?
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
Thanks :) Good idea. Maybe I try translate to my native language too (Polish)
@lainz: Have you access to files in source forge too?
@circular: I added you too
Have you something like "add file", "add folder" on this page?
https://sourceforge.net/projects/bgracontrols/files/
And now?
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)
You updated the package on SourceForge?
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.
VarSo 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.
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
SomePoint:= (Xindex(red), Yindex(blue), Z(violet));
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
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
var
i: Byte;
begin
i := trunc(Value-knbButtonOpacity.MinValue);
btnBackground.GlobalOpacity:=i;
end;
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.[/quote]
Updated. I need toThat's ok. 8-)readpractice again with the Free Pascal Tutorial. :-[
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;
// 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);
Why is DoubleBuffered necessary? There is already WMEraseBkgnd procedure to prevent erasing the background.
You found the problem with TBGRAImageButton? What was it?
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.
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've attached bgraribbon.zip, isn't a control, is designed with BGRAVirtualScreen & BGRAButton. Not all buttons inside the example works-Cool, it's like we're in word 2010. 8)
Is just for fun.
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
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...?
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.
var grayscale: TBGRABitmap;
begin
grayscale := Bitmap.FilterGrayscale as TBGRABitmap;
Bitmap.Assign(grayscale);
grayscale.Free;
Here is a way to apply grayscale :Code: [Select]var grayscale: TBGRABitmap;
begin
grayscale := Bitmap.FilterGrayscale as TBGRABitmap;
Bitmap.Assign(grayscale);
grayscale.Free;
- It is possible to show the bitmap in design mode. The only thing that needs to be deactivated is the timer
- the Autosize property doesn't resize the component when changed, only after moving it
I think there should be Center and Stretch property like in a TImage
@codedeep: Please responds What is the difference between TBGRALabel and TBGRAButton ?See the new version of the control.
@circular: if you have a moment you can see bgraspriteanimation, I need help with this:As the sprite Width is always positive, you can write Cardinal(FSprite.Width) instead of FSprite.Width.
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)..
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.
Maybe by overriding AdjustSize method.Quote- the Autosize property doesn't resize the component when changed, only after moving itI need some help with this =D
Maybe TBGRABitmap.Create(Picture1.Bitmap) ?
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
Well, this works as long as the bitmap is not semi-transparent. Anyway, why do you want to use Picture instead of Bitmap ?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);
In next version Rotate text :oThis will be a little more complicated. 8-)
:D
Well, this works as long as the bitmap is not semi-transparent. Anyway, why do you want to use Picture instead of Bitmap ?
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;
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 :)
D:\Compilers\lazarus\components\bgracontrols\bgraimagebutton.pas(139,21) Error: Identifier not found "TextShadow"
Here is bgrabitmap uploaded as a new version (4.7)
http://sourceforge.net/projects/lazpaint/files/src/
Curious to try out BGRAControls and Bitmap I installed BGRABitmap, but continuously run into problems when installing BGRAControls. It seems TextShadow is not found:QuoteD:\Compilers\lazarus\components\bgracontrols\bgraimagebutton.pas(139,21) Error: Identifier not found "TextShadow"
Any idea what might be wrong here?
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.
Nice work lainz! The package is developing well.+1
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.
However, in reality, the application displays the buttonsas I created them, then it changes their appearance, doesn't that takes some timesYou can change the parameters of the buttons before there are showed, in the Create procedure for example.
Hi,
onCreate procedure, of the main form or of each button ?
Nice work lainz! The package is developing well. I plan to add a new component (something like DrawGrid)
procedure ...
var
lblTitle: TBGRALabelFx;
begin
lblTitle.Caption := Edit2.Text;
end
procedure TForm1.BGRALabelFX1Click(Sender: TObject);
begin
if BGRALabelFX1.Caption = 'BGRALabelFX' then
BGRALabelFX1.Caption := 'LabelFX'
else BGRALabelFX1.Caption := 'BGRALabelFX';
end;
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.
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
@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.
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.
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.
procedure TBGRAQtBitmap.SlowDrawTransparent(ABitmap: TBGRADefaultBitmap;
ACanvas: TCanvas; ARect: TRect);
begin
ACanvas.Draw(0,0, ABitmap.Bitmap);
end;
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
I've a problem with Static property, seems it's not working.I check this. Thanks
Commit changes:
- TBGRAButton: Fix for StaticButton property
- TBGRAButton: Added Down property
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.
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 :Quoteprocedure 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.
I've replaced the procedure with this one in Windows7 and works (Qt 4.7.3). I've commited the bgraqtbitmap.pasOk.
Running 'testbgrafunc' works really bad: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.
* 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)Ok so basically alpha channel doesn't work.
* Test 3 & Test 4: there is a black box right to the pacman
Test Canvas 2D is ok. Test 3D is ok.It uses a TBGRAVirtualScreen.
LazPaint:This could be fixed with a compiler directive in the HighDPI unit.
* Fonts are larger (tested only in HighDPI), seems that Qt is HighDPI aware by itself (talking about font's size).
- 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.
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.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.
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.
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 ?
/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"
var
TBmp, TBmp2: TBGRABitmap;
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);
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);
That's because BGRABitmap has changed, I've solved that in the git repository of BGRAControls ;)
http://sourceforge.net/scm/?type=git&group_id=530771
git://bgracontrols.git.sourceforge.net/gitroot/bgracontrols/bgracontrols
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 got 2 errors in the BGRAImageButton.pas file while trying to compile BGRAControls-1.1.0.4 on Linux Mint 11.BGRABitmap has been changed for internal consistency. You can solve this issue by adding "as TBGRABitmap" at the end of the line.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"
I got 2 errors in the BGRAImageButton.pas file while trying to compile BGRAControls-1.1.0.4 on Linux Mint 11.BGRABitmap has been changed for internal consistency. You can solve this issue by adding "as TBGRABitmap" at the end of the line.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"
@lainz: you should put a zip file that is compatible with last bgrabitmap zip file, because most people just download zip files.
I got 2 errors in the BGRAImageButton.pas file while trying to compile BGRAControls-1.1.0.4 on Linux Mint 11.BGRABitmap has been changed for internal consistency. You can solve this issue by adding "as TBGRABitmap" at the end of the line.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"
@lainz: you should put a zip file that is compatible with last bgrabitmap zip file, because most people just download zip files.
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
procedure TfrmMain.btnGoFlashPlayerSetupClick(Sender: TObject);
begin
frmFlashPlayerSetup.ShowModal;
end;
procedure TfrmMain.btnGoFlashPlayerSetupClick(Sender: TObject);
begin
frmFlashPlayerSetup.Show;
end;
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.
Thanks !
So apparently, there is a problem when drawing opaque on Linux ?
Thanks !
So apparently, there is a problem when drawing opaque on Linux ?
Thanks. I guess I made an error.use Virtualbox if you're lazy ;)
Well I really need to get some Linux working...
Thanks. I guess I made an error.use Virtualbox if you're lazy ;)
Well I really need to get some Linux working...
Thanks. I guess I made an error.use Virtualbox if you're lazy ;)
Well I really need to get some Linux working...
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
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.
Works fine for me ! 8)
If possible to put Glyph Layout property in BGRAButton?, i need this feature for a project thats i developingbetter usr TBGRAImageButton, it's more adapted for your need.
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.
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.
We need more developers =)
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 =)
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.
In fact my ClearType implementation does not need that the OS has ClearType support. I've done it myself at the pixel level.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 =)
You can cut'n'paste whatever you want...
Currently not, but thanks for suggestionNo problem.
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;
@SONEFEDAI:Program start is too slow.
You mean these lines take to much time to run ? And afterwards, it's fast enough ?
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 ?Thanks
Is it possible Graphic Position Layout?
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.
{$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}
Yes, but to do that we need to override:May be next version?
DrawText
CalculatePreferredSize
Isn't easy.
Yes, but to do that we need to override:May be next version?
DrawText
CalculatePreferredSize
Isn't easy.
Where is the new sources?
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.
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);
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
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.
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
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.
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.
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.
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;
{
* 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
}
I've added some 'LoadFromFile' in TCustomBGRAImageButton.Can you add ImagePosition for BGRAButton?
I've added some 'LoadFromFile' in TCustomBGRAImageButton.Can you add ImagePosition for BGRAButton?
That is?Yu have added new functions...
That is?Yu have added new functions...
Can you add Image Position for BGRAButton?
But what you mean with Image Position? The Glyph?Like TSpeedButton.Layout
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
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)
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.
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.
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 .
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.
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.
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;
@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/?
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.
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
Love to hear that..
Hope DiBo would be agree with us.. Amien..
Lazarus with BGRABitmap + BGRAControl + CostumDrawnControl -> The Rocket.. Excellent..
Dest.FontHeight := round(Source.GetTextHeight('QWERTY') * 1.15);
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?Sorry, Lazarus by itself.
Which IDE?Sorry, Lazarus by itself.
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.
I am trying to compile the customdrawn_win7 demo with BGRA demos. I receive errors for missing customdrawncontrols. Where can I download?
Any suggestions?
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;
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;
bmp := TBGRABitmap.Create('emoticon_evilgrin.png');
bmp.Draw(canvas, 10, 10, True);
bmp.Free;
I receive sigsev error and program stops here (-->):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;
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
Regards and sorry for my english, it was hard to explain everything in my non-native language ;)
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 =)
Thanks . My english knowledge is only from old computer games or programming documentation :) . How do you know that I'm Polish?
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?
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)
BTW I Invite you to euro 2012 (if you like football, because I don' t:P ) and sorry for our roads
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.
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)
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
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.
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
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 uselessGood point, but I don't know how object TBGRAMultishapeFiller work. I think code which already exists was not written by me
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.
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.
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)
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 :)
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.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 uselessGood point, but I don't know how object TBGRAMultishapeFiller work. I think code which already exists was not written by me
QuoteAssignBCFont 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.QuoteYes, you can for example overload this function, with TCanvas parameter or TBGRABitmap parameter.QuoteNo 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.QuoteI 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.QuoteYou're right.Quotein 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)QuoteAbout 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).
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
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.
It's not so easy as I thought. TBGRAPixel is record and this kind of property can't be published
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;
color will be as object instance so it will take ~40 bytes in memory.
property ColorProp:TMyColorProp read getColorProp write setColorProp;
function MyClass.getColorProp;
begin
if not assigned(fMyColorProp) then
fColorProp := TMyColorProp.Create(@MyColor);
result := fColorProp;
end;
What do you think about this solution?
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?
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
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
I have commited new version (svn&git). BCFont can handle now negative text shadow offset
FBGRA.GetImageFromCanvas(Canvas,0,0);
to the Render function doesn't work either.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;
Does anybody have a solution for that problem?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
AddingCode: [Select]FBGRA.GetImageFromCanvas(Canvas,0,0);
to the Render function doesn't work either.
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.
i'm not using lazarus for a long time..Tell us with whom you betray us ;D
lol
Well the only mystical power I can see in Lazarus is that it is non obscure programming thanks to Pascal syntax. :)
I have synchronized git with svn
Is it faster than redrawing whole button?
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
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?
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?
Lainz, could you create some simple tutorial how to use BGRASliceScaling? I can't run demo on linux
Yes, it is working very well. I forgot to answer
I have to reinstall linux, 22gb are ok for ubuntu, lazarus and bgra?
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
:-[
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.
Looks great. I still have no time to test BGRASliceScaling in action :/
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;
Game1: TGameMap = (map: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567809.-'; solve: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.-'; mapW: 8; mapH: 8;
blockW: 128; blockH: 128; background: nil);
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;
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;
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
// 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);
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.
The last example is exactly what I was looking for. Love this library but sooo much to learn still.
BlendImageOver(x, y: integer; Source: TBGRACustomBitmap; operation: TBlendOperation; AOpacity: byte = 255;
ALinearBlend: boolean = false);
bitmap.BlendImageOver(GlassRect.Left, GlassRect.Top, tbmp, boLighten, 255, True);
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?
Or don't use a transparent background if you want to use ClearType.
Great job :)
Yeah, like printed on an old piece of paper.
Finally we get it
QuoteFinally we get it
Realy great job :)
TBCXButton - is just what I need :)
Thansk a lot.
var
Fade: TFading;
begin
Fade.Mode := fmFadeInOut;
Fade.Step := 17;
Fade.Reset;
end;
begin
vs1.RedrawBitmap; // for example invalidate a virtual screen
end;
begin
Bitmap.FillRect(0, 0, vs1.Width, vs1.Height, BGRA(0, 0, 0, Fade.Execute), dmFastBlend); // execution gives the alpha value for fading!
end;
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. TFadingMode = (fmFadeIn, fmFadeOut, fmFadeInOut);
{
FadeOutIn = use fmFadeInOut and the next values:
TFading.Mode := fmFadeInOut;
TFading.Alpha := 255;
TFading.Up := True;
}
That's interesting.
I can't find this update, neither on svn nor on git.
Ok, thanks.
I propose those modifications :
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);
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
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
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