Leadtools Namespace > RasterImage Class : CalculatePaintModeRectangle Method |
public static LeadRect CalculatePaintModeRectangle( int sourceWidth, int sourceHeight, LeadRect destinationRectangle, RasterPaintSizeMode sizeMode, RasterPaintAlignMode horizontalAlignMode, RasterPaintAlignMode verticalAlignMode )
'Declaration Public Shared Function CalculatePaintModeRectangle( _ ByVal sourceWidth As Integer, _ ByVal sourceHeight As Integer, _ ByVal destinationRectangle As LeadRect, _ ByVal sizeMode As RasterPaintSizeMode, _ ByVal horizontalAlignMode As RasterPaintAlignMode, _ ByVal verticalAlignMode As RasterPaintAlignMode _ ) As LeadRect
'Usage Dim sourceWidth As Integer Dim sourceHeight As Integer Dim destinationRectangle As LeadRect Dim sizeMode As RasterPaintSizeMode Dim horizontalAlignMode As RasterPaintAlignMode Dim verticalAlignMode As RasterPaintAlignMode Dim value As LeadRect value = RasterImage.CalculatePaintModeRectangle(sourceWidth, sourceHeight, destinationRectangle, sizeMode, horizontalAlignMode, verticalAlignMode)
public static LeadRect CalculatePaintModeRectangle( int sourceWidth, int sourceHeight, LeadRect destinationRectangle, RasterPaintSizeMode sizeMode, RasterPaintAlignMode horizontalAlignMode, RasterPaintAlignMode verticalAlignMode )
+(LeadRect)calculatePaintModeRectangle:(int)sourceWidth sourceHeight:(int)sourceHeight destinationRectangle:(LeadRect)destinationRectangle sizeMode:(LTRasterPaintSizeMode)sizeMode horizontalAlignMode:(LTRasterPaintAlignMode)horizontalAlignMode verticalAlignMode:(LTRasterPaintAlignMode)verticalAlignMode;
public static LeadRect calculatePaintModeRectangle( int sourceWidth, int sourceHeight, LeadRect destinationRectangle, RasterPaintSizeMode sizeMode, RasterPaintAlignMode horizontalAlignMode, RasterPaintAlignMode verticalAlignMode )
function Leadtools.RasterImage.CalculatePaintModeRectangle( sourceWidth , sourceHeight , destinationRectangle , sizeMode , horizontalAlignMode , verticalAlignMode )
public: static LeadRect CalculatePaintModeRectangle( int sourceWidth, int sourceHeight, LeadRect destinationRectangle, RasterPaintSizeMode sizeMode, RasterPaintAlignMode horizontalAlignMode, RasterPaintAlignMode verticalAlignMode )
This method allows you to calculate how a source rectangle can be adjusted into a destination rectangle based on a size mode and alignment.
Imports Leadtools Imports Leadtools.Codecs Imports Leadtools.ImageProcessing Imports Leadtools.ImageProcessing.Core Imports Leadtools.ImageProcessing.Color Imports Leadtools.WinForms Imports Leadtools.Dicom Imports Leadtools.Drawing Public Sub CalculatePaintModeRectangleExample() ' assume image width/height of 3000 x 1000 ' assume client rectangle of 500 x 500 Dim client As LeadRect = New LeadRect(0, 0, 500, 500) Dim fit As LeadRect = 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) End Sub
using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing; using Leadtools.ImageProcessing.Core; using Leadtools.ImageProcessing.Color; using Leadtools.WinForms; using Leadtools.Dicom; using Leadtools.Drawing; 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); }
RasterImageExamples.prototype.CalculatePaintModeRectangleExample = function ( ) { Tools.SetLicense ( ) ; with ( Leadtools ) { // assume image width/height of 3000 x 1000 // assume client rectangle of 500 x 500 var client = LeadRectHelper.create(0, 0, 500, 500); var fit = RasterImage.calculatePaintModeRectangle(3000, 1000, client, RasterPaintSizeMode.fit, RasterPaintAlignMode.near, RasterPaintAlignMode.near); console.info(fit.x + "," + fit.y+ "," + fit.width + "," + fit.height); } }
using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing; using Leadtools.ImageProcessing.Core; using Leadtools.ImageProcessing.Color; using Leadtools.Dicom; public void CalculatePaintModeRectangleExample() { // assume image width/height of 3000 x 1000 // assume client rectangle of 500 x 500 LeadRect client = LeadRectHelper.Create(0, 0, 500, 500); LeadRect fit = RasterImage.CalculatePaintModeRectangle(3000, 1000, client, RasterPaintSizeMode.Fit, RasterPaintAlignMode.Near, RasterPaintAlignMode.Near); Debug.WriteLine("{0},{1},{2},{3}", fit.X, fit.Y, fit.Width, fit.Height); }