poIImagePlane SetCrop

Crops the image plane content.

Syntax

Imageplane_handle SetCropminx miny maxx maxy

Application

HyperView Tcl Modify

Description

The image or video can be cropped before being drawn in the HyperView window. This command specifies the crop settings for the image plane. The required values are the left, top, right, and bottom, and range in value between 0 and 1, expressed as a percentage of the image width or height that will be cropped from that edge.. No crop is expressed as “0.0 0.0 1.0 1.0”.

Inputs

minx
The amount to crop from the left edge of the image. 0 means no crop.
miny
The amount to crop from the top edge of the image. 0 means no crop.
maxx
The amount to crop from the right edge of the image. 1.0 means no crop.
maxy
The amount to crop from the bottom edge of the image. 1.0 means no crop.

Example

To create two image planes, and then crop one of the image planes:
hwi OpenStack
if {[catch {
    hwi GetSessionHandle session_handle
    session_handle GetProjectHandle project_handle
    project_handle GetPageHandle page_handle [project_handle GetActivePage]
    page_handle GetWindowHandle window_handle [page_handle GetActiveWindow]
    window_handle GetClientHandle client_handle
    client_handle GetImagePlaneCtrlHandle ipc_handle
    set ipid1 [ipc_handle AddImagePlane Logo1]
    ipc_handle GetImagePlaneHandle imageplane_handle $ipid1
    imageplane_handle SetFileName g:/samples2/VideoOverlay/logo1.jpg
    imageplane_handle SetMode background
    imageplane_handle ReleaseHandle
    set ipid2 [ipc_handle AddImagePlane Video1]
    ipc_handle GetImagePlaneHandle imageplane_handle $ipid2
    imageplane_handle SetFileName g:/samples2/VideoOverlay/video1.jpg
    imageplane_handle SetMode background
    imageplane_handle ReleaseHandle

    ipc_handle GetImagePlaneHandle imageplane_handle $ipid1
    imageplane_handle SetLabel "Company Logo";
    imageplane_handle SetAlpha 80
    imageplane_handle SetMode foreground
    imageplane_handle SetAssociatedModelID 1
    imageplane_handle SetCullAngle 45
    imageplane_handle SetBackFaceVisibility true
    imageplane_handle SetCrop 0.2 0.2 0.8 0.8
    imageplane_handle SetStretchToFit false
    imageplane_handle SetMaintainAspectRatio false
    client_handle Draw
} result]} {
    global errorInfo;
    puts stderr $result;
    puts "[session_handle GetError]";
    puts stderr "*** Tcl TRACE ***";
    puts stderr $errorInfo;
} else {
    puts "No errors.";
    puts "Warnings: ";
    puts "    [session_handle GetError]";
}

hwi CloseStack

Errors

Returns HW_InvalidHandle if the image plane handle is invalid, or HW_InvalidArgs if the specified crop parameters are invalid.