MatrixLayer::CopyImage
CopyImage
Description
Copies part of an image from another matrix layer
Copies part of image from another matrix layer It copies only the part of image in source matrix layer that is within grObject
Syntax
BOOL CopyImage( MatrixLayer SrcLayer, int left, int top, int right, int bottom, BOOL bUndo = TRUE )
BOOL CopyImage( MatrixLayer SrcLayer, GraphObject grObject, BOOL bUndo = TRUE )
Parameters
- SrcLayer
- [input] Source matrix layer
- left
- [input] Rectangle left position in the source matrix layer to copy image from
- top
- [input] Rectangle top position in the source matrix layer to copy image from
- right
- [input] Rectangle right position in the source matrix layer to copy image from
- bottom
- [input] Rectangle bottom position in the source matrix layer to copy image from
- bUndo
- [input] Whether to support undo(TRUE) or not (FALSE). default is TRUE
- SrcLayer
- [input] source matrix layer
- grObject
- [input] closed graphic object (polygon, rectangle or circle)
- bUndo
- [input] Whether to support undo(TRUE) or not (FALSE). default is TRUE
Return
TRUE if success; otherwise FALSE
TRUE if success; otherwise FALSE
Examples
EX1
void MatrixLayer_CopyImage_Ex1()
{
MatrixPage mp = Project.MatrixPages(0);
if(!mp)
return;
MatrixLayer ml(mp.GetName());
if( !ml )
return;
MatrixPage mpCpy;
mpCpy.Create("origin.otm");
MatrixLayer mlCpy = mpCpy.Layers();
if(mlCpy)
{
BOOL bOK = mlCpy.CopyImage(ml, 0, 0, ml.GetNumCols(), ml.GetNumRows() , FALSE);
if(bOK && ml.HasImage())
{
mlCpy.SetViewImage(TRUE);
printf("Success to copy image!");
}
else if( !bOK )
printf("Fail to copy images!");
}
}
EX2
BOOL MatrixLayer_CopyImage_Ex2(string strObjectName = "ROI", string strMatrixName = "Matrix1")
{
MatrixPage mp = Project.MatrixPages(0);
if(!mp)
return FALSE;
MatrixLayer SrcMatrix(mp.GetName());
GraphObject grObject;
grObject = SrcMatrix.GraphObjects(strObjectName);
MatrixLayer DestMatrix;
BOOL bReturn = FALSE;
DestMatrix.Create();
DestMatrix.SetInternalData(SrcMatrix.GetInternalData(), FALSE, FALSE);
bReturn = DestMatrix.CopyImage(SrcMatrix, grObject, FALSE);
if( !bReturn )
DestMatrix.Destroy();
if( bReturn )
printf("Success to copy image!");
else
printf("Fail to copy image!");
return bReturn;
}
Remark
See Also
header to Include
origin.h
|