23.11.2012 Views

2 Visual Components Manuals

2 Visual Components Manuals

2 Visual Components Manuals

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Introduction to <strong>Visual</strong> <strong>Components</strong> 2.3<br />

x1 = 150;<br />

y1 = 100;<br />

x2 = 100;<br />

y2 = 150;<br />

dx = 10;<br />

dy = 10;<br />

if (!ready)<br />

{<br />

VC_HANDLE = VA_Setup(1 "vga"); ,<br />

if (VC_HANDLE)<br />

ready = 1;<br />

}<br />

if (ready)<br />

{<br />

if (!VA_Saccess(1,VC_HANDLE))<br />

{<br />

VA_CopyScreenRect width,heighty2,dx,dy);<br />

(1,VC_HANDLE,x1,y1,<br />

VA_Srelease(1,VC_HANDLE);<br />

}<br />

}<br />

}<br />

3.3.8.2 Displaying a Bitmap − VA_DrawBitmap<br />

The VA_DrawBitmap function draws a bitmap at the specified coordinates on the screen. This bitmap must exist<br />

and be used in the project.<br />

Note:<br />

This function is only available on VGA displays.<br />

3.3.8.2.1 Parameter<br />

I/O Parameter Type Meaning<br />

IN enable BOOL This function is only executed if enable is TRUE.<br />

IN VCHandle UDINT The handle returned by VA_Setup.<br />

IN index UINT Bitmap index in the project (must be used in the project).<br />

IN x UINT X coordinate of the upper left corner of the bitmap.<br />

IN y UINT Y coordinate of the upper left corner of the bitmap.<br />

OUT Return Value UINT Not equal to 0 if error occurs<br />

3.3.8.2.2 Example for Automation Basic<br />

(* cyclic program *)<br />

x = 100<br />

y = 150<br />

index = 1<br />

if ready 1 then<br />

VC_HANDLE = VA_Setup(1 "vga") ,<br />

if VC_HANDLE 0 then<br />

ready = 1<br />

endif<br />

endif<br />

if ready = 1 then<br />

if VA_Saccess(1,VC_HANDLE)= 0 then<br />

VA_DrawBitmap (1,VC_HANDLE,index,x,y)<br />

VA_Srelease(1,VC_HANDLE)<br />

endif<br />

endif<br />

3.3.8.2.3 Example for C Programming<br />

#include <br />

#include <br />

#include <br />

3.3.8.2 Displaying a Bitmap − VA_DrawBitmap 137

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!