CombineBitmapWarp example for Visual Basic
Dim RasterProc As New LEADRasterProcess
Dim RasterVarX As New LEADRasterVariant
Dim RasterVarY As New LEADRasterVariant
Dim lFlag As Long
Dim nRet As Integer
Dim uMasterBPP, uSlaveBPP As Integer
Dim nDithFlags, nPalFlags As Integer
Dim uBitsPerPixel As Integer
Dim strError As String
' Set the flag
lFlag = CBW_RESERVED8
If BilinearInterpolate.Value = 1 Then
lFlag = lFlag + CBW_BILINEAR
End If
' Get the polygon Annotation points
RasterAnn.AnnGetPointX hObject, RasterVarX
RasterAnn.AnnGetPointY hObject, RasterVarY
RasterProc.EnableMethodErrors = False
uMasterBPP = LEADMaster.Raster.BitmapBits
uSlaveBPP = LEADSlave.Raster.BitmapBits
If (uMasterBPP < 24) Or (uSlaveBPP < 24) Then
nPalFlags = CRP_FIXEDPALETTE + CRP_BYTEORDERBGR
nDithFlags = CRD_NODITHERING
If uMasterBPP > uSlaveBPP Then
uBitsPerPixel = uMasterBPP
Else
uBitsPerPixel = uSlaveBPP
End If
If uMasterBPP <> uBitsPerPixel Then
RasterProc.ColorRes LEADMaster.Raster, uBitsPerPixel, nPalFlags, nDithFlags, 0
End If
If uSlaveBPP <> uBitsPerPixel Then
RasterProc.ColorRes LEADSlave.Raster, uBitsPerPixel, nPalFlags, nDithFlags, 0
End If
End If
Screen.MousePointer = 11
' Combine the slave on the master
nRet = RasterProc.CombineBitmapWarp(LEADMaster.Raster, RasterVarX, RasterVarY, 4, LEADSlave.Raster, 0, 0, LEADSlave.Raster.BitmapWidth, LEADSlave.Raster.BitmapHeight, lFlag)
Screen.MousePointer = 0
If nRet <> 0 Then
strError = "One of the following caused the error: "
strError = strError + "1. Polygon must be concave "
strError = strError + "2. Polygon must lie completely on the master bitmap "
strError = strError + "3. The bits per pixel of the Master and Slave must be the same "
strError = strError + "4. Master or slave image not loaded"
MsgBox strError
End If
Set RasterProc = Nothing
LEADMaster.ForceRepaint