bitmap class : Trim(int,int,int,int) method
Description
Cuts out part of the image and returns it as new bitmap.
Syntax
instance.Trim(int left, int top, int width, int height)
Arguments
None.
Class | Name | Description |
int | left | Horizontal start position of cutting out. |
int | top | Vertical start position of cutting out. |
int | width | Width of cutting out. |
int | height | Height of cutting out. |
Return value
None.
Class | Description |
bitmap | A 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
Arguments should be specified in physical pixels.
If any of the arguments is less than zero, an exception, RtypeException, will be thrown.
If the specified range exceeds the range of the bitmap, an exception, RtypeException, will be thrown.
Links for reference
None.