/* ciitestcleanup.c * Copyright (C) 1993 by Xerox Corporation. All rights reserved. * Michael Plass, October 15, 1993 12:02 pm PDT */ #include "cii.h" #define NIL ((void*)0); #define CHK(x) {res=x; if (CII_RES_ok!=res) return(res);} typedef struct Bye_Data_Rep { CII_RectangleRep rect; float gray; } Bye_Data_Rep; /* Normally a cleanup routine would not do any actual imaging, but this is a convenient way to test out the cleanup feature. */ static CII_RES Bye(CII_CleanupObject self, CII_Handle h) { CII_RES res = CII_RES_ok; Bye_Data_Rep* data = self->data; CHK(CII_SetGray(h, &(data->gray))); CHK(CII_MaskRectangle(h, &(data->rect))); data->rect.x = data->rect.x+(data->rect.w/2.0); data->rect.y = data->rect.y+(data->rect.h/2.0); data->gray = (data->gray) * 0.8; return(res); } CII_CleanupObjectRep clean1, clean2; Bye_Data_Rep data1 = { { 60.0, 100.0, 30.0, 20.0 }, 0.9 }; Bye_Data_Rep data2 = { { 50.0, 114.0, 100.0, 3.0 }, 0.0 }; extern CII_RES register_ciitestcleanup(CII_Handle h) { CII_RES res = CII_RES_ok; clean1.data = &data1; clean1.Cleanup = Bye; CHK(CII_RegisterCleanupObject(h, &clean1)); clean2.data = &data2; clean2.Cleanup = Bye; CHK(CII_RegisterCleanupObject(h, &clean2)); CHK(CII_RegisterCleanupObject(h, &clean2)); CHK(CII_RegisterCleanupObject(h, &clean1)); CHK(CII_RegisterCleanupObject(h, &clean1)); CHK(CII_UnRegisterCleanupObject(h, &clean1)); CHK(CII_UnRegisterCleanupObject(h, &clean2)); return(res); } extern void run_ciiicecream(CII_Handle); void XR_run_ciitestcleanup() { CII_Handle h = (CII_Handle)CII_TestDevice(); register_ciitestcleanup(h); run_ciiicecream(h); CII_Destroy(h); }