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 )
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.
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
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); } }
[TestMethod] 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); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2