Skip to content

copy_rectangleCopyRectangleCopyRectanglecopy_rectangleT_copy_rectangleπŸ”—

Short descriptionπŸ”—

copy_rectangleCopyRectangleCopyRectanglecopy_rectangleT_copy_rectangle β€” Copy all pixels within rectangles between output windows.

SignatureπŸ”—

copy_rectangle( window WindowHandleSource, window WindowHandleDestination, rectangle.origin.y Row1, rectangle.origin.x Column1, rectangle.corner.y Row2, rectangle.corner.x Column2, point.y DestRow, point.x 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 )static void HOperatorSet.CopyRectangle( HTuple windowHandleSource, HTuple windowHandleDestination, HTuple row1, HTuple column1, HTuple row2, HTuple column2, HTuple destRow, HTuple 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

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 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

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 )

DescriptionπŸ”—

copy_rectangleCopyRectangle copies all pixels from the window WindowHandleSourcewindowHandleSourcewindow_handle_source in the window WindowHandleDestinationwindowHandleDestinationwindow_handle_destination. It copies pixels which reside inside a rectangle which is specified by parameters Row1row1row_1, Column1column1column_1, Row2row2row_2 and Column2column2column_2. The target position is specified through the upper left corner of the rectangle (DestRowdestRowdest_row, DestColumndestColumndest_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_rectangleCopyRectangle 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_rectangleCopyRectangle is much more rapid than output operators as, e.g., disp_channelDispChannel. 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πŸ”—

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πŸ”—

WindowHandleSourcewindowHandleSourcewindow_handle_source (input_control) window β†’ (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

Source window handle.

WindowHandleDestinationwindowHandleDestinationwindow_handle_destination (input_control) window β†’ (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

Destination window handle.

Row1row1row_1 (input_control) rectangle.origin.y(-array) β†’ (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Row index of upper left corner in the source window.

Default: 00
Value range: 0 ≀ Row1 ≀ 511 (lin)
Minimum increment: 1
Recommended increment: 1

Column1column1column_1 (input_control) rectangle.origin.x(-array) β†’ (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Column index of upper left corner in the source window.

Default: 00
Value range: 0 ≀ Column1 ≀ 511 (lin)
Minimum increment: 1
Recommended increment: 1

Row2row2row_2 (input_control) rectangle.corner.y(-array) β†’ (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Row index of lower right corner in the source window.

Default: 128128
Value range: 0 ≀ Row2 ≀ 511 (lin)
Minimum increment: 1
Recommended increment: 1
Restriction: Row2 >= Row1

Column2column2column_2 (input_control) rectangle.corner.x(-array) β†’ (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Column index of lower right corner in the source window.

Default: 128128
Value range: 0 ≀ Column2 ≀ 511 (lin)
Minimum increment: 1
Recommended increment: 1
Restriction: Column2 >= Column1

DestRowdestRowdest_row (input_control) point.y(-array) β†’ (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Row index of upper left corner in the target window.

Default: 00
Value range: 0 ≀ DestRow ≀ 511 (lin)
Minimum increment: 1
Recommended increment: 1

DestColumndestColumndest_column (input_control) point.x(-array) β†’ (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Column index of upper left corner in the target window.

Default: 00
Value range: 0 ≀ DestColumn ≀ 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)
(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)\;

ResultπŸ”—

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

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

open_windowOpenWindow

Possible successors

close_windowCloseWindow

Alternatives

move_rectangleMoveRectangle, slide_imageSlideImage

See also

open_windowOpenWindow

ModuleπŸ”—

Foundation