Set the currently active draw context
PhDrawContext_t *PhDCSetCurrent( void *draw_context );
This function makes the provided draw_context active. Calling this function with NULL makes the default draw context active. The default draw context emits draws to graphics drivers via Photon.
A draw context is anything that defines the flow of the draw stream. Print Contexts and Memory contexts are types of draw contexts - it may help to think of them as specialized subclasses of the draw context.
Contexts that may be set using this function:
The old draw context, or NULL if the new context can't be made current (active), in which case errno has specifics of the error.
In the following example, the print context pc is made active by calling PpPrintStart(). PpPrintStart() returns the context that the print context is replacing. The returned context is stored to enable us to restore the context that was active at the time we decided to start printing.
PhDrawContext_t *dc; PpPrintContext_t *pc; PmMemoryContext_t *mc; ... if( ( dc = PpPrintStart( pc ) ) == -1 ) { perror( "unable to activate print context" ); } else{ // do print stuff // Then restore context which was active before we // started printing. This is equivalent to doing // a PpPrintStop() followed by a PmMemStart(), or // PpPrintStart(), depending on what type of draw // context was active previously. PhDCSetCurrent( dc ); }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PhDCGetCurrent(), PmMemCreateMC(), PpPrintCreatePC(), PpPrintStart()