//***************************************************************************** // //! Sets the extents of the clipping region. //! //! \param psContext is a pointer to the drawing context to use. //! \param pRect is a pointer to the structure containing the extents of the //! clipping region. //! //! This function sets the extents of the clipping region. The clipping region //! is not allowed to exceed the extents of the screen, but may be a portion of //! the screen. //! //! The supplied coordinate are inclusive; \e i16XMin of 1 and \e i16XMax of 1 //! will define a clipping region that will display only the pixels in the //! X = 1 column. A consequence of this is that the clipping region must //! contain at least one row and one column. //! //! \return None. // //***************************************************************************** void GrContextClipRegionSet(tContext *psContext, tRectangle *pRect) { uint32_t ui32W, ui32H; // // Check the arguments. // ASSERT(psContext); ASSERT(pRect); // // Get the width and height of the display. // ui32W = DpyWidthGet(psContext->psDisplay); ui32H = DpyHeightGet(psContext->psDisplay); // // Set the extents of the clipping region, forcing them to reside within // the extents of the screen. // psContext->sClipRegion.i16XMin = ((pRect->i16XMin < 0) ? 0 : ((pRect->i16XMin >= ui32W) ? (ui32W - 1) : pRect->i16XMin)); psContext->sClipRegion.i16YMin = ((pRect->i16YMin < 0) ? 0 : ((pRect->i16YMin >= ui32H) ? (ui32H - 1) : pRect->i16YMin)); psContext->sClipRegion.i16XMax = ((pRect->i16XMax < 0) ? 0 : ((pRect->i16XMax >= ui32W) ? (ui32W - 1) : pRect->i16XMax)); psContext->sClipRegion.i16YMax = ((pRect->i16YMax < 0) ? 0 : ((pRect->i16YMax >= ui32H) ? (ui32H - 1) : pRect->i16YMax)); }
//***************************************************************************** // //! Sets the extents of the clipping region. //! //! \param pContext is a pointer to the drawing context to use. //! \param pRect is a pointer to the structure containing the extents of the //! clipping region. //! //! This function sets the extents of the clipping region. The clipping region //! is not allowed to exceed the extents of the screen, but may be a portion of //! the screen. //! //! The supplied coordinate are inclusive; \e sXMin of 1 and \e sXMax of 1 will //! define a clipping region that will display only the pixels in the X = 1 //! column. A consequence of this is that the clipping region must contain //! at least one row and one column. //! //! \return None. // //***************************************************************************** void GrContextClipRegionSet(tContext *pContext, tRectangle *pRect) { unsigned long ulW, ulH; // // Check the arguments. // ASSERT(pContext); ASSERT(pRect); // // Get the width and height of the display. // ulW = DpyWidthGet(pContext->pDisplay); ulH = DpyHeightGet(pContext->pDisplay); // // Set the extents of the clipping region, forcing them to reside within // the extents of the screen. // pContext->sClipRegion.sXMin = ((pRect->sXMin < 0) ? 0 : ((pRect->sXMin >= ulW) ? (ulW - 1) : pRect->sXMin)); pContext->sClipRegion.sYMin = ((pRect->sYMin < 0) ? 0 : ((pRect->sYMin >= ulH) ? (ulH - 1) : pRect->sYMin)); pContext->sClipRegion.sXMax = ((pRect->sXMax < 0) ? 0 : ((pRect->sXMax >= ulW) ? (ulW - 1) : pRect->sXMax)); pContext->sClipRegion.sYMax = ((pRect->sYMax < 0) ? 0 : ((pRect->sYMax >= ulH) ? (ulH - 1) : pRect->sYMax)); }