The Allegro Wiki is migrating to github at https://github.com/liballeg/allegro_wiki/wiki

Difference between revisions of "Graphics2"

From Allegro Wiki
Jump to: navigation, search
(twiki import)
(twiki import)
Line 11: Line 11:
 
AL_SURFACE *al_get_bitmap_surface(AL_BITMAP)
 
AL_SURFACE *al_get_bitmap_surface(AL_BITMAP)
  
al_select_surface(AL_SURFACE)
+
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)  
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.<br />al_update_rect(x, y, w, h)  
+
 
 +
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:
 
Example:

Revision as of 05:37, December 23, 2006

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();