The Allegro Wiki is migrating to github at https://github.com/liballeg/allegro_wiki/wiki
Difference between revisions of "Graphics2"
From Allegro Wiki
Awikiadmin (talk | contribs) (twiki import) |
m |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | Proposed changes to the original graphics API proposal: | + | =Proposed changes to the original graphics API proposal:= |
− | + | * Implicit surface parameter for the current "render target" | |
− | * | + | * Renamed AL_BITMAP to AL_SURFACE |
− | * | ||
AL_DISPLAY *al_create_display(...) | AL_DISPLAY *al_create_display(...) | ||
AL_EVENT_SOURCE *al_get_display_event_source(AL_DISPLAY) | AL_EVENT_SOURCE *al_get_display_event_source(AL_DISPLAY) | ||
− | AL_SURFACE * | + | |
+ | AL_SURFACE *al_get_display_surface(AL_DISPAY) | ||
AL_SURFACE *al_get_bitmap_surface(AL_BITMAP) | AL_SURFACE *al_get_bitmap_surface(AL_BITMAP) | ||
− | |||
− | + | al_select_surface(AL_SURFACE *surface) | |
AL_BITMAP *al_create_bitmap(...) | AL_BITMAP *al_create_bitmap(...) | ||
− | al_line(int x, y, w, h, color) | + | void al_line(int x, y, w, h, color) |
− | al_blit(AL_BITMAP *bitmap, int x, int y) | + | |
+ | void al_blit(AL_BITMAP *bitmap, int x, int y) | ||
+ | |||
+ | void al_update() - on a display surface, does things like page flipping. else could do things like finalize an [[OpenGL|OpenGL]] context, or upload a modified texture. On a memory bitmap, a no-op. | ||
+ | |||
+ | void al_update_rect(int x, y, w, h, color) | ||
+ | |||
+ | Example: | ||
+ | <pre> | ||
+ | AL_DISPLAY *display = al_create_display(640, 480, 0, 0, 0); | ||
+ | AL_SURFACE *display_surface = al_get_display_surface(display) | ||
+ | al_select_surface(surface) | ||
+ | al_line(0, 0, 100, 100, RED); | ||
+ | |||
+ | AL_BITMAP *bitmap = al_create_bitmap(100, 100, 0, 0, 0); | ||
+ | |||
+ | AL_SURFACE *bitmap_surface = al_get_bitmap_surface(bitmap) | ||
+ | al_select_surface(bitmap_surface); | ||
+ | |||
+ | al_line(0, 0, 100, 100, BLUE); | ||
+ | |||
+ | al_select_surface(display_surface); | ||
+ | |||
+ | al_blit(bitmap, 50, 50); | ||
+ | |||
+ | al_refresh(); | ||
+ | </pre> | ||
+ | [[Category:New API]] |
Latest revision as of 06:13, January 26, 2007
Proposed changes to the original graphics API proposal:
- Implicit surface parameter for the current "render target"
- Renamed AL_BITMAP to AL_SURFACE
AL_DISPLAY *al_create_display(...)
AL_EVENT_SOURCE *al_get_display_event_source(AL_DISPLAY)
AL_SURFACE *al_get_display_surface(AL_DISPAY)
AL_SURFACE *al_get_bitmap_surface(AL_BITMAP)
al_select_surface(AL_SURFACE *surface)
AL_BITMAP *al_create_bitmap(...)
void al_line(int x, y, w, h, color)
void al_blit(AL_BITMAP *bitmap, int x, int y)
void al_update() - on a display surface, does things like page flipping. else could do things like finalize an OpenGL context, or upload a modified texture. On a memory bitmap, a no-op.
void al_update_rect(int x, y, w, h, color)
Example:
AL_DISPLAY *display = al_create_display(640, 480, 0, 0, 0); AL_SURFACE *display_surface = al_get_display_surface(display) al_select_surface(surface) al_line(0, 0, 100, 100, RED); AL_BITMAP *bitmap = al_create_bitmap(100, 100, 0, 0, 0); AL_SURFACE *bitmap_surface = al_get_bitmap_surface(bitmap) al_select_surface(bitmap_surface); al_line(0, 0, 100, 100, BLUE); al_select_surface(display_surface); al_blit(bitmap, 50, 50); al_refresh();