/* This is the last event from this device. */ static int display_close(void *handle, void *device) { IMAGE *img = image_find(handle, device); if (img == NULL) return -1; gsdll_poll(handle); /* remove from list */ if (img == first_image) first_image = img->next; else { IMAGE *tmp; for (tmp = first_image; tmp!=0; tmp=tmp->next) { if (img == tmp->next) tmp->next = img->next; } } DisposePixMap(img->pixmapHdl); // need to go in doCloseWindow() DisposeWindow(img->windowRef); free(img); return 0; }
static void FreePixmap(void) { if (stPixMap != nil) { DisposePixMap(stPixMap); stPixMap = nil; } if (stColorTable != nil) { //JMM disposepixmap does this DisposeHandle((void *) stColorTable); stColorTable = nil; } }
void CALLBACK Dialog_onTimer(HWND wnd, UINT msg, UINT_PTR timerId, DWORD time) { #endif // WIN_ENV #ifdef MAC_ENV void Dialog_onTimer(EventLoopTimerRef timerId, void* data) { #endif // MAC_ENV // Establish an application context for undoing. AppContext context; JNIEnv *env = gEngine->getEnv(); try { if (gEngine->callStaticBooleanMethod(env, gEngine->cls_ai_Timer, gEngine->mid_ai_Timer_onExecute, (jint) timerId)) { // If onExecute returns true, we are asked to redraw the current // document. We can call RedrawDocument() even if there is no // document, in which case it will just bail out. #if defined(MAC_ENV) && kPluginInterfaceVersion < kAI15 // Unfortunately, calling Redraw on Mac CS4 and below lets the mouse // cursor flicker a lot. So backup the cursor and restore it again // after, in a rather complicated procedure that still leads to some // flicker... // Use a sort of double bufferning teqnique of two alternating named // pixmap cursors, to avoid flicker even more... static int cursorVersion = 0; static const char *cursorNames[] = { "Scriptographer Cursor 1", "Scriptographer Cursor 2" }; const char *name = cursorNames[cursorVersion]; cursorVersion = !cursorVersion; PixMapHandle data; Point point; QDGetCursorData(true, &data, &point); QDUnregisterNamedPixMapCursor(name); QDRegisterNamedPixMapCursor(data, NULL, point, name); DisposePtr((**data).baseAddr); DisposePixMap(data); sAIDocument->RedrawDocument(); QDSetNamedPixMapCursor(name); #else // !MAC_ENV || kPluginInterfaceVersion >= kAI15 sAIDocument->RedrawDocument(); #endif // !MAC_ENV || kPluginInterfaceVersion >= kAI15 } } EXCEPTION_CATCH_REPORT(env); }
/* New pointer to raster returned in pimage */ static int display_size(void *handle, void *device, int width, int height, int raster, unsigned int format, unsigned char *pimage) { PixMapPtr pixmap; IMAGE *img = image_find(handle, device); if (img == NULL) return -1; /* Check that image is within allowable bounds */ if (raster > 0x3fff) { printf("QuickDraw can't cope with an image this big.\n"); fflush(stdout); if (img->pixmapHdl) { DisposePixMap(img->pixmapHdl); img->pixmapHdl = NULL; } return e_rangecheck; } /* Create the PixMap */ if (!img->pixmapHdl) img->pixmapHdl = NewPixMap(); pixmap = *(img->pixmapHdl); pixmap->baseAddr = (char*)pimage; pixmap->rowBytes = (((SInt16)raster) & 0x3fff) | 0x8000; pixmap->bounds.right = width; pixmap->bounds.bottom = height; pixmap->packType = 0; pixmap->packSize = 0; pixmap->pixelType = RGBDirect; pixmap->pixelSize = 32; pixmap->cmpCount = 3; pixmap->cmpSize = 8; /* Update the display window */ window_adjust_scrollbars(img->windowRef); window_invalidate(img->windowRef); return gsdll_poll(handle); }