BioGTK  5.1.1
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images.
Loading...
Searching...
No Matches
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]
 

Constructor & Destructor Documentation

◆ ColorTool()

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

Member Function Documentation

◆ Create()

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

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.
59 {
60 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/ColorTool.glade", FileMode.Open));
61 return new ColorTool(builder, builder.GetObject("colorTool").Handle, color1);
62 }
ColorTool(Builder builder, IntPtr handle, bool color1)
Definition ColorTool.cs:66

◆ SetupHandlers()

void BioGTK.ColorTool.SetupHandlers ( )
inlineprotected

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

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

Property Documentation

◆ ColorS

ColorS BioGTK.ColorTool.ColorS
get
199 {
200 get
201 {
202 return new ColorS((ushort)rBox.Value, (ushort)gBox.Value, (ushort)bBox.Value);
203 }
204 }
ColorS ColorS
Definition ColorTool.cs:199

◆ RGBA

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

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