Home News DOC Class DL Others Rice
Class  >  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

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

Arguments

None.

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

Return value

None.

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

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.

Copyright © Rice All rights reserved.