/* PsychDepthIsMember() Accepts two depth structs and returns true if the one depth held by the first struct is among the one or more depths within the second struct. */ boolean PsychIsMemberDepthStruct(PsychDepthType *depth, PsychDepthType *depthSet) { int numDepths, i; numDepths=PsychGetNumDepthsFromStruct(depth); if(numDepths>1) PsychErrorExitMsg(PsychError_internal, "depth structure contains multiple depths"); else if(numDepths==0) return(FALSE); for(i=0;i<PsychGetNumDepthsFromStruct(depthSet);i++){ if(PsychGetValueFromDepthStruct(i,depthSet) == PsychGetValueFromDepthStruct(0,depth)) return(TRUE); } return(FALSE); }
/* PsychDepthCopy() Accepts two depth structs which must both have been initialized and copies the contents of the second depth to the first. Copy is cumulative. */ void PsychCopyDepthStruct(PsychDepthType *toDepth, PsychDepthType *fromDepth) { int i; for(i=0;i<PsychGetNumDepthsFromStruct(fromDepth); i++) PsychAddValueToDepthStruct(PsychGetValueFromDepthStruct(i,fromDepth), toDepth); }
int PsychGetScreenDepthValue(int screenNumber) { PsychDepthType depthStruct; PsychInitDepthStruct(&depthStruct); PsychGetScreenDepth(screenNumber, &depthStruct); return(PsychGetValueFromDepthStruct(0,&depthStruct)); }
psych_bool PsychCopyOutDepthArg(int position, psych_bool required, PsychDepthType *depths) { double *depthsArray; int i; if(!PsychAllocOutDoubleMatArg(position, required, 1, PsychGetNumDepthsFromStruct(depths), 0, &depthsArray)) return(FALSE); //optional argument was omitted for(i=0;i<PsychGetNumDepthsFromStruct(depths);i++) depthsArray[i]=(double)PsychGetValueFromDepthStruct(i,depths); return(TRUE); }
/* PsychGetColorModeFromDepthStruct() Get ride of this color mode stuff and replace it with functions wich access the number of depth planes and the size of every plane. */ PsychColorModeType PsychGetColorModeFromDepthStruct(PsychDepthType *depth) { switch(PsychGetValueFromDepthStruct(0, depth)){ case 8: return(kPsychIndexColor); case 16: return(kPsychRGBColor); case 24: return(kPsychRGBColor); case 32: return(kPsychRGBAColor); default: return(kPsychUnknownColor); } }
int PsychGetWhiteValueFromDepthStruct(PsychDepthType *depth) { switch(PsychGetValueFromDepthStruct(0, depth)){ case 8: return(255); case 16: return(31); case 24: return(255); case 32: return(255); default: PsychErrorExitMsg(PsychError_internal, "Unrecognized screen depth value"); return(0); //makes the compiler happy } }