static void ws_open_colourmap(ColourMap cm) { if ( !getExistingPaletteColourMap(cm) && notNil(cm->colours) ) { int size = valInt(cm->colours->size); LOGPALETTE *lp = pceMalloc(offset(LOGPALETTE, palPalEntry[size])); PALETTEENTRY *pe = &lp->palPalEntry[0]; HPALETTE hpal; int n, nc = 0; DisplayObj d = CurrentDisplay(NIL); for(n=0; n<size; n++) { Colour c = cm->colours->elements[n]; if ( isName(c) && (c = checkType(c, TypeColour, NIL)) ) elementVector(cm->colours, toInt(n+1), c); if ( instanceOfObject(c, ClassColour) ) { if ( c->kind == NAME_named ) ws_create_colour(c, d); pe->peRed = valInt(c->red) >> 8; pe->peGreen = valInt(c->green) >> 8; pe->peBlue = valInt(c->blue) >> 8; pe->peFlags = 0; pe++; nc++; } else Cprintf("%s is not a colour\n", pp(c)); }
static HashTable LoadColourNames() { if ( !ColourNames ) { xcolourdef *cd; ColourNames = globalObject(NAME_colourNames, ClassHashTable, EAV); for(cd = x11_colours; cd->name; cd++) { COLORREF rgb = RGB(cd->red, cd->green, cd->blue); char buf[100]; const char *s = cd->name; char *q = buf; for( ; *s; s++ ) { if ( *s == ' ' ) *q++ = '_'; else *q++ = tolower(*s); } *q = '\0'; appendHashTable(ColourNames, CtoKeyword(buf), toInt(rgb)); } ws_system_colours(CurrentDisplay(NIL)); } return ColourNames; }
static Display * defaultXDisplay() { DisplayObj d = CurrentDisplay(NIL); DisplayWsXref r; openDisplay(d); r = d->ws_ref; return r->display_xref; }
void ws_uncreate_colour(Colour c, DisplayObj d) { if ( isDefault(d) ) d = CurrentDisplay(NIL); if ( instanceOfObject(d->colour_map, ClassColourMap) && d->colour_map->read_only == OFF ) ws_unalloc_colour(d->colour_map, c); unregisterXrefObject(c, d); }
int ws_provide_selection(int format) { DisplayObj d = CurrentDisplay(NIL); Hyper h; Function msg; Name which = NAME_primary; Name hypername = getAppendName(which, NAME_selectionOwner); Name type; if ( d && notNil(d) && (h = getFindHyperObject(d, hypername, DEFAULT)) && (type = getAttributeObject(h, NAME_type)) && (msg = getAttributeObject(h, NAME_convertFunction)) && (msg = checkType(msg, TypeFunction, NIL)) ) { Any val; DEBUG(NAME_selection, Cprintf("Provide %s selection of type %s\n", pp(which), pp(type))); if ( !(val = getForwardReceiverFunction(msg, h->to, which, type, EAV)) ) return FALSE; DEBUG(NAME_selection, Cprintf("Got %s\n", pp(val))); if ( type == NAME_text ) { CharArray ca = checkType(val, TypeCharArray, NIL); if ( ca ) { String s = &ca->data; HGLOBAL mem = ws_string_to_global_mem(s); if ( mem ) SetClipboardData(CF_UNICODETEXT, mem); return TRUE; } } else if ( type == NAME_emf || type == NAME_wmf ) { Any mf = checkType(val, nameToType(NAME_winMetafile), NIL); if ( mf ) { DEBUG(NAME_selection, Cprintf("Providing win_metafile\n")); return ws_on_clipboard_metafile(mf, type); } } else return errorPce(d, NAME_noSelectionType, type); } return FALSE; }
void DisplayOrderSvc( decoder_context* pdecoder_context, DISPLAY_M* display_memory, int *x_size, int *y_size, int *Crop, int *img_to_display, MMO *Mmo) { int j; //The picture management is conditioned if the current layer is allocated if (Mmo -> MemoryAllocation){ //Just to avoid the AU parsing of players //Detect if we have waited enough decoded frame except for the first frame. if (0 == Mmo->num_free_poc_address){ int BestPos; POC_PARAMS *Frame; int dsiplayBaseLayerId = get_layer_id(pdecoder_context->dq_to_display,pdecoder_context->layer_id_table); Frame = FindBestFrame(Mmo, Mmo -> poc_params, &BestPos, MIN_POC); if (!Frame -> is_ghost){ //Try to know if we can release the memory address LAYER_MMO *LayerMmo = &Mmo -> LayerMMO [dsiplayBaseLayerId]; Mmo -> num_free_poc_address ++; CurrentDisplay(Mmo, LayerMmo, Frame -> Picture, display_memory); logStr("display pic poc:%d\tmemory:%x\n",Frame -> Picture -> poc,Frame -> Picture->picture_memory_y); log_flush(); printf("\t display :%d %d %d %d\n", Mmo -> LayerMMO [0] . num_decoded_frame, Frame -> Picture -> poc, Frame -> x_size, Frame -> y_size); *img_to_display = 1; *x_size = Frame -> x_size; *y_size = Frame -> y_size; *Crop = Frame -> Crop; for (j = BestPos; j < Mmo -> nb_img_display - Mmo -> num_free_poc_address + 1; j++){ memmove(&Mmo -> poc_params[j], &Mmo -> poc_params[j + 1], 1 * sizeof(POC_PARAMS)); } }else{ assert(0); } }else{ //Not ready yet *img_to_display = 0; } } }
void display_order (SPS *sps_id, LIST_MMO *Current_pic, DISPLAY_M* display_memory, int *x_size, int *y_size, int *Crop, int *img_to_display, MMO *mmo) { int j; //Store the current picture in the reordoring buffer StorePicture(&mmo -> poc_params[mmo -> nb_img_display - mmo -> num_free_poc_address], Current_pic, sps_id, 0); mmo -> num_free_poc_address --; mmo -> LayerMMO [0] . num_decoded_frame ++; //Display the first picture, and wait after for enough renderer if ( (mmo -> LayerMMO [0] . num_decoded_frame >= mmo -> nb_img_display) || (mmo -> LayerMMO [0] . num_decoded_frame == 1)){ int BestPos; //Find the best picture with the correct poc POC_PARAMS *Frame = FindBestFrame(mmo, mmo -> poc_params, &BestPos, MIN_POC); mmo -> num_free_poc_address ++; //Remove from short or long ref the current picture CurrentDisplay(mmo, &mmo -> LayerMMO[0], Frame -> Picture, display_memory); //printf("%d \n", Frame -> Picture -> poc); *img_to_display = 1; *x_size = Frame -> x_size; *y_size = Frame -> y_size; *Crop = Frame -> Crop; for (j = BestPos; j < mmo -> nb_img_display - mmo -> num_free_poc_address; j++){ memmove(&mmo -> poc_params[j], &mmo -> poc_params[j + 1], 1 * sizeof(POC_PARAMS)); } }else{ *img_to_display = 0; *x_size = (sps_id -> pic_width_in_mbs) << 4; *y_size = (sps_id -> pic_height_in_map_units) << 4; } }
status initialiseMonitor(Monitor m, Name name, Area a) { if ( isDefault(name) ) name = NIL; assign(m, name, name); assign(m, area, a); succeed; } static Monitor getConvertMonitor(Class class, Any value) { DisplayObj d = CurrentDisplay(NIL); if ( d ) { Chain ch = get(d, NAME_monitors, EAV); if ( ch && instanceOfObject(ch, ClassChain) ) { if ( isInteger(value) ) return getNth0Chain(ch, value); } else { Cell cell; for_cell(cell, ch) { Monitor m = cell->value; if ( m->name == value) return m;