←Select platform

PaintIntensity Property

Summary
Gets or sets the current intensity value for the image.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public int PaintIntensity { get; set; } 
@property (nonatomic, assign) NSInteger paintIntensity 
public int getPaintIntensity(); 
public void setPaintIntensity( 
   int intValue 
); 
public: 
property int PaintIntensity { 
   int get(); 
   void set (    int ); 
} 
PaintIntensity # get and set (RasterImage) 

Property Value

The current intensity value.

Remarks

Amount to change the intensity. Valid values are -1000 to +1000. A positive value increases (or lightens) the brightness of the display. A negative values decreases (or darkens) the brightness of the display.

For more information, refer to Changing Brightness and Contrast.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Dicom; 
using Leadtools.Drawing; 
using Leadtools.Controls; 
using Leadtools.Svg; 
 
 
public void IntensityExample() 
{ 
	IntensityForm f = new IntensityForm(); 
	f.ShowDialog(); 
} 
 
class IntensityForm : Form 
{ 
	ImageViewer viewer; 
	TrackBar gammaTrackBar; 
	TrackBar contrastTrackBar; 
	TrackBar intensityTrackBar; 
 
	public IntensityForm() 
	{ 
		// Create the controls 
		Size = new Size(800, 600); 
		Panel controlsPanel = new Panel(); 
		controlsPanel.Size = new Size(400, 0); 
		controlsPanel.BorderStyle = BorderStyle.Fixed3D; 
		controlsPanel.Dock = DockStyle.Left; 
 
		int labelLeft = 8; 
		int y = 16; 
		int trackBarLeft = 100; 
 
		Label gammaLabel = new Label(); 
		gammaLabel.Text = "Gamma:"; 
		gammaLabel.Location = new Point(labelLeft, y); 
		gammaLabel.AutoSize = true; 
		controlsPanel.Controls.Add(gammaLabel); 
 
		gammaTrackBar = new TrackBar(); 
		gammaTrackBar.Minimum = 1; 
		gammaTrackBar.Maximum = 100; 
		gammaTrackBar.TickFrequency = (gammaTrackBar.Maximum - gammaTrackBar.Minimum) / 10; 
		gammaTrackBar.Location = new Point(trackBarLeft, y); 
		gammaTrackBar.Width = 200; 
		gammaTrackBar.Scroll += new EventHandler(gammaTrackBar_Scroll); 
		controlsPanel.Controls.Add(gammaTrackBar); 
		gammaLabel.Top = gammaTrackBar.Top + (gammaTrackBar.Height - gammaLabel.Height) / 2; 
		y = gammaTrackBar.Bottom + 8; 
 
		Label contrastLabel = new Label(); 
		contrastLabel.Text = "Contrast:"; 
		contrastLabel.Location = new Point(labelLeft, y); 
		contrastLabel.AutoSize = true; 
		controlsPanel.Controls.Add(contrastLabel); 
 
		contrastTrackBar = new TrackBar(); 
		contrastTrackBar.Minimum = -1000; 
		contrastTrackBar.Maximum = 1000; 
		contrastTrackBar.TickFrequency = (contrastTrackBar.Maximum - contrastTrackBar.Minimum) / 10; 
		contrastTrackBar.Location = new Point(trackBarLeft, y); 
		contrastTrackBar.Width = 200; 
		contrastTrackBar.Scroll += new EventHandler(contrastTrackBar_Scroll); 
		controlsPanel.Controls.Add(contrastTrackBar); 
		contrastLabel.Top = contrastTrackBar.Top + (contrastTrackBar.Height - contrastLabel.Height) / 2; 
		y = contrastTrackBar.Bottom + 8; 
 
		Label intensityLabel = new Label(); 
		intensityLabel.Text = "Intensity:"; 
		intensityLabel.Location = new Point(labelLeft, y); 
		intensityLabel.AutoSize = true; 
		controlsPanel.Controls.Add(intensityLabel); 
		y = intensityLabel.Bottom + 8; 
 
		intensityTrackBar = new TrackBar(); 
		intensityTrackBar.Minimum = -1000; 
		intensityTrackBar.Maximum = 1000; 
		intensityTrackBar.TickFrequency = (intensityTrackBar.Maximum - intensityTrackBar.Minimum) / 10; 
		intensityTrackBar.Location = new Point(trackBarLeft, y); 
		intensityTrackBar.Width = 200; 
		intensityTrackBar.Scroll += new EventHandler(intensityTrackBar_Scroll); 
		controlsPanel.Controls.Add(intensityTrackBar); 
		intensityLabel.Top = intensityTrackBar.Top + (intensityTrackBar.Height - intensityLabel.Height) / 2; 
		y = intensityTrackBar.Bottom + 8; 
 
		Button defaultButton = new Button(); 
		defaultButton.Text = "Default"; 
		defaultButton.Location = new Point(labelLeft, y); 
		defaultButton.Click += new EventHandler(defaultButton_Click); 
		controlsPanel.Controls.Add(defaultButton); 
 
		Controls.Add(controlsPanel); 
 
		viewer = new ImageViewer(); 
		viewer.Dock = DockStyle.Fill; 
		Controls.Add(viewer); 
		viewer.BringToFront(); 
 
		// Load the image 
		using (RasterCodecs codecs = new RasterCodecs()) 
		{ 
			string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"); 
			viewer.Image = codecs.Load(srcFileName); 
		} 
 
		gammaTrackBar.Value = viewer.Image.PaintGamma; 
		contrastTrackBar.Value = viewer.Image.PaintContrast; 
		intensityTrackBar.Value = viewer.Image.PaintIntensity; 
		UpdateValues(); 
	} 
 
	void UpdateValues() 
	{ 
		string str = string.Format( 
		   "Gamma = {0}, Contrast = {1}, Intensity = {2}", 
		   viewer.Image.PaintGamma, viewer.Image.PaintContrast, viewer.Image.PaintIntensity); 
		Text = str; 
	} 
 
	void gammaTrackBar_Scroll(object sender, EventArgs e) 
	{ 
		TrackBar tb = sender as TrackBar; 
		viewer.Image.PaintGamma = tb.Value; 
		UpdateValues(); 
	} 
 
	void contrastTrackBar_Scroll(object sender, EventArgs e) 
	{ 
		TrackBar tb = sender as TrackBar; 
		viewer.Image.PaintContrast = tb.Value; 
		UpdateValues(); 
	} 
 
	void intensityTrackBar_Scroll(object sender, EventArgs e) 
	{ 
		TrackBar tb = sender as TrackBar; 
		viewer.Image.PaintIntensity = tb.Value; 
		UpdateValues(); 
	} 
 
	void defaultButton_Click(object sender, EventArgs e) 
	{ 
		viewer.Image.PaintGamma = 100; 
		viewer.Image.PaintIntensity = 0; 
		viewer.Image.PaintContrast = 0; 
 
		gammaTrackBar.Value = viewer.Image.PaintGamma; 
		contrastTrackBar.Value = viewer.Image.PaintContrast; 
		intensityTrackBar.Value = viewer.Image.PaintIntensity; 
 
		UpdateValues(); 
	} 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.5.16
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.