Blitz:Graphics

From Amiga Coding
Revision as of 10:31, 10 September 2015 by Daedalus (talk | contribs)
Jump to: navigation, search

Blitz Basic / AmiBlitz has strong support for the use of graphics in programs. There are extensive internal commands for using the Amiga's chipset directly, as well as standard OS calls for using graphics via the Amiga API. AmiBlitz also comes with various Include files which add many functions for handling graphics in a modern and system-friendly way.

General Graphics Concepts

Graphics on the Amiga

Built-in Commands

The built-in graphics commands are very easy to use, and are fast to execute too. They support the standard Blitz concept of objects which simplifies code, so you can reference objects like Bitmap 1 or Shape 17. Many of them access the Amiga custom chips directly however in order to achieve this speed and simplicity. This means that many of them can cause problems working on systems with a graphics card, and generally they won't work at all on non-classic systems such as AmigaOne and MorphOS machines. AmiBlitz will highlight such commands in red to alert you to potential problems, however Blitz Basic does not so if you're using Blitz 2.1, please be aware that your programs might have this limitation.

Amiga API

Using the Amiga API is the "correct", system-friendly way of displaying and manipulating graphics, and means that your code should work with any versions of AmigaOS or compatible. Care must be taken however to check for compatibility with the target version of the OS, as some calls were only added for certain versions and above. For example, some API calls were only introduced in OS 2.x and so software using these calls won't work on 1.x. Generally the OS releases are backwards compatible however, so if your software only uses 1.x API calls, it should still work on all versions since then.

The downsides of using the API are that it's a little bit slower than accessing the hardware directly on computers with the required custom chips, and that they generally refer to objects using pointers instead of simple object ID numbers.

Most graphics tasks are handled by the graphics.library API. Information on this API, including detailed descriptions of the functions and information regarding compatibility can be found in the graphics.library Autodocs.

AmiBlitz Includes

The Amiblitz Includes for handling graphics use the Amiga API calls and their own custom code to provide easy to use functions not dissimilar to the built-in Blitz commands, but in a system-friendly way. They also support full 24-bit colour, 32-bit colour+alpha and many useful manipulation functions. However, this does mean they're quite slow on