←Select platform

CalculatePaintModeRectangle Method

Summary
Adjusts the given rectangle based on the given paint mode properties.
Syntax
C#
Objective-C
C++/CLI
Java
Python
+ (LeadRect)calculatePaintModeRectangle:(NSInteger)sourceWidth  
                           sourceHeight:(NSInteger)sourceHeight  
                   destinationRectangle:(LeadRect)dstRect  
                               sizeMode:(LTRasterPaintSizeMode)sizeMode  
                    horizontalAlignMode:(LTRasterPaintAlignMode)horizontalAlignMode  
                      verticalAlignMode:(LTRasterPaintAlignMode)verticalAlignMode 

Parameters

sourceWidth
The width of the source rectangle.

sourceHeight
The height of the source rectangle.

destinationRectangle
Destination rectangle.

sizeMode
Controls how the source rectangle is positioned inside the destination rectangle.

horizontalAlignMode
Controls how the source rectangle is aligned horizontally inside the destination rectangle.

verticalAlignMode
Controls how the source rectangle is aligned vertically inside the destination rectangle.

Return Value

The new destination rectangle adjusted based on the size mode and alignment.

Remarks

This method allows you to calculate how a source rectangle can be adjusted into a destination rectangle based on a size mode and alignment.

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 CalculatePaintModeRectangleExample() 
{ 
	// assume image width/height of 3000 x 1000 
	// assume client rectangle of 500 x 500 
	LeadRect client = new LeadRect(0, 0, 500, 500); 
	LeadRect fit = RasterImage.CalculatePaintModeRectangle(3000, 1000, client, RasterPaintSizeMode.Fit, RasterPaintAlignMode.Near, RasterPaintAlignMode.Near); 
	Console.WriteLine("{0},{1},{2},{3}", fit.Left, fit.Top, fit.Right, fit.Bottom); 
} 
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.