ImageGear .NET - Updated December 24, 2018
AspectDenominatorY Property (ImGearARTRuler)
Example 




ImageGear24.Art Assembly > ImageGear.ART Namespace > ImGearARTRuler Class : AspectDenominatorY Property
Gets or sets the Mark's Y aspect denominator value.
Syntax
'Declaration
 
Public Property AspectDenominatorY As Integer
 
'Usage
 
Dim instance As ImGearARTRuler
Dim value As Integer
 
instance.AspectDenominatorY = value
 
value = instance.AspectDenominatorY

Property Value

Integer value.
Remarks
ART Ruler object is designed to display the distance between 2 points on the image. Point's coordinates are specified in image pixel units, and the Ruler displays the distance measured in these units.

AspectDenominator/AspectNumerator properties help to change measurement units from image pixels to more convenient measurement units, like meters or inches.

The default value is 1.
Example
// Setup start and endpoint for the ruler.
ImGearPoint startPoint = new ImGearPoint(10, 10);
ImGearPoint endPoint = new ImGearPoint(igPage.DIB.Width / 2, igPage.DIB.Height / 2);

// Setup color for the ruler.
ImGearRGBQuad color = new ImGearRGBQuad(0, 255, 0);

// Get and initialize image resolution for the ruler.
ImGearResolution imageResolution = new ImGearResolution(
        igPage.DIB.ImageResolution.XNumerator,
        igPage.DIB.ImageResolution.XDenominator,
        igPage.DIB.ImageResolution.YNumerator,
        igPage.DIB.ImageResolution.YDenominator,
        igPage.DIB.ImageResolution.Units);

// Create ruler, note that the ruler is always created with measurement units set to mm
// and it doesn't depend on ImGearResolution measurement units.
ImGearARTRuler ruler = new ImGearARTRuler(startPoint, endPoint, color, imageResolution);

// Let's change measurement units to inches.
imageResolution.ConvertUnits(ImGearResolutionUnits.INCHES);

// Set number of pixels per 1 inch.
ruler.AspectDenominatorX = 1 * (int)Math.Round((double)imageResolution.XNumerator / (double)imageResolution.XDenominator);
ruler.AspectDenominatorY = 1 * (int)Math.Round((double)imageResolution.YNumerator / (double)imageResolution.YDenominator);

// Set 1 inch scale.
ruler.AspectNumeratorX = 1;
ruler.AspectNumeratorY = 1;

ruler.Label = "%d in";

// Now change the measurement units back to the mm.
imageResolution.ConvertUnits(ImGearResolutionUnits.METERS);

// Set number of pixels per 1 meter.
ruler.AspectDenominatorX = 1 * (int)Math.Round((double)imageResolution.XNumerator / (double)imageResolution.XDenominator);
ruler.AspectDenominatorY = 1 * (int)Math.Round((double)imageResolution.YNumerator / (double)imageResolution.YDenominator);

// Set 1 mm scale.
ruler.AspectNumeratorX = 1000;
ruler.AspectNumeratorY = 1000;

ruler.Label = "%d mm";

igARTPage.AddMark(ruler, ImGearARTCoordinatesType.IMAGE_COORD);
See Also

Reference

ImGearARTRuler Class
ImGearARTRuler Members