Home Cooker Classes Others Rice
Classes  >  bitmap  >  Trim(int,int,int,int)
bitmap class : Trim(int,int,int,int) method

Description

Cuts out part of the image and returns it as new bitmap.

Syntax

bitmapInstance.Trim(int left, int top, int width, int height)

Arguments

ClassNameDescription
intleftHorizontal start position of cutting out.
inttopVertical start position of cutting out.
intwidthWidth of cutting out.
intheightHeight of cutting out.

Return value

ClassDescription
bitmapA new bitmap that was cutted out.

Sample code

1:

bitmap bmp = new bitmap("http://rice.aki.gs/cooker/img/someimage.png");

2:

bitmap newBmp = bmp.Trim(0, 0, 100, 100);

Notes

If any of the arguments is less than zero, an UnknownException ( ArgumentOutOfRangeException ) will be thrown.

If the specified range exceeds the range of the bitmap, an UnknownException ( ArgumentOutOfRangeException ) will be thrown.

Links for reference

None

Copyright © Rice All rights reserved.