//*****************************************************************************
//
//! Draws a rectangle.
//!
//! \param context is a pointer to the drawing context to use.
//! \param rect is a pointer to the structure containing the extents of the
//! rectangle.
//!
//! This function draws a rectangle.  The rectangle will extend from \e xMin
//! to \e xMax and \e yMin to \e yMax, inclusive.
//!
//! \return None.
//
//*****************************************************************************
void Graphics_drawRectangle(const Graphics_Context *context,
		const Graphics_Rectangle *rect)
{
    //
    // Check the arguments.
    //
    assert(context);
    assert(rect);

    //
    // Draw a line across the top of the rectangle.
    //
    Graphics_drawLineH(context, rect->xMin, rect->xMax, rect->yMin);

    //
    // Return if the rectangle is one pixel tall.
    //
    if(rect->yMin == rect->yMax)
    {
        return;
    }

    //
    // Draw a line down the right side of the rectangle.
    //
    Graphics_drawLineV(context, rect->xMax, rect->yMin + 1, rect->yMax);

    //
    // Return if the rectangle is one pixel wide.
    //
    if(rect->xMin == rect->xMax)
    {
        return;
    }

    //
    // Draw a line across the bottom of the rectangle.
    //
    Graphics_drawLineH(context, rect->xMax - 1, rect->xMin, rect->yMax);

    //
    // Return if the rectangle is two pixels tall.
    //
    if((rect->yMin + 1) == rect->yMax)
    {
        return;
    }

    //
    // Draw a line up the left side of the rectangle.
    //
    Graphics_drawLineV(context, rect->xMin, rect->yMax - 1, rect->yMin + 1);
}
Esempio n. 2
0
	void drawLineV(int32_t x, int32_t y1, int32_t y2) {
		Graphics_drawLineV(this, x, y1, y2);
	}