Hello,
I am trying to load a bitmap stored in a folder on the user partition to VC4. There may be a translation error in the help documentation for VA_LoadBitmap and VA_BlitBitmap because it says to use a pointer to a pointer of sVCBitmap. GUID fd1fd7c6-37db-46e9-8a47-2088277e8919
Notes:
The bitmap is stored on F:/Barcode/ and has the name Camera1.png. This image gets updated via FTP so it will need to be reloaded as needed.
When I set LoadBitmap to TRUE, i get an updated stVCBitmap1.vpInternalData. The other parts of the structure do not get updated. When setting ShowBitmap to TRUE, nothing happens on the HMI.
(Vars)
VAR CONSTANT
VISUALIZATION_NAME : STRING[80] := ‘FT50’;
DEV_BARCODE : STRING[16] := ‘Barcode’;//Assigned device in CPU config F:\Barcode
END_VAR
VAR
TestLoadBitmap : BOOL := 0;
strBitmap1 : STRING[80] := ‘’;
strBitmap1Path : STRING[80] := ‘’;
pBitmap : REFERENCE TO sVCBitmap;
stVCBitmap1 : {REDUND_UNREPLICABLE} sVCBitmap;
status_VA_LoadBitmap : UINT := 0;
TestShowBitmap : BOOL := 0;
status_VA_BlitBitmap : UINT := 0;
LoadBitmap : BOOL := 0;
ShowBitmap : BOOL := 0;
uiStatusAccess : UINT := 0;
uiStep : INT := 0;
uiStatus : UINT := 0;
END_VAR
IF (VC_HANDLE = 0) THEN
VC_HANDLE := VA_Setup(1, VISUALIZATION_NAME);
END_IF
IF (VC_HANDLE <> 0) THEN
uiStatusAccess := VA_Saccess(1, VC_HANDLE);
IF (uiStatusAccess = 0) THEN
CASE uiStep OF
0: (* Wait State*)
IF LoadBitmap THEN
LoadBitmap := FALSE;
strBitmap1 := 'Camera1.png';
strBitmap1Path := 'Barcode/Camera1.png';
stVCBitmap1.vpInternalData := 0;//Need to initialize to zero when loading
//stVCBitmap1.vpData :=
uiStep := 1;
ELSIF ShowBitmap THEN
ShowBitmap := FALSE;
uiStep := 2;
END_IF
1://Load bitmap
//uiStatus := VA_LoadBitmap(1,VC_HANDLE,DEV_BARCODE,strBitmap1,ADR(pBitmap ));
uiStatus := VA_LoadBitmap(enable := 1,VCHandle := VC_HANDLE,ucDevice := DEV_BARCODE,ucPath := strBitmap1,ppBitmap := ADR(stVCBitmap1));
IF (uiStatus = 0) THEN
uiStep := 0;
ELSIF (uiStatus = 7000) THEN
(*Busy*)
ELSE(*Go to Error Step*)
uiStep := 10;
END_IF
2://Blit bitmap (show on HMI)
//uiStatus := VA_BlitBitmap(1,VC_HANDLE,ADR(pBitmap), 100, 100, 0,0,0,0,0);
uiStatus := VA_BlitBitmap(1,VC_HANDLE,ADR(stVCBitmap1), 100, 100,0,0,0,0,0);
IF (uiStatus = 0) THEN
uiStep := 0;
ELSIF (uiStatus = 7000) THEN
(*Busy*)
ELSE(*Go to Error Step*)
uiStep := 10;
END_IF
END_CASE
VA_Srelease(1, VC_HANDLE);
END_IF
END_IF