Difference between revisions of "BGRAControls"

From Free Pascal wiki
Jump to navigationJump to search
(→‎Install: deleted old sourceforge mirrors)
(This is a big edit, to match new readme from github)
Line 1: Line 1:
 
{{BGRAControls}}
 
{{BGRAControls}}
  
== Install ==
+
= Install =
  
 
=== Download BGRABitmap ===
 
=== Download BGRABitmap ===
Line 15: Line 15:
 
GitHub: https://github.com/bgrabitmap/bgracontrols/
 
GitHub: https://github.com/bgrabitmap/bgracontrols/
  
== Overview ==
+
= BGRA Controls =
  
License: Modified LGPL version 2.0.
+
BGRA Controls is a set of graphical UI elements that you can use with Lazarus LCL applications.
  
As many people know, Lazarus GTK doesn't have full alpha support. I created a set of components which use TBGRABitmap for drawing icons, so it partially solves the problem with alpha in GTK.
+
=== TBCButton ===
However, this component set is not only a GTK patch but also has more fancy components which use the power of the BGRABitmap package.
 
  
=== Author: Dibo. ===
+
[[Image:bcbutton.png]]
Package founder and package maintainer.
 
  
BC Controls
+
A button control that can be styled through properties for each state like StateClicked, StateHover, StateNormal with settings like gradients, border and text with shadows. You can assign an already made style through the property AssignStyle.
- TBCButton
 
- TBCLabel
 
- TBCPanel
 
  
BGRA Controls
+
=== TBCButtonFocus ===
- TBGRAImageList
 
- TBGRASpeedButton
 
  
=== Author: Circular. ===
+
Like TBCButton but it supports focus like normal TButton.
BGRABitmap creator, contributor and package maintainer.
 
  
- TBGRAFlashProgressBar
+
=== TBCGameGrid ===
- TBGRAGraphicControl
 
- TBGRAKnob
 
- TBGRAShape
 
- TBGRAVirtualScreen
 
  
=== Author: Lainz. ===
+
[[Image:bcgamegrid.png]]
Contributor and package maintainer.
 
  
BC Controls
+
A grid with custom width and height of items and any number of horizontal and vertical cells that can be drawn with BGRABitmap directly with the OnRenderControl event.
- TBCImageButton
 
- TBCXButton
 
- TBCGameGrid
 
  
BGRA Controls
+
=== TBCImageButton ===
- TBGRASpriteAnimation
 
  
=== Author: Emerson Cavalcanti. ===
+
[[Image:samplebgraimagebutton.png]]
- TBGRAImageManipulation
 
  
=== Author: mora. ===
+
[[Image:samplebgraimagebuttonalpha.png]]
- Contributor to BCButton functionality.
 
  
=== Author: helix2001 ===
+
A button control that can be styled with one image file, containing the drawing for each state Normal, Hovered, Active and Disabled. It supports 9-slice scaling feature. It supports a nice fading animation that can be turned on.
- TBGRAResizeSpeedButton.
 
  
== Related Articles ==
+
=== TBCXButton ===
  
[[BGRASpriteAnimation]] - Usage of the sprite animation component.
+
[[Image:bcxbutton.png]]
  
[[uE_Controls]] - Other controls developed with BGRABitmap.
+
A button control that can be styled by code with the OnRenderControl event. Or even better create your own child control inheriting from this class.
  
[[BGRABitmap]] - The library used to create this controls.
+
=== TBCLabel ===
  
[[LazPaint]] - A paint program developed with Lazarus and BGRABitmap.
+
[[Image:bclabel.png]]
  
== BC ==
+
A label control that can be styled through properties, it supports shadow, custom borders and background.
=== BCButton ===
 
[[Image:bcbutton.png]]
 
=== BCGameGrid ===
 
[[Image:bcgamegrid.png]]
 
=== BCImageButton ===
 
The bitmap must contain 4 states (from top to bottom, with the same Height) in the following order: normal, hover, active, disabled.
 
  
''Example Button:''
+
=== TBCMaterialDesignButton ===
  
[[Image:samplebgraimagebutton.png]]
+
A button control that has an animation effect according to Google Material Design guidelines. It supports custom color for background and for the circle animation, also you can customize the shadow.
  
''Example Button (with Alpha):''
+
=== TBCPanel ===
  
[[Image:samplebgraimagebuttonalpha.png]]
+
[[Image:bcpanel.png]]
  
=== BCXButton ===
+
A panel control that can be styled through properties. You can assign an already made style through the property AssignStyle.
Fully customizable button with 'OnRenderControl' event. This control doesn't has default properties, it's supposed that you will override this control and add all the things you wish.
 
  
- Like TCDButton (Custom Drawn Button).
+
=== TBCRadialProgressBar ===
  
- Call 'OnRenderControl' event (like a Drawer in CD) for each button, or one for all buttons.
+
A progress bar with radial style. You can set the color and text properties as you like.
  
- Create fully customizable buttons, like using BGRAVirtualScreen or BCGraphicControl.
+
=== TBCToolBar ===
  
[[Image:bcxbutton.png]]
+
A TToolBar with an event OnRedraw to paint it using BGRABitmap. It supports also the default OnPaintButton to customize the buttons drawing. By default it comes with a Windows 7 like explorer toolbar style.
  
=== BCLabel ===
+
=== TBCTrackBarUpdown ===
[[Image:bclabel.png]]
 
  
=== BCPanel ===
+
A control to input numeric values with works like a trackbar and a spinedit both in one control.
[[Image:bcpanel.png]]
 
  
== BGRA ==
+
=== TBGRAFlashProgressBar ===
=== BGRAProgressBar ===
 
'''Use as replace of:''' TProgressBar
 
  
 
[[Image:BC-Bgraflashprogressbar.png]]
 
[[Image:BC-Bgraflashprogressbar.png]]
  
Flash progressbar created by circular.
+
A progress bar with a default style inspired in the old Flash Player Setup for Windows progress dialog. You can change the color property to have different styles and also you can use the event OnRedraw to paint custom styles on it like text or override the entire default drawing.
  
=== BGRAGraphicControl ===
+
=== TBGRAGraphicControl ===
'''Use as replace of:''' TPaintBox
 
  
TBGRAGraphicControl, which allows to draw your component by yourself with alpha blending.
+
Is like a paintbox. You can draw with transparency with this control using the OnRedraw event.
  
=== BGRAImageList ===
+
=== TBGRAImageList ===
'''Use as replace of:''' TImageList
 
  
'''Before:'''
+
[[Image:before-TImageList.png]]
  
[[Image:before-TImageList.png]]
+
[[Image:after-TBGRAImageList.png]]
 +
 
 +
An image list that supports alpha in all supported platforms.
 +
 
 +
=== TBGRAImageManipulation ===
 +
 
 +
[[Image:bgraimagemanipulation.jpg]]
 +
 
 +
A tool to manipulate pictures, see the demo that shows all the capability that comes with it.
 +
 
 +
=== TBGRAKnob ===
 +
 
 +
[[Image:BC-Bgraknob.png]]
 +
 
 +
A knob that can be styled through properties.
 +
 
 +
=== TBGRAResizeSpeedButton ===
 +
 
 +
A speed button that can resize the glyph to fit in the entire control.
 +
 
 +
=== TBGRAShape ===
 +
 
 +
[[Image:samplebgrashape.png]]
 +
 
 +
A control with configurable shapes like polygon and ellipse that can be filled with gradients and can have custom borders and many other visual settings.
 +
 
 +
=== TBGRASpeedButton ===
 +
 
 +
[[Image:BGRASpeedButton.png]]
 +
 
 +
A speed button that in GTK and GTK2 provides BGRABitmap powered transparency to the glyph.
 +
 
 +
=== TBGRASpriteAnimation ===
 +
 
 +
[[Image:bgraspriteanimation.png]]
 +
 
 +
A component that can be used as image viewer or animation viewer, supports the loading of gif files.
 +
 
 +
=== TBGRAVirtualScreen ===
 +
 
 +
Is like a panel. You can draw this control using the OnRedraw event.
 +
 
 +
=== TDTAnalogClock ===
 +
 
 +
A clock.
 +
 
 +
=== TDTAnalogGaugue ===
 +
 
 +
A gauge.
 +
 
 +
=== TDTThemedClock ===
 +
 
 +
Another clock.
  
'''After:'''
+
=== TDTThemedGauge ===
  
[[Image:after-TBGRAImageList.png]]
+
Another gauge.
  
Component which inherits from TImageList. So each control (tested on TToolBar and TTreeView) which is using TImageList.Draw method for drawing icons, automatically can have alpha support. Just use this component instead of TImageList. This component has been written for enabling GTK alpha, so on Windows (and other interfaces) it works just like normal TImageList (it doesn't use BGRABitmap for drawing).
+
=== TPSImport_BGRAPascalScript ===
  
=== BGRAImageManipulation ===
+
A component to load BGRABitmap pascal script utilities.
'''Use as replace of:''' TImage
 
  
Component to facilitate the importation of images in an application.
+
= BGRA Custom Drawn =
  
In the current version you can import an image and cut out keeping the aspect ratio (or not). For example, if you want to import photos using the 3x4 ratio, adjust the 'ratio' property to 3:4. If import an image with different size, the component will ensure that the image meets the proportions of the desired dimensions.
+
BGRA Custom Drawn is a set of controls inherited from Custom Drawn. These come with a default dark style that is like Photoshop.
  
You can determine the minimum size of the image adjusting the properties 'MinWidth'and 'MinHeight'.
+
=== TBCDButton ===
  
You can rotate the image using functions builtin.
+
A button control that is styled with TBGRADrawer.
  
See demo of component:
+
=== TBCDEdit ===
  
[[Image:bgraimagemanipulation.jpg]]
+
An edit control that is styled with TBGRADrawer.
  
After retrieving the image modified by the component, just put the image into your destination using the stretch. It is obvious that the target must have the same ratio chosen on component for do not distort the final result.
+
=== TBCDStaticText ===
  
=== BGRAKnob ===
+
A label control that is styled with TBGRADrawer.
[[Image:BC-Bgraknob.png]]
 
  
Graphic knob component created by circular.
+
=== TBCDProgressBar ===
  
=== BGRAShape ===
+
A progress bar control that is styled with TBGRADrawer.
'''Use as replace of:''' TShape
 
  
[[Image:samplebgrashape.png]]
+
=== TBCDSpinEdit ===
  
The component has full alpha support and you can put the number of polygons you want with rounded borders & gradients (linear, radial, diamond, reflected).
+
A spin edit control that is styled with TBGRADrawer.
  
=== BGRASpeedButton ===
+
=== TBCDCheckBox ===
'''Use as replace of:''' TSpeedButton
 
  
[[Image:BGRASpeedButton.png]]
+
A check box control that is styled with TBGRADrawer.
  
Component which inherits from TSpeedButton and draws the glyph using TBGRABitmap. This component has been written for enabling GTK alpha, so on Windows (and other interfaces) it works just like normal TImageList (it doesn't use BGRABitmap for drawing).
+
=== TBCRadioButton ===
  
=== BGRASpriteAnimation ===
+
A radio button that is styled with TBGRADrawer.
'''Use as replace of:''' TImage
 
  
Read more in the article [[BGRASpriteAnimation]].
+
= Sample code =
  
[[Image:bgraspriteanimation.png]]
+
BGRA Controls comes with nice demos to show how to use the stuff and extra things you can use in your own projects.
  
With this you can do animations from bitmap. You need an image with all the frames layout in in a horizontal position.
+
=== Pascal Script Library ===
  
It has the ability to specify how many times the animation should be played (0 for infinite, 1, 2, etc) and static to stop the animation, is capable to specify the speed and direction and support transparency.
+
Putting BGRABitmap methods into a .dll with c#, java and pascal headers.
  
Features:
+
=== BGRA Ribbon Custom ===
* Animation: invert, position, lap, speed, static, repeat.
 
* Sprite: fill opacity (global transparency), flip mode (horizontal, vertical, both), key color (transparent color), resample (normal or fine resample modes). AutoSize.
 
* AnimatedGifToSprite: convert an animated gif to a BGRABitmap sprite.
 
  
=== BGRAVirtualScreen ===
+
How to create a fully themed window using the controls to achieve a Ribbon like application.
'''Use as replacement of:''' TPanel, TPaintBox
 
  
The principle is to draw on a memory bitmap.
+
=== Tests ===
  
The component has a specific event, OnRedraw, which is called when the whole bitmap needs to be redrawn. It happens at the beginning and when the component is resized. You can also query to redraw the bitmap with Redraw and DiscardBitmap methods. The second one only invalidates the content, which can wait until the messageloop is handled.
+
There are test for analog controls (clock and gauge), BC prefixed controls, BGRA prefixed controls, BGRA Custom Drawn controls, how to use Pascal Script and BGRABitmap, bgrascript or how to create your own scripting solution with BGRABitmap.
  
Otherwise, it is possible to modify the Bitmap property and call Invalidate or Repaint, to avoid erasing the whole bitmap content.
+
=== Tests Extra ===
  
== Test ==
 
=== Game - Maze ===
 
 
[[Image:game_maze.png]]
 
[[Image:game_maze.png]]
  
=== Game - Puzzle ===
 
 
[[Image:game_puzzle.png]]
 
[[Image:game_puzzle.png]]
  
=== SliceScaling - CustomDrawn Windows 7 ===
+
[[Image:customdrawnwindows7.png]]
 +
 
 +
[[File:slicescaledtachart.png]]
 +
 
 +
These are extra tests like how to use fading effect, an fpGUI theme, games like maze and puzzle, how we created the material design animation, pix2svg or how to convert a small picture to svg using hexagons, rectangles and ellipses, plugins or how to load .dlls and use into a TBGRAVirtualScreen, rain effect, shadow effect, 9-slice-scaling with Custom Drawn or how to theme with bitmaps an application to look like Windows themes and 9-slice-scaling with charts.
 +
 
 +
= Another units =
 +
 
 +
These units come with BGRA Controls and contains more functionality that is sometimes used with the controls, sometimes not but are usefull in some way. Some are listed here, others you can see linked directly with any control like bcrtti, bcstylesform, bctools and bctypes.
  
[[Image:customdrawnwindows7.png]]
+
=== BCEffect ===
  
This is a drawer for [[Lazarus Custom Drawn Controls]], you need that component installed with the latest Lazarus revision to work.
+
Fading effect with BGRABitmap.
  
Working in this drawer: button, statictext, checkbox, radiobutton and progressbar.
+
=== BCFilters ===
  
This has also extra images for 'Luna' (Windows XP Theme) 'Aero Lite' (Windows 8 Theme) and extra buttons (arrows).
+
A set of pixel filters to use with BGRABitmap.
  
=== SliceScaling - TAChart ===
+
=== BGRAScript ===
  
9-slice scaling is usefull to create sizable UI elements like in the Custom Drawn Windows 7 Drawer.
+
Scripting with BGRABitmap, see test project.
  
There's a [[TAChart]] example with slice scaled bars.
+
= Related Articles =
  
[[File:slicescaledtachart.png]]
+
[[BGRASpriteAnimation]] - Usage of the sprite animation component.
 +
 
 +
[[uE_Controls]] - Other controls developed with BGRABitmap.
 +
 
 +
[[BGRABitmap]] - The library used to create this controls.
 +
 
 +
[[LazPaint]] - A paint program developed with Lazarus and BGRABitmap.
  
 
[[Category:Components]]
 
[[Category:Components]]
 
[[Category:Graphics]]
 
[[Category:Graphics]]
 
[[Category:BGRAControls]]
 
[[Category:BGRAControls]]

Revision as of 02:29, 2 September 2016

Deutsch (de) English (en) português (pt) русский (ru) 中文(中国大陆)‎ (zh_CN)

Install

Download BGRABitmap

Install BGRABitmap with the file bgrabitmappack.lpk.

GitHub: https://github.com/bgrabitmap/lazpaint/

Download BGRAControls

Install BGRAControls with the file bgracontrols.lpk.

GitHub: https://github.com/bgrabitmap/bgracontrols/

BGRA Controls

BGRA Controls is a set of graphical UI elements that you can use with Lazarus LCL applications.

TBCButton

bcbutton.png

A button control that can be styled through properties for each state like StateClicked, StateHover, StateNormal with settings like gradients, border and text with shadows. You can assign an already made style through the property AssignStyle.

TBCButtonFocus

Like TBCButton but it supports focus like normal TButton.

TBCGameGrid

bcgamegrid.png

A grid with custom width and height of items and any number of horizontal and vertical cells that can be drawn with BGRABitmap directly with the OnRenderControl event.

TBCImageButton

samplebgraimagebutton.png

samplebgraimagebuttonalpha.png

A button control that can be styled with one image file, containing the drawing for each state Normal, Hovered, Active and Disabled. It supports 9-slice scaling feature. It supports a nice fading animation that can be turned on.

TBCXButton

bcxbutton.png

A button control that can be styled by code with the OnRenderControl event. Or even better create your own child control inheriting from this class.

TBCLabel

bclabel.png

A label control that can be styled through properties, it supports shadow, custom borders and background.

TBCMaterialDesignButton

A button control that has an animation effect according to Google Material Design guidelines. It supports custom color for background and for the circle animation, also you can customize the shadow.

TBCPanel

bcpanel.png

A panel control that can be styled through properties. You can assign an already made style through the property AssignStyle.

TBCRadialProgressBar

A progress bar with radial style. You can set the color and text properties as you like.

TBCToolBar

A TToolBar with an event OnRedraw to paint it using BGRABitmap. It supports also the default OnPaintButton to customize the buttons drawing. By default it comes with a Windows 7 like explorer toolbar style.

TBCTrackBarUpdown

A control to input numeric values with works like a trackbar and a spinedit both in one control.

TBGRAFlashProgressBar

BC-Bgraflashprogressbar.png

A progress bar with a default style inspired in the old Flash Player Setup for Windows progress dialog. You can change the color property to have different styles and also you can use the event OnRedraw to paint custom styles on it like text or override the entire default drawing.

TBGRAGraphicControl

Is like a paintbox. You can draw with transparency with this control using the OnRedraw event.

TBGRAImageList

before-TImageList.png

after-TBGRAImageList.png

An image list that supports alpha in all supported platforms.

TBGRAImageManipulation

bgraimagemanipulation.jpg

A tool to manipulate pictures, see the demo that shows all the capability that comes with it.

TBGRAKnob

BC-Bgraknob.png

A knob that can be styled through properties.

TBGRAResizeSpeedButton

A speed button that can resize the glyph to fit in the entire control.

TBGRAShape

samplebgrashape.png

A control with configurable shapes like polygon and ellipse that can be filled with gradients and can have custom borders and many other visual settings.

TBGRASpeedButton

BGRASpeedButton.png

A speed button that in GTK and GTK2 provides BGRABitmap powered transparency to the glyph.

TBGRASpriteAnimation

bgraspriteanimation.png

A component that can be used as image viewer or animation viewer, supports the loading of gif files.

TBGRAVirtualScreen

Is like a panel. You can draw this control using the OnRedraw event.

TDTAnalogClock

A clock.

TDTAnalogGaugue

A gauge.

TDTThemedClock

Another clock.

TDTThemedGauge

Another gauge.

TPSImport_BGRAPascalScript

A component to load BGRABitmap pascal script utilities.

BGRA Custom Drawn

BGRA Custom Drawn is a set of controls inherited from Custom Drawn. These come with a default dark style that is like Photoshop.

TBCDButton

A button control that is styled with TBGRADrawer.

TBCDEdit

An edit control that is styled with TBGRADrawer.

TBCDStaticText

A label control that is styled with TBGRADrawer.

TBCDProgressBar

A progress bar control that is styled with TBGRADrawer.

TBCDSpinEdit

A spin edit control that is styled with TBGRADrawer.

TBCDCheckBox

A check box control that is styled with TBGRADrawer.

TBCRadioButton

A radio button that is styled with TBGRADrawer.

Sample code

BGRA Controls comes with nice demos to show how to use the stuff and extra things you can use in your own projects.

Pascal Script Library

Putting BGRABitmap methods into a .dll with c#, java and pascal headers.

BGRA Ribbon Custom

How to create a fully themed window using the controls to achieve a Ribbon like application.

Tests

There are test for analog controls (clock and gauge), BC prefixed controls, BGRA prefixed controls, BGRA Custom Drawn controls, how to use Pascal Script and BGRABitmap, bgrascript or how to create your own scripting solution with BGRABitmap.

Tests Extra

game maze.png

game puzzle.png

customdrawnwindows7.png

slicescaledtachart.png

These are extra tests like how to use fading effect, an fpGUI theme, games like maze and puzzle, how we created the material design animation, pix2svg or how to convert a small picture to svg using hexagons, rectangles and ellipses, plugins or how to load .dlls and use into a TBGRAVirtualScreen, rain effect, shadow effect, 9-slice-scaling with Custom Drawn or how to theme with bitmaps an application to look like Windows themes and 9-slice-scaling with charts.

Another units

These units come with BGRA Controls and contains more functionality that is sometimes used with the controls, sometimes not but are usefull in some way. Some are listed here, others you can see linked directly with any control like bcrtti, bcstylesform, bctools and bctypes.

BCEffect

Fading effect with BGRABitmap.

BCFilters

A set of pixel filters to use with BGRABitmap.

BGRAScript

Scripting with BGRABitmap, see test project.

Related Articles

BGRASpriteAnimation - Usage of the sprite animation component.

uE_Controls - Other controls developed with BGRABitmap.

BGRABitmap - The library used to create this controls.

LazPaint - A paint program developed with Lazarus and BGRABitmap.