copy_rectangleT_copy_rectangleCopyRectangleCopyRectanglecopy_rectangle (Operator)

Name

copy_rectangleT_copy_rectangleCopyRectangleCopyRectanglecopy_rectangle — Copy all pixels within rectangles between output windows.

Signature

copy_rectangle( : : WindowHandleSource, WindowHandleDestination, Row1, Column1, Row2, Column2, DestRow, DestColumn : )

Herror T_copy_rectangle(const Htuple WindowHandleSource, const Htuple WindowHandleDestination, const Htuple Row1, const Htuple Column1, const Htuple Row2, const Htuple Column2, const Htuple DestRow, const Htuple DestColumn)

void CopyRectangle(const HTuple& WindowHandleSource, const HTuple& WindowHandleDestination, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, const HTuple& DestRow, const HTuple& DestColumn)

void HWindow::CopyRectangle(const HWindow& WindowHandleDestination, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, const HTuple& DestRow, const HTuple& DestColumn) const

void HWindow::CopyRectangle(const HWindow& WindowHandleDestination, Hlong Row1, Hlong Column1, Hlong Row2, Hlong Column2, Hlong DestRow, Hlong DestColumn) const

static void HOperatorSet.CopyRectangle(HTuple windowHandleSource, HTuple windowHandleDestination, HTuple row1, HTuple column1, HTuple row2, HTuple column2, HTuple destRow, HTuple destColumn)

void HWindow.CopyRectangle(HWindow windowHandleDestination, HTuple row1, HTuple column1, HTuple row2, HTuple column2, HTuple destRow, HTuple destColumn)

void HWindow.CopyRectangle(HWindow windowHandleDestination, int row1, int column1, int row2, int column2, int destRow, int destColumn)

def copy_rectangle(window_handle_source: HHandle, window_handle_destination: HHandle, row_1: MaybeSequence[int], column_1: MaybeSequence[int], row_2: MaybeSequence[int], column_2: MaybeSequence[int], dest_row: MaybeSequence[int], dest_column: MaybeSequence[int]) -> None

Description

copy_rectanglecopy_rectangleCopyRectangleCopyRectangleCopyRectanglecopy_rectangle copies all pixels from the window WindowHandleSourceWindowHandleSourceWindowHandleSourceWindowHandleSourcewindowHandleSourcewindow_handle_source in the window WindowHandleDestinationWindowHandleDestinationWindowHandleDestinationWindowHandleDestinationwindowHandleDestinationwindow_handle_destination. It copies pixels which reside inside a rectangle which is specified by parameters Row1Row1Row1Row1row1row_1, Column1Column1Column1Column1column1column_1, Row2Row2Row2Row2row2row_2 and Column2Column2Column2Column2column2column_2. The target position is specified through the upper left corner of the rectangle (DestRowDestRowDestRowDestRowdestRowdest_row, DestColumnDestColumnDestColumnDestColumndestColumndest_column).

If you want to move more than one rectangle, you may pass them at once (in form of the tuple mode).

You may use copy_rectanglecopy_rectangleCopyRectangleCopyRectangleCopyRectanglecopy_rectangle to copy edited graphics from an “invisible” window in a visible window. Therefore a window with the option 'buffer' is opened. The graphics is then displayed in this window and is copied in a visible window afterwards. The advantage of this strategy is, that copy_rectanglecopy_rectangleCopyRectangleCopyRectangleCopyRectanglecopy_rectangle is much more rapid than output operators as, e.g., disp_channeldisp_channelDispChannelDispChannelDispChanneldisp_channel. This means a particular advantage while using demo programs. You could even realize short “clips”: you have to create for every image of a sequence a window of a 'buffer' type and pass the data into it. Output is the image sequence whereat all buffers are copied one after another in a visible window.

Attention

Both windows have to reside on the same display.

Execution Information

Parameters

WindowHandleSourceWindowHandleSourceWindowHandleSourceWindowHandleSourcewindowHandleSourcewindow_handle_source (input_control)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Source window handle.

WindowHandleDestinationWindowHandleDestinationWindowHandleDestinationWindowHandleDestinationwindowHandleDestinationwindow_handle_destination (input_control)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Destination window handle.

Row1Row1Row1Row1row1row_1 (input_control)  rectangle.origin.y(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row index of upper left corner in the source window.

Default value: 0

Typical range of values: 0 ≤ Row1 Row1 Row1 Row1 row1 row_1 ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

Column1Column1Column1Column1column1column_1 (input_control)  rectangle.origin.x(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column index of upper left corner in the source window.

Default value: 0

Typical range of values: 0 ≤ Column1 Column1 Column1 Column1 column1 column_1 ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

Row2Row2Row2Row2row2row_2 (input_control)  rectangle.corner.y(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row index of lower right corner in the source window.

Default value: 128

Typical range of values: 0 ≤ Row2 Row2 Row2 Row2 row2 row_2 ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

Restriction: Row2 >= Row1

Column2Column2Column2Column2column2column_2 (input_control)  rectangle.corner.x(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column index of lower right corner in the source window.

Default value: 128

Typical range of values: 0 ≤ Column2 Column2 Column2 Column2 column2 column_2 ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

Restriction: Column2 >= Column1

DestRowDestRowDestRowDestRowdestRowdest_row (input_control)  point.y(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row index of upper left corner in the target window.

Default value: 0

Typical range of values: 0 ≤ DestRow DestRow DestRow DestRow destRow dest_row ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

DestColumnDestColumnDestColumnDestColumndestColumndest_column (input_control)  point.x(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column index of upper left corner in the target window.

Default value: 0

Typical range of values: 0 ≤ DestColumn DestColumn DestColumn DestColumn destColumn dest_column ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

Example (HDevelop)

read_image(Image,'monkey')
open_window(0,0,-1,-1,'root','buffer','',WindowHandleBuffer)
disp_obj(Image,WindowHandleBuffer)
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
draw_rectangle1 (WindowHandle, Row1, Column1, Row2, Column2)
copy_rectangle(WindowHandleBuffer,WindowHandle,\
               Row1, Column1, Row2, Column2,Row1,Column1)
close_window(WindowHandleBuffer)

Example (C)

read_image(Image,"monkey");
open_window(0,0,-1,-1,"root","buffer","",&WindowHandle);
disp_image(Image,WindowHandle);
open_window(0,0,-1,-1,"root","visible","",&WindowHandleDestination);
do {
  get_mbutton(WindowHandleDestination,&Row,&Column,&Button);
  copy_rectangle(BufferID,WindowHandleDestination,90,120,390,Row,Column);
}
while(Button > 1);
close_window(WindowHandleDestination);
close_window(WindowHandle);

Example (HDevelop)

read_image(Image,'monkey')
open_window(0,0,-1,-1,'root','buffer','',WindowHandleBuffer)
disp_obj(Image,WindowHandleBuffer)
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
draw_rectangle1 (WindowHandle, Row1, Column1, Row2, Column2)
copy_rectangle(WindowHandleBuffer,WindowHandle,\
               Row1, Column1, Row2, Column2,Row1,Column1)
close_window(WindowHandleBuffer)

Example (HDevelop)

read_image(Image,'monkey')
open_window(0,0,-1,-1,'root','buffer','',WindowHandleBuffer)
disp_obj(Image,WindowHandleBuffer)
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
draw_rectangle1 (WindowHandle, Row1, Column1, Row2, Column2)
copy_rectangle(WindowHandleBuffer,WindowHandle,\
               Row1, Column1, Row2, Column2,Row1,Column1)
close_window(WindowHandleBuffer)

Example (HDevelop)

read_image(Image,'monkey')
open_window(0,0,-1,-1,'root','buffer','',WindowHandleBuffer)
disp_obj(Image,WindowHandleBuffer)
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
draw_rectangle1 (WindowHandle, Row1, Column1, Row2, Column2)
copy_rectangle(WindowHandleBuffer,WindowHandle,\
               Row1, Column1, Row2, Column2,Row1,Column1)
close_window(WindowHandleBuffer)

Result

If the output window is valid and if the specified parameters are correct close_windowclose_windowCloseWindowCloseWindowCloseWindowclose_window returns 2 (H_MSG_TRUE). If necessary an exception is raised.

Possible Predecessors

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

Possible Successors

close_windowclose_windowCloseWindowCloseWindowCloseWindowclose_window

Alternatives

move_rectanglemove_rectangleMoveRectangleMoveRectangleMoveRectanglemove_rectangle, slide_imageslide_imageSlideImageSlideImageSlideImageslide_image

See also

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

Module

Foundation