LEADTOOLS (Leadtools assembly)

CalculatePaintModeRectangle Method

Show in webframe
Example 







The width of the source rectangle.
The height of the source rectangle.
Destination rectangle.
Controls how the source rectangle is positioned inside the destination rectangle.
Controls how the source rectangle is aligned horizontally inside the destination rectangle.
Controls how the source rectangle is aligned vertically inside the destination rectangle.
Adjusts the given rectangle based on the given paint mode properties.
Syntax
'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)
+(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 
)

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
Copy Code  
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);
}
Requirements

Target Platforms

See Also

Reference

RasterImage Class
RasterImage Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.