BioGTK  6.0.0
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images. Including whole slide, pyramidal, and series.
All Classes Namespaces Functions
BioGTK.ColorTool Class Reference
Inheritance diagram for BioGTK.ColorTool:

Static Public Member Functions

static ColorTool Create (bool color1)
 

Protected Member Functions

 ColorTool (Builder builder, IntPtr handle, bool color1)
 
void SetupHandlers ()
 It sets up the event handlers for the sliders and text boxes.
 

Properties

ColorS ColorS [get]
 
RGBA RGBA [get]
 

Detailed Description

Definition at line 14 of file ColorTool.cs.

Constructor & Destructor Documentation

◆ ColorTool()

BioGTK.ColorTool.ColorTool ( Builder builder,
IntPtr handle,
bool color1 )
protected

Definition at line 65 of file ColorTool.cs.

65 : base(handle)
66 {
67 _builder = builder;
68 builder.Autoconnect(this);
69 this.color1 = color1;
71 rBar.Adjustment.Upper = ushort.MaxValue;
72 gBar.Adjustment.Upper = ushort.MaxValue;
73 bBar.Adjustment.Upper = ushort.MaxValue;
74 rBox.Adjustment.Upper = ushort.MaxValue;
75 rBox.Adjustment.StepIncrement = 1;
76 rBox.Adjustment.PageIncrement = 10;
77 gBox.Adjustment.Upper = ushort.MaxValue;
78 gBox.Adjustment.StepIncrement = 1;
79 gBox.Adjustment.PageIncrement = 10;
80 bBox.Adjustment.Upper = ushort.MaxValue;
81 bBox.Adjustment.StepIncrement = 1;
82 bBox.Adjustment.PageIncrement = 10;
83 widthBar.Adjustment.Upper = 100;
84 widthBar.Adjustment.Value = Tools.StrokeWidth;
85 widthBox.Adjustment.Upper = 100;
86 widthBox.Adjustment.Value = Tools.StrokeWidth;
87 if (color1)
88 {
89 rBar.Adjustment.Value = Tools.drawColor.R;
90 gBar.Adjustment.Value = Tools.drawColor.G;
91 bBar.Adjustment.Value = Tools.drawColor.B;
92 }
93 else
94 {
95 rBar.Adjustment.Value = Tools.eraseColor.R;
96 gBar.Adjustment.Value = Tools.eraseColor.G;
97 bBar.Adjustment.Value = Tools.eraseColor.B;
98 }
99 image.QueueDraw();
100 App.ApplyStyles(this);
101 }
void SetupHandlers()
It sets up the event handlers for the sliders and text boxes.
Definition ColorTool.cs:107

Member Function Documentation

◆ Create()

static ColorTool BioGTK.ColorTool.Create ( bool color1)
static

It creates a new instance of the ColorTool class, which is a GTK# widget that allows the user to select a color

Parameters
ColorSThe color to be displayed in the color tool.
Returns
A new instance of the ColorTool class.

Definition at line 57 of file ColorTool.cs.

58 {
59 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/ColorTool.glade", FileMode.Open));
60 return new ColorTool(builder, builder.GetObject("colorTool").Handle, color1);
61 }

◆ SetupHandlers()

void BioGTK.ColorTool.SetupHandlers ( )
protected

It sets up the event handlers for the sliders and text boxes.

Definition at line 107 of file ColorTool.cs.

108 {
109 rBar.ChangeValue += ChangeValue;
110 gBar.ChangeValue += ChangeValue;
111 bBar.ChangeValue += ChangeValue;
112 widthBar.ChangeValue += ChangeValue;
113 rBox.ChangeValue += Box_ChangeValue;
114 gBox.ChangeValue += Box_ChangeValue;
115 bBox.ChangeValue += Box_ChangeValue;
116 widthBox.ChangeValue += Box_ChangeValue;
117 image.Drawn += Image_Drawn;
118 cancelBut.Clicked += CancelBut_Clicked;
119 okBut.Clicked += OkBut_Clicked;
120 }

Property Documentation

◆ ColorS

ColorS BioGTK.ColorTool.ColorS
get

Definition at line 197 of file ColorTool.cs.

198 {
199 get
200 {
201 return new ColorS((ushort)rBox.Value, (ushort)gBox.Value, (ushort)bBox.Value);
202 }
203 }

◆ RGBA

RGBA BioGTK.ColorTool.RGBA
get

Definition at line 205 of file ColorTool.cs.

206 {
207 get {
208 RGBA rgb = new RGBA();
209 rgb.Red = (float)rBox.Value / (float)ushort.MaxValue;
210 rgb.Green = (float)gBox.Value / (float)ushort.MaxValue;
211 rgb.Blue = (float)bBox.Value / (float)ushort.MaxValue;
212 rgb.Alpha = 1.0;
213 return rgb; }
214 }

The documentation for this class was generated from the following file: