Difference between revisions of "mbColorLib"

From Lazarus wiki
Jump to navigationJump to search
Line 24: Line 24:
 
The RColorPicker, GColorPicker, BColorPicker, as well as the RAxisColorPicker, GAxisColorPicker, BAxisColorPicker can be used to select a color using the RGB color model. In this model, the colors red, green and blue are used as base colors. If these color components are turned off the resulting color is black, like on a monitor screen. Increasing the red, green, blue values adds color to the monitor until the final color, white, is reached. Therefore, this is called ''addtive color mixing''.
 
The RColorPicker, GColorPicker, BColorPicker, as well as the RAxisColorPicker, GAxisColorPicker, BAxisColorPicker can be used to select a color using the RGB color model. In this model, the colors red, green and blue are used as base colors. If these color components are turned off the resulting color is black, like on a monitor screen. Increasing the red, green, blue values adds color to the monitor until the final color, white, is reached. Therefore, this is called ''addtive color mixing''.
  
The '''RColorPicker''' is a simple 1-dimensional slider which can be used to adjust the red component of the final color which is accessible from the property [tt]SelectedColor[/tt]. Whenever the color changes an event [tt]OnChange[/tt] is generated. The green and blue components can be set by corresponding properties.
+
The '''RColorPicker''' is a simple 1-dimensional slider which can be used to adjust the red component of the final color which is accessible from the property <tt>SelectedColor</tt>. Whenever the color changes an event <tt>OnChange</tt> is generated. The green and blue components can be set by corresponding properties.
  
The '''RAxisColorPicker''' is a 2-dimensional color picker. It is the complement of the RColorPicker and varies the green and blue color values in the rectangle defined by the rectangle spanned by the component. The blue value increases horizontally, and the green value increases vertically. The red value is held fixed. The point of the [tt]SelectedColor[/tt] is marked by a circle or a cross (property [tt]MarkerStyle[/tt]) and can be controlled by dragging the mouse or using the arrow keys. Whenever the selected color changed, the event [tt]OnChange[/tt] fires.
+
Correspondingly, the '''GColorPicker''' and '''BColorPicker''' components are responsible for the green and blue base color values.
  
Correspondingly, the '''GColorPicker''' and '''BColorPicker''' components are responsible for the green and blue base color values.
+
The '''RAxisColorPicker''' is a 2-dimensional color picker. It is the complement of the RColorPicker and varies the green and blue color values in the rectangle defined by the rectangle spanned by the component. The blue value increases horizontally, and the green value increases vertically. The red value is held fixed. The point of the <tt>SelectedColor</tt> is marked by a circle or a cross (property <tt>MarkerStyle</tt>) and can be controlled by dragging the mouse or using the arrow keys. Whenever the selected color changed, the event <tt>OnChange</tt> is fired.
 +
 
 +
The event <tt>OnChange</tt> can be used to link the red color component of the RAxisColorPicker to the red color component selected by a RColorPicker:
 +
<syntaxhighlight>
 +
procedure TForm1.RAxisColorPickerChange(Sender: TObject);
 +
begin
 +
  RAxisColorPicker.Red := RColorPicker.Red;
 +
end;
 +
</syntaxhighlight>
 +
 
 +
Similarly, the '''GAxisColorPicker''' and '''BAxisColorPicker''' are the complements of the GColorPicker and BColorPicker. The GAxisColorPicker varies blue and red, the BAxisColorPicker green and red on the horizontal and vertical axes, respectively.
  
 
===Demo projects===
 
===Demo projects===
 
Two demo projects are contained in the folder ''examples'' of the component installation directory:
 
Two demo projects are contained in the folder ''examples'' of the component installation directory:
 
* '''fulldemo''' shows application of all the components included in the ''mbColorLib''.
 
* '''fulldemo''' shows application of all the components included in the ''mbColorLib''.
 +
* '''axispickers''' demonstrates the combination of RAxisColorPicker and RColorPicker, GAxisColorPicker and GColorPicker and BAxisColorPicker and BColorPicker.
 
* '''trackbars''' demonstrates all trackbar color selectors.
 
* '''trackbars''' demonstrates all trackbar color selectors.
 
  
 
==Download and installation==
 
==Download and installation==

Revision as of 16:48, 26 December 2016

Template:mbColorLib

In preparation

About

FullDemo screenshot

Comprehensive library with more than 30 components for color selection in several color models (RGB, CYMK, HSV, HSL, CIE-Lab). The components can be combined to create numerous new tools and color dialogs.

Authors

  • Original author: Marko Binić
  • Lazarus port: Werner Pamler

License

Original license text by Marko Binić from the file Readme.rtf in the installation folder: "License is granted to use, modify and redistribute these units in your applications as you see fit. You are given COMPLETE FREEDOM with the sources found in this pack; you're free to use it in ANY kind of app without even mentioning my name, my site or any other stuff, that depends on your good will and nothing else. I will accept any modifications and incorporate them in this pack if they'll help make it better. You are under NO obligation to pay for these components to neither me nor anyone else trying to sell them in their current form. If you wish to support development of these components you can do so by contributing some source or making a donation, again this solely depends on your good will."


Usage

Component palette with mgColorLib components

Currently, the mbColorLib consists of 30 visual multi-purpose color picker components, a color selection dialog and 1 standard action for picking color from the desktop. The visual components can be classified by the color model to which they apply.

RGB color pickers

The RColorPicker, GColorPicker, BColorPicker, as well as the RAxisColorPicker, GAxisColorPicker, BAxisColorPicker can be used to select a color using the RGB color model. In this model, the colors red, green and blue are used as base colors. If these color components are turned off the resulting color is black, like on a monitor screen. Increasing the red, green, blue values adds color to the monitor until the final color, white, is reached. Therefore, this is called addtive color mixing.

The RColorPicker is a simple 1-dimensional slider which can be used to adjust the red component of the final color which is accessible from the property SelectedColor. Whenever the color changes an event OnChange is generated. The green and blue components can be set by corresponding properties.

Correspondingly, the GColorPicker and BColorPicker components are responsible for the green and blue base color values.

The RAxisColorPicker is a 2-dimensional color picker. It is the complement of the RColorPicker and varies the green and blue color values in the rectangle defined by the rectangle spanned by the component. The blue value increases horizontally, and the green value increases vertically. The red value is held fixed. The point of the SelectedColor is marked by a circle or a cross (property MarkerStyle) and can be controlled by dragging the mouse or using the arrow keys. Whenever the selected color changed, the event OnChange is fired.

The event OnChange can be used to link the red color component of the RAxisColorPicker to the red color component selected by a RColorPicker:

procedure TForm1.RAxisColorPickerChange(Sender: TObject);
begin
  RAxisColorPicker.Red := RColorPicker.Red;
end;

Similarly, the GAxisColorPicker and BAxisColorPicker are the complements of the GColorPicker and BColorPicker. The GAxisColorPicker varies blue and red, the BAxisColorPicker green and red on the horizontal and vertical axes, respectively.

Demo projects

Two demo projects are contained in the folder examples of the component installation directory:

  • fulldemo shows application of all the components included in the mbColorLib.
  • axispickers demonstrates the combination of RAxisColorPicker and RColorPicker, GAxisColorPicker and GColorPicker and BAxisColorPicker and BColorPicker.
  • trackbars demonstrates all trackbar color selectors.

Download and installation

Change Log

Version 2.2

  • Initial commit of the library to the Lazarus Components and Code Repository. It is based on the last published Delphi version 2.0.1 available from http://mxs.bergsoft.net. In the Lazarus version Delphi support has been dropped.