⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uglgc.c

📁 cpc-1631的BSP包for VxWorks操作系统
💻 C
📖 第 1 页 / 共 3 页
字号:

    devId = gc->pDriver;

    uglOSLock (devId->lockId);

    if ((gc->magicNumber & 0x7FFFFFFF) == (devId->magicNumber & 0x7FFFFFFF))
        {
        UGL_GC_SET (devId, devId->defaultGc);
        }

    uglOSLockDelete (gc->lockId);

    status = (*devId->gcDestroy) (devId, gc);

    uglOSUnlock (devId->lockId);

    return (status);
    }


/***************************************************************************
*
* uglLineStyleGet - gets a graphics context's line style
*
* This routine returns the current settings of the line style in the 
* graphics context <gc> to the calling routine. The information is 
* stored in the parameter <pLineStyle>.
*
* RETURNS: UGL_STATUS_OK, or UGL_STATUS_ERROR if the <gc> is null.
*
* ERRNO: N/A
*
* SEE ALSO: uglLineStyleSet()
*
*/

UGL_STATUS uglLineStyleGet
    (
    UGL_GC_ID gc,		/* graphics context */
    UGL_LINE_STYLE *pLineStyle  /* line style setting */
    )
    {

    if (UGL_NULL == gc)
        return (UGL_STATUS_ERROR);

    *pLineStyle = gc->lineStyle;

    return (UGL_STATUS_OK);
    }


/***************************************************************************
*
* uglLineStyleSet - sets a graphics context's line style
*
* This routine sets the line style of the graphics context specified by <gc>
* to the line style specified by <lineStyle>. The parameter <lineStyle> 
* identifies a 32 bit pattern that is repeated when a line is drawn.  A bit
* set to a one causes the line to be displayed and a value of 0 causes the
* line not to be displayed.  Thus, a value of 0xffffffff will cause a solid
* line to be drawn.  The following predefined values are available:
*
*\is
*\i UGL_LINE_STYLE_SOLID         
*   Solid lines are drawn
*\i UGL_LINE_STYLE_SIMPLE_DASH
*   Dashed lines are drawn
*\ie
*
* RETURNS: UGL_STATUS_OK, or UGL_STATUS_ERROR if the <gc> is null.
*
* ERRNO: N/A
*
* SEE ALSO: uglLineStyleGet()
*/

UGL_STATUS uglLineStyleSet
    (
    UGL_GC_ID gc,		/* graphics context */
    UGL_LINE_STYLE lineStyle	/* new line style */
    )
    {

    if (UGL_NULL == gc)
        return (UGL_STATUS_ERROR);

    uglOSLock(gc->lockId);
    
    if (gc->lineStyle != lineStyle)
        {
        gc->lineStyle = lineStyle;
        gc->changed |= UGL_GC_LINE_STYLE_CHANGED;
        UGL_GC_CHANGED_SET(gc);
        }

    uglOSUnlock (gc->lockId);

    return (UGL_STATUS_OK);
    }


/***************************************************************************
*
* uglLineWidthGet - get a graphics context's line width setting
*
* This routine returns the current settings of the line width (in pixels) 
* in the graphics context <gc> to the calling routine. The information is 
* stored in the parameter <pLineWidth>.
*
* RETURNS: UGL_STATUS_OK, or UGL_STATUS_ERROR if the <gc> is null.
*
* ERRNO: N/A
*
* SEE ALSO: uglLineWidthSet()
*
*/

UGL_STATUS uglLineWidthGet
    (
    UGL_GC_ID gc,		/* graphics context */
    UGL_SIZE *pLineWidth	/* line width setting */
    )
    {

    if (UGL_NULL == gc)
        return (UGL_STATUS_ERROR);

    *pLineWidth = gc->lineWidth;

    return (UGL_STATUS_OK);
    }


/***************************************************************************
*
* uglLineWidthSet - sets a graphics context's line width
*
* This routine sets the line width (in pixels) of graphics context <gc> to 
* the value specified by the parameter <lineWidth>.
*
* RETURNS: UGL_STATUS_OK, or UGL_STATUS_ERROR if the <gc> is null.
*
* ERRNO: N/A
*
* SEE ALSO: uglLineWidthGet()
*/

UGL_STATUS uglLineWidthSet
    (
    UGL_GC_ID gc,	/* graphics context */
    int lineWidth	/* new line width */
    )
    {

    if (UGL_NULL == gc)
        return (UGL_STATUS_ERROR);

    uglOSLock(gc->lockId);

    if (gc->lineWidth != lineWidth)
        {
        gc->lineWidth = lineWidth;
        gc->changed |= UGL_GC_LINE_WIDTH_CHANGED;
        UGL_GC_CHANGED_SET(gc);
        }

    uglOSUnlock (gc->lockId);

    return (UGL_STATUS_OK);
    }


/***************************************************************************
*
* uglRasterModeGet - gets a graphics context's raster mode setting
*
* This routine obtains the current raster operation that is being used 
* performing graphic drawing operations.  The raster operation is written
* to <pRasterOp> and may be any one of the following:
*
*\is
*\i UGL_RASTER_OP_COPY
*\i UGL_RASTER_OP_AND
*\i UGL_RASTER_OP_OR
*\i UGL_RASTER_OP_XOR
*\ie
*
* In addition, the following raster operations are defined on alpha channel
* capable systems:
*
*\is
*\i UGL_RASTER_OP_COPY_RGB_ONLY
*\i UGL_RASTER_OP_COPY_ALPHA_ONLY
*\i UGL_RASTER_OP_ALPHA_KEY_FROM_SOURCE
*\ie
*
* For additional information on these operations, see 'uglRasterModeSet()'.
*
* RETURNS: UGL_STATUS_OK, or UGL_STATUS_ERROR if the <gc> is null.
*
* ERRNO: N/A
*
* SEE ALSO: uglRasterOpSet()
*
*/

UGL_STATUS uglRasterModeGet
    (
    UGL_GC_ID gc,		/* graphics context */
    UGL_RASTER_OP * pRasterOp	/* raseter mode setting */
    )
    {

    if (UGL_NULL == gc)
        return (UGL_STATUS_ERROR);

    *pRasterOp = gc->rasterOp;

    return (UGL_STATUS_OK);
    }


/***************************************************************************
*
* uglRasterModeSet - sets a graphics context's raster mode
*
* This routine sets the raster operation for the specified graphics 
* context <gc>.  <rasterOp> may be one of the following:
*
*\ts
* Value               |   Operation Performed
* UGL_RASTER_OP_COPY  |Replace affected portions of the destination or 
*                     |target bitmap with new data.
* UGL_RASTER_OP_AND   |Combine affected portions of the destination or
*                     |target bitmap by ANDing the current contents with
*                     |new data.
* UGL_RASTER_OP_OR    |Combine affected portions of the destination or
*                     |target bitmap by ORing the current contents with
*                     |new data
* UGL_RASTER_OP_XOR   |Combine affected portions of the destination or
*                     |target bitmap by performing exclusive-OR between
*                     |the current contents and new data.
*\te
*
* If alpha channel support is provided by the driver, the following 
* operations may also be specified:
*
*\ts
* Value                               |   Operation Performed
* ------------------------------------|----------------------
* UGL_RASTER_OP_COPY_RGB_ONLY         |Copy only color information
* UGL_RASTER_OP_COPY_ALPHA_ONLY       |Copy only alpha channel information
* UGL_RASTER_OP_ALPHA_KEY_FROM_SOURCE |Mix source and destination colors 
*\te
*
* RETURNS: UGL_STATUS_OK, or UGL_STATUS_ERROR if the <gc> is null.
*
* ERRNO: N/A
*
* SEE ALSO: uglRasterModeGet()
*/

UGL_STATUS uglRasterModeSet
    (
    UGL_GC_ID gc,		/* graphics context */
    UGL_RASTER_OP rasterOp	/* new raster mode setting */
    )
    {

    if (UGL_NULL == gc)
        return (UGL_STATUS_ERROR);

    uglOSLock(gc->lockId);

    if (gc->rasterOp != rasterOp)
        {
        gc->rasterOp = rasterOp;
        gc->changed |= UGL_GC_RASTER_OP_CHANGED;
        UGL_GC_CHANGED_SET(gc);
        }

    uglOSUnlock (gc->lockId);

    return (UGL_STATUS_OK);
    }
    

/***************************************************************************
*
* uglViewPortGet - gets a graphics context's view port
*
* This routine returns the current view port settings of the view port for 
* the specified graphics context <gc>.  The setting for the view port is 
* 'left-top' relative and is written to the parameters <pLeft>, <pTop>, 
* <pRight>, and <pBottom>.
*
* RETURNS: UGL_STATUS_OK, or UGL_STATUS_ERROR if the <gc> is null.
*
* ERRNO: N/A
*
* SEE ALSO: uglViewPortSet()
*
*/

UGL_STATUS uglViewPortGet
    (
    UGL_GC_ID gc, 	/* graphics context */
    UGL_POS * pLeft, 	/* left boundary of gc's view port */
    UGL_POS * pTop,	/* top boundary of gc's view port */
    UGL_POS * pRight, 	/* right boundary of gc's view port */
    UGL_POS * pBottom	/* bottom boundary of gc's view port */
    )
    {

    if (UGL_NULL == gc)
        return (UGL_STATUS_ERROR);

    uglOSLock(gc->lockId);

    *pLeft = gc->viewPort.left;
    *pTop = gc->viewPort.top;
    *pRight = gc->viewPort.right;
    *pBottom = gc->viewPort.bottom;

    uglOSUnlock(gc->lockId);

    return (UGL_STATUS_OK);
    }


/****************************************************************************
*
* uglViewPortSet - sets a graphics context's view port
*
* This routine sets the viewport of graphics context <gc> to the rectangle 
* bounded by <left>, <top>, <right>, and <bottom>. All rendering operations 
* are clipped to the viewport and performed relative to the top-left 
* coordinate of the viewport.
*
* RETURNS: UGL_STATUS_OK, or UGL_STATUS_ERROR if the <gc> is null.
*
* ERRNO: N/A
*
* SEE ALSO: uglViewPortGet()
*/

UGL_STATUS uglViewPortSet
    (
    UGL_GC_ID gc, 	/* graphics context */                      
    UGL_POS left,       /* left boundary of view port */   
    UGL_POS top,        /* top boundary of view port */    
    UGL_POS right,      /* right boundary of view port */  
    UGL_POS bottom      /* bottom boundary of view port */ 
    )
    {

    if (UGL_NULL == gc)
        return (UGL_STATUS_ERROR);

    uglOSLock(gc->lockId);
    
    if (gc->viewPort.left != left || gc->viewPort.top != top ||
        gc->viewPort.right != right || gc->viewPort.bottom != bottom)
        {
        gc->viewPort.left = left;
        gc->viewPort.top = top;
        gc->viewPort.right = right;
        gc->viewPort.bottom = bottom;

        gc->changed |= UGL_GC_VIEW_PORT_CHANGED;
        UGL_GC_CHANGED_SET(gc);
        }

    /* Reset the clipping rectangle to the new viewport bounds */
    uglClipRectSet(gc, 0, 0, gc->viewPort.right - gc->viewPort.left,
		       gc->viewPort.bottom - gc->viewPort.top);

    uglOSUnlock (gc->lockId);

    return (UGL_STATUS_OK);
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -