Operator Reference

copy_rectangleT_copy_rectangleCopyRectangleCopyRectanglecopy_rectangle (Operator)

copy_rectangleT_copy_rectangleCopyRectangleCopyRectanglecopy_rectangle — Copy all pixels within rectangles between output windows.

Signature

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

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_rectangleCopyRectangleCopyRectanglecopy_rectangle copies all pixels from the window WindowHandleSourceWindowHandleSourceWindowHandleSourcewindowHandleSourcewindow_handle_source in the window WindowHandleDestinationWindowHandleDestinationWindowHandleDestinationwindowHandleDestinationwindow_handle_destination. It copies pixels which reside inside a rectangle which is specified by parameters Row1Row1Row1row1row_1, Column1Column1Column1column1column_1, Row2Row2Row2row2row_2 and Column2Column2Column2column2column_2. The target position is specified through the upper left corner of the rectangle (DestRowDestRowDestRowdestRowdest_row, DestColumnDestColumnDestColumndestColumndest_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_rectangleCopyRectangleCopyRectanglecopy_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_rectangleCopyRectangleCopyRectanglecopy_rectangle is much more rapid than output operators as, e.g., disp_channeldisp_channelDispChannelDispChanneldisp_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

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

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

Source window handle.

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

Destination window handle.

Row1Row1Row1row1row_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: 0

Value range: 0 ≤ Row1 Row1 Row1 row1 row_1 ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

Column1Column1Column1column1column_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: 0

Value range: 0 ≤ Column1 Column1 Column1 column1 column_1 ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

Row2Row2Row2row2row_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: 128

Value range: 0 ≤ Row2 Row2 Row2 row2 row_2 ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

Restriction: Row2 >= Row1

Column2Column2Column2column2column_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: 128

Value range: 0 ≤ Column2 Column2 Column2 column2 column_2 ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

Restriction: Column2 >= Column1

DestRowDestRowDestRowdestRowdest_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: 0

Value range: 0 ≤ DestRow DestRow DestRow destRow dest_row ≤ 511 (lin)

Minimum increment: 1

Recommended increment: 1

DestColumnDestColumnDestColumndestColumndest_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: 0

Value range: 0 ≤ 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)

Result

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

Possible Predecessors

open_windowopen_windowOpenWindowOpenWindowopen_window

Possible Successors

close_windowclose_windowCloseWindowCloseWindowclose_window

Alternatives

move_rectanglemove_rectangleMoveRectangleMoveRectanglemove_rectangle, slide_imageslide_imageSlideImageSlideImageslide_image

See also

open_windowopen_windowOpenWindowOpenWindowopen_window

Module

Foundation