'Declaration Public Property AspectNumeratorY As Integer
'Usage Dim instance As ImGearARTRuler Dim value As Integer instance.AspectNumeratorY = value value = instance.AspectNumeratorY
public int AspectNumeratorY {get; set;}
'Declaration Public Property AspectNumeratorY As Integer
'Usage Dim instance As ImGearARTRuler Dim value As Integer instance.AspectNumeratorY = value value = instance.AspectNumeratorY
public int AspectNumeratorY {get; set;}
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.// 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);
' Setup start and endpoint for the ruler. Dim startPoint As ImGearPoint = New ImGearPoint(10, 10) Dim endPoint As ImGearPoint = New ImGearPoint(igPage.DIB.Width / 2, igPage.DIB.Height / 2) ' Setup color for the ruler. Dim color As ImGearRGBQuad = New ImGearRGBQuad(0, 255, 0) ' Get and initialize image resolution for the ruler. Dim imageResolution As ImGearResolution = 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. Dim ruler As ImGearARTRuler = New ImGearARTRuler(startPoint, endPoint, color, imageResolution) ' Let's change measurement unit to inches. imageResolution.ConvertUnits(ImGearResolutionUnits.INCHES) ' Set number of pixels per 1 inch. ruler.AspectDenominatorX = 1 * CInt(Math.Round(CDbl(imageResolution.XNumerator) / CDbl(imageResolution.XDenominator))) ruler.AspectDenominatorY = 1 * CInt(Math.Round(CDbl(imageResolution.YNumerator) / CDbl(imageResolution.YDenominator))) ' Set 1 inch scale. ruler.AspectNumeratorX = 1 ruler.AspectNumeratorY = 1 ruler.Label = "%d in" ' Change measurement units back to the mm. imageResolution.ConvertUnits(ImGearResolutionUnits.METERS) ' Set number of pixels per 1 meter. ruler.AspectDenominatorX = 1 * CInt(Math.Round(CDbl(imageResolution.XNumerator) / CDbl(imageResolution.XDenominator))) ruler.AspectDenominatorY = 1 * CInt(Math.Round(CDbl(imageResolution.YNumerator) / CDbl(imageResolution.YDenominator))) ' Set 1 mm scale. ruler.AspectNumeratorX = 1000 ruler.AspectNumeratorY = 1000 ruler.Label = "%d mm" igARTPage.AddMark(ruler, ImGearARTCoordinatesType.IMAGE_COORD)