Idea
The initial idea for the movitz graphics API is to have something similar in design to the SDL API. All drawing is done to surfaces, which are regions in memory (either system or video, depending on the backend driver). Surfaces can then be blitted to the screen (also a surface) possibly with hardware acceleration (again, due to driver). By using this surface approach, hardware effects should be able to be performed on the surfaces in the future should this be required (think OSX window effects).
Proposed API
This API list is incomplete. Any suggestions can be either added directly or placed in the feature requests section below.
Surface Functions
- Create
- Destroy
- Copy (creates a new surface with the contents of an existing surface)
Drawing Primitives
- Pixel
- Polyline (accepts a list of (x y) pairs)
- Rectangle (may be filled)
- Oval / Circle (may be filled)
Feature Requests
For games:
- I think the next big step would be to add bitmaps and be able to blit them to the screen. Transparent pixels are, naturally, required. A full alpha channel would be super cool.
- clearing rectangular regions
- Printing text to the screen. Perhaps not to the screen, but at least to an internal buffer that can be blitted to the screen.
As mentioned on the mailing list, an approach that mimics SDL would be great.
- What are peoples thoughts on keeping surfaces at 32 bits (8r8g8b8alpha)?
Backend Video Drivers
The graphics API will pass down requests to the current video driver that is in use. This way, each driver can accelerate functions if the hardware supports it.
Current Drivers:
- VgaDriver Generic VGA driver