/* close a given window */ static void done_surface( grPMSurface* surface ) { LOG(( "Os2PM: done_surface(%08lx)\n", (long)surface )); if ( surface->frame_window ) WinDestroyWindow( surface->frame_window ); WinReleasePS( surface->image_ps ); grDoneBitmap( &surface->image ); grDoneBitmap( &surface->root.bitmap ); }
void FTDemo_Display_Done( FTDemo_Display* display ) { if ( !display ) return; grDoneBitmap( display->bitmap ); grDoneSurface( display->surface ); grDoneDevices(); free( display ); }
/* close a given window */ static void done_surface( grArosSurface* surface ) { if (surface->win) CloseWindow(surface->win); grDoneBitmap(&surface->root.bitmap); }
grArosSurface* init_surface( grArosSurface* surface, grBitmap* bitmap ) { printf("init_surface: width = %d height = %d\n", bitmap->width, bitmap->rows); bitmap->width = (bitmap->width + 15) & ~15; surface->bpr = bitmap->width / 8; if (grNewBitmap(bitmap->mode, bitmap->grays, bitmap->width, bitmap->rows, bitmap)) return 0; surface->win = OpenWindowTags(0, WA_Left, 20, WA_Top, 20, WA_InnerWidth, bitmap->width, WA_InnerHeight, bitmap->rows, WA_AutoAdjust, TRUE, WA_Title, "Freetype demo", WA_CloseGadget, TRUE, WA_DepthGadget, TRUE, WA_Activate, TRUE, WA_IDCMP, IDCMP_VANILLAKEY | IDCMP_RAWKEY, TAG_DONE); if (!surface->win) { puts("Could not open window!"); grDoneBitmap(bitmap); return 0; } puts("Window opened."); surface->grays = ( bitmap->mode == gr_pixel_mode_gray && bitmap->grays >= 2 ); if (surface->grays) { WORD i; if (GetBitMapAttr(surface->win->RPort->BitMap, BMA_DEPTH <= 8)) { puts("Need hi/true color screen!"); CloseWindow(surface->win); grDoneBitmap(bitmap); return 0; } for(i = 0; i < bitmap->grays; i++) { LONG red, green, blue; red = green = blue = (bitmap->grays - i) * 255 / bitmap->grays; surface->cgfxcoltab[i] = (red << 16) | (green << 8) | blue; } } surface->root.bitmap = *bitmap; surface->root.done = (grDoneSurfaceFunc) done_surface; surface->root.refresh_rect = (grRefreshRectFunc) refresh_rectangle; surface->root.set_title = (grSetTitleFunc) set_title; surface->root.listen_event = (grListenEventFunc) listen_event; return surface; }