set_partT_set_partSetPartSetPart (Operator)

Name

set_partT_set_partSetPartSetPart — Modify the displayed image part.

Signature

set_part( : : WindowHandle, Row1, Column1, Row2, Column2 : )

Herror T_set_part(const Htuple WindowHandle, const Htuple Row1, const Htuple Column1, const Htuple Row2, const Htuple Column2)

void SetPart(const HTuple& WindowHandle, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2)

void HWindow::SetPart(const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2) const

void HWindow::SetPart(Hlong Row1, Hlong Column1, Hlong Row2, Hlong Column2) const

static void HOperatorSet.SetPart(HTuple windowHandle, HTuple row1, HTuple column1, HTuple row2, HTuple column2)

void HWindow.SetPart(HTuple row1, HTuple column1, HTuple row2, HTuple column2)

void HWindow.SetPart(int row1, int column1, int row2, int column2)

Description

set_partset_partSetPartSetPartSetPart modifies the image part that is displayed in the window. (Row1Row1Row1Row1row1,Column1Column1Column1Column1column1) denotes the upper left corner and (Row2Row2Row2Row2row2,Column2Column2Column2Column2column2) the lower right corner of the image part to display. The changed values are used by gray value output operators (disp_imagedisp_imageDispImageDispImageDispImage, disp_colordisp_colorDispColorDispColorDispColor) as well as region output operators (disp_regiondisp_regionDispRegionDispRegionDispRegion).

If only part of an image is displayed, it will be zoomed to full window size. The zooming interpolation method can be set with set_part_styleset_part_styleSetPartStyleSetPartStyleSetPartStyle. get_partget_partGetPartGetPartGetPart returns the values of the image part to display. Adapting the size of the window to the size of the image part to be displayed will prevent slowing down the display due to necessary interpolations. Thus, the window preferably has the same size as the image part to be displayed, or otherwise half its size, quarter its size, etc.

Beside setting the image part directly, the following special modes are supported:

Row1Row1Row1Row1row1 = Column1Column1Column1Column1column1 = Row2Row2Row2Row2row2 = Column2Column2Column2Column2column2 = -1:

The window size is chosen as the image part, i.e. no zooming of the image will be performed.

Row1Row1Row1Row1row1, Column1Column1Column1Column1column1 > -1 and Row2Row2Row2Row2row2 = Column2Column2Column2Column2column2 = -1:

The size of the last displayed image (in this window) is chosen as the image part, i.e. the image can completely be displayed in the image. For this the image will be zoomed if necessary.

Row1Row1Row1Row1row1 = Column1Column1Column1Column1column1 = 0 and Row2Row2Row2Row2row2 = Column2Column2Column2Column2column2 = -2:

The size of the last displayed image (in this window) is used to adapt the image part such that the image fits completely into the window, preserving the aspect ratio of the image. For this the image will be zoomed if necessary.

Execution Information

Parameters

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (input_control)  window HWindow, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Window handle.

Row1Row1Row1Row1row1 (input_control)  rectangle.origin.y HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Row of the upper left corner of the chosen image part.

Default value: 0

Column1Column1Column1Column1column1 (input_control)  rectangle.origin.x HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Column of the upper left corner of the chosen image part.

Default value: 0

Row2Row2Row2Row2row2 (input_control)  rectangle.corner.y HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Row of the lower right corner of the chosen image part.

Default value: -1

Restriction: Row2 >= Row1 || Row2 == -1 || Row1 == 0 && Row2 == -2

Column2Column2Column2Column2column2 (input_control)  rectangle.corner.x HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Column of the lower right corner of the chosen image part.

Default value: -1

Restriction: Column2 >= Column1 || Column2 == -1 || Column1 == 0 && Column2 == -2

Example (HDevelop)

get_system('width',Width)
get_system('height',Height)
set_part(WindowHandle,0,0,Height-1,Width-1)
disp_image(Image,WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)

Example (C)

get_system("width",width);
get_system("height",height);
create_tuple_i(&twidth, width-1);
create_tuple_i(&theight, height-1);
create_tuple_i(&zero, 0);
T_set_part(WindowHandle,zero,zero,theight,twidth);
destroy_tuple(twidth); destroy_tuple(theight); destroy_tuple(zero);
T_disp_image(Image,WindowHandle);
T_draw_rectangle1(WindowHandle,&Row1,&Col1,&Row2,&Col2);
T_set_part(WindowHandle,Row1,Col1,Row2,Col2);
T_disp_image(Image,WindowHandle);
destroy_tuple(Row1); destroy_tuple(Col1);
destroy_tuple(Row2); destroy_tuple(Col2);

Example (HDevelop)

get_system('width',Width)
get_system('height',Height)
set_part(WindowHandle,0,0,Height-1,Width-1)
disp_image(Image,WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)

Example (HDevelop)

get_system('width',Width)
get_system('height',Height)
set_part(WindowHandle,0,0,Height-1,Width-1)
disp_image(Image,WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)

Example (HDevelop)

get_system('width',Width)
get_system('height',Height)
set_part(WindowHandle,0,0,Height-1,Width-1)
disp_image(Image,WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)

Result

set_partset_partSetPartSetPartSetPart returns 2 (H_MSG_TRUE) if the window is valid. Otherwise an exception is raised.

Possible Predecessors

get_partget_partGetPartGetPartGetPart

Possible Successors

set_part_styleset_part_styleSetPartStyleSetPartStyleSetPartStyle, disp_imagedisp_imageDispImageDispImageDispImage, disp_regiondisp_regionDispRegionDispRegionDispRegion

Alternatives

affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageAffineTransImage

See also

get_partget_partGetPartGetPartGetPart, set_part_styleset_part_styleSetPartStyleSetPartStyleSetPartStyle, disp_regiondisp_regionDispRegionDispRegionDispRegion, disp_imagedisp_imageDispImageDispImageDispImage, disp_colordisp_colorDispColorDispColorDispColor

Module

Foundation