copy_rectangleT_copy_rectangleCopyRectangleCopyRectanglecopy_rectangle复制矩形(算子)

名称

copy_rectangleT_copy_rectangleCopyRectangleCopyRectanglecopy_rectangle — 复制输出窗口之间矩形内的所有像素。

签名

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

描述

copy_rectanglecopy_rectangleCopyRectangleCopyRectangleCopyRectanglecopy_rectangle 将窗口 WindowHandleSourceWindowHandleSourceWindowHandleSourceWindowHandleSourcewindowHandleSourcewindow_handle_source 中的所有像素复制到窗口 WindowHandleDestinationWindowHandleDestinationWindowHandleDestinationWindowHandleDestinationwindowHandleDestinationwindow_handle_destination。它复制位于由参数 Row1Row1Row1Row1row1row_1Column1Column1Column1Column1column1column_1Row2Row2Row2Row2row2row_2Column2Column2Column2Column2column2column_2 指定的矩形区域内的像素。目标位置通过矩形左上角坐标(DestRowDestRowDestRowDestRowdestRowdest_row, DestColumnDestColumnDestColumnDestColumndestColumndest_column)来指定。

若需移动多个矩形,可一次性传递它们(采用元组模式)。

您可以使用 copy_rectanglecopy_rectangleCopyRectangleCopyRectangleCopyRectanglecopy_rectangle 将编辑后的图形从“不可见”窗口复制到可见窗口。因此会打开一个启用‘缓冲区’选项的窗口。图形先在此窗口显示,随后复制到可见窗口。此策略的优势在于 copy_rectanglecopy_rectangleCopyRectangleCopyRectangleCopyRectanglecopy_rectangle 远比输出算子(如 disp_channeldisp_channelDispChannelDispChannelDispChanneldisp_channel)高效,这在演示程序中尤为重要。您甚至可实现简短的“剪辑”效果:只需为序列中的每张图像创建一个‘缓冲区’类型的窗口并传递数据。输出即为图像序列,此时所有缓冲区将依次复制到可见窗口中。

注意

两个窗口必须位于同一显示器上。

执行信息

参数

WindowHandleSourceWindowHandleSourceWindowHandleSourceWindowHandleSourcewindowHandleSourcewindow_handle_source (输入控制)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

源窗口句柄。

WindowHandleDestinationWindowHandleDestinationWindowHandleDestinationWindowHandleDestinationwindowHandleDestinationwindow_handle_destination (输入控制)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

目标窗口句柄。

Row1Row1Row1Row1row1row_1 (输入控制)  rectangle.origin.y(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

源窗口左上角的行索引。

默认值: 0

值范围: 0 ≤ Row1 Row1 Row1 Row1 row1 row_1 ≤ 511 (lin)

最小增量: 1

建议增量: 1

Column1Column1Column1Column1column1column_1 (输入控制)  rectangle.origin.x(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

源窗口左上角的列索引。

默认值: 0

值范围: 0 ≤ Column1 Column1 Column1 Column1 column1 column_1 ≤ 511 (lin)

最小增量: 1

建议增量: 1

Row2Row2Row2Row2row2row_2 (输入控制)  rectangle.corner.y(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

源窗口中右下角的行索引。

默认值: 128

值范围: 0 ≤ Row2 Row2 Row2 Row2 row2 row_2 ≤ 511 (lin)

最小增量: 1

建议增量: 1

限制: Row2 >= Row1

Column2Column2Column2Column2column2column_2 (输入控制)  rectangle.corner.x(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

源窗口中右下角的列索引。

默认值: 128

值范围: 0 ≤ Column2 Column2 Column2 Column2 column2 column_2 ≤ 511 (lin)

最小增量: 1

建议增量: 1

限制: Column2 >= Column1

DestRowDestRowDestRowDestRowdestRowdest_row (输入控制)  point.y(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

目标窗口左上角的行索引。

默认值: 0

值范围: 0 ≤ DestRow DestRow DestRow DestRow destRow dest_row ≤ 511 (lin)

最小增量: 1

建议增量: 1

DestColumnDestColumnDestColumnDestColumndestColumndest_column (输入控制)  point.x(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

目标窗口左上角的列索引。

默认值: 0

值范围: 0 ≤ DestColumn DestColumn DestColumn DestColumn destColumn dest_column ≤ 511 (lin)

最小增量: 1

建议增量: 1

示例(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);

示例(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)

示例(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)

示例(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)

结果

如果输出窗口有效且指定参数正确,close_windowclose_windowCloseWindowCloseWindowCloseWindowclose_window 返回 2 (H_MSG_TRUE)。如有必要,则抛出异常。

可能的前趋

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

可能的后继

close_windowclose_windowCloseWindowCloseWindowCloseWindowclose_window

替代

move_rectanglemove_rectangleMoveRectangleMoveRectangleMoveRectanglemove_rectangle, slide_imageslide_imageSlideImageSlideImageSlideImageslide_image

另见

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

模块

基础