コード例 #1
0
ファイル: window.c プロジェクト: ABratovic/open-watcom-v2
void _world_ellipse(
/******************/

    int                 fill_type,
    int                 px1,
    int                 py1,
    int                 px2,
    int                 py2
) {
    HPEN                pen;
    HBRUSH              brush;

    get_obj_settings( fill_type, &pen, &brush );

    _wpi_ellipse( Win_dc, px1, py1, px2, py2 );

    if( fill_type == FILL_BORDER ) {
        rgn_ellipse_border( px1, py1, px2, py2 );
    } else {
        rgn_ellipse( px1, py1, px2, py2 );
    }

    del_obj_settings( fill_type, pen, brush );
}
コード例 #2
0
/*
 * OutlineRegion - displays the potential region (rectangle or ellipse)
 *                 on the draw area.
 */
void OutlineRegion( HWND hwnd, WPI_POINT *start_pt, WPI_POINT *end_pt,
                                        WPI_POINT *prev_pt, BOOL firsttime )
{
    WPI_POINT   topleft;
    WPI_POINT   bottomright;
    WPI_POINT   prevtl;                 // previous top left point
    WPI_POINT   prevbr;                 // previous bottom right point
    int         prevROP2;
    HBRUSH      hbrush;
    HBRUSH      holdbrush;
    HPEN        hwhitepen;
    HPEN        holdpen;
    int         temp;
    WPI_PRES    pres;

    CheckBounds( hwnd, start_pt );
    CheckBounds( hwnd, end_pt );
    CheckBounds( hwnd, prev_pt );
    _wpi_setpoint(&topleft, MAKELOGPTX(start_pt->x), MAKELOGPTY(start_pt->y));
    _wpi_setpoint(&bottomright, MAKELOGPTX(end_pt->x), MAKELOGPTY(end_pt->y));

    if (topleft.x > bottomright.x) {
        temp = (short)bottomright.x;
        bottomright.x = topleft.x + pointSize.x;
        topleft.x = temp;
    } else {
        bottomright.x += pointSize.x;
    }
    if (topleft.y > bottomright.y) {
        temp = (int)bottomright.y;
        bottomright.y = topleft.y + pointSize.y;
        topleft.y = temp;
    } else {
        bottomright.y += pointSize.y;
    }

    prevtl.x = MAKELOGPTX( start_pt->x );
    prevtl.y = MAKELOGPTY( start_pt->y );
    prevbr.x = MAKELOGPTX( prev_pt->x );
    prevbr.y = MAKELOGPTY( prev_pt->y );

    if (prevtl.x > prevbr.x) {
        temp = (int)prevbr.x;
        prevbr.x = prevtl.x + pointSize.x;
        prevtl.x = temp;
    } else {
        prevbr.x += pointSize.x;
    }

    if (prevtl.y > prevbr.y) {
        temp = (int)prevbr.y;
        prevbr.y = prevtl.y + pointSize.y;
        prevtl.y = temp;
    } else {
        prevbr.y += pointSize.y;
    }

    ++prevtl.x;
    ++prevtl.y;
    ++topleft.x;
    ++topleft.y;

    pres = _wpi_getpres( hwnd );
    _wpi_torgbmode( pres );
    prevROP2 = _wpi_setrop2( pres, R2_XORPEN );
    hbrush = _wpi_createsolidbrush( BLACK );
    hwhitepen = _wpi_createpen( PS_SOLID, 0, WHITE );

    holdbrush = _wpi_selectobject( pres, hbrush );
    holdpen = _wpi_selectobject( pres, hwhitepen );

    if (!firsttime) {
        if ((toolType == IMGED_CIRCLEO) || (toolType == IMGED_CIRCLEF)) {
            _wpi_ellipse( pres, prevtl.x, prevtl.y, prevbr.x, prevbr.y );
        } else {
            _wpi_rectangle( pres, prevtl.x, prevtl.y, prevbr.x, prevbr.y );
        }
    }

    if ((toolType == IMGED_CIRCLEO) || (toolType == IMGED_CIRCLEF)) {
        _wpi_ellipse( pres, topleft.x, topleft.y, bottomright.x, bottomright.y );
    } else {
        _wpi_rectangle( pres, topleft.x, topleft.y, bottomright.x, bottomright.y );
    }
    _wpi_selectobject( pres, holdpen );
    _wpi_selectobject( pres, holdbrush );

    _wpi_deleteobject( hwhitepen );
    _wpi_deleteobject( hbrush );
    _wpi_setrop2( pres, prevROP2 );
    _wpi_releasepres( hwnd, pres );
} /* OutlineRegion */
コード例 #3
0
/*
 * RegionXorAnd - Draws a filled or framed region (ellipse or rectangle) in
 *               the View window.
 */
void RegionXorAnd( COLORREF xorcolour, COLORREF andcolour, BOOL fFillRgn,
                                                WPI_RECT *r, BOOL is_rect )
{
    HBRUSH      oldbrush;
    HBRUSH      hbrush;
    HPEN        oldpen;
    HPEN        hpen;
    WPI_PRES    mempres;
    HDC         memdc;
    WPI_PRES    pres;
    HBITMAP     oldbitmap;
    int         left;
    int         top;
    int         right;
    int         bottom;

    pres = _wpi_getpres( HWND_DESKTOP );
    mempres = _wpi_createcompatiblepres( pres, Instance, &memdc );
    _wpi_releasepres( HWND_DESKTOP, pres );

    _wpi_torgbmode( mempres );

    hpen = _wpi_createpen( PS_SOLID, 0, xorcolour );
    oldpen = _wpi_selectobject( mempres, hpen );
    oldbitmap = _wpi_selectobject( mempres, activeImage->hxorbitmap );

    if ( fFillRgn ) {
        hbrush = _wpi_createsolidbrush( xorcolour );
    } else {
        hbrush = _wpi_createnullbrush();
    }

    oldbrush = _wpi_selectobject( mempres, hbrush );
    _wpi_getintrectvalues( *r, &left, &top, &right, &bottom );
    if (is_rect) {
        _wpi_rectangle( mempres, left, top, right, bottom );
    } else {
        _wpi_ellipse( mempres, left, top, right, bottom );
    }

    _wpi_selectobject( mempres, oldpen );
    _wpi_deletepen( hpen );
    _wpi_selectobject( mempres, oldbrush );
    _wpi_selectobject( mempres, oldbitmap );
    if (fFillRgn) {
        _wpi_deleteobject( hbrush );
    } else {
        _wpi_deletenullbrush( hbrush );
    }

    if( activeImage->imgtype == BITMAP_IMG ) {
        _wpi_deletecompatiblepres( mempres, memdc );
        return;
    }

    hpen = _wpi_createpen( PS_SOLID, 0, andcolour );
    oldpen = _wpi_selectobject( mempres, hpen );
    oldbitmap = _wpi_selectobject( mempres, activeImage->handbitmap );

    if ( fFillRgn ) {
        hbrush = _wpi_createsolidbrush( andcolour );
    } else {
        hbrush = _wpi_createnullbrush();
    }
    oldbrush = _wpi_selectobject( mempres, hbrush );

    if (is_rect) {
        _wpi_rectangle( mempres, left, top, right, bottom );
    } else {
        _wpi_ellipse( mempres, left, top, right, bottom );
    }
    _wpi_selectobject( mempres, oldpen );
    _wpi_deletepen( hpen );
    _wpi_selectobject( mempres, oldbrush );
    _wpi_selectobject( mempres, oldbitmap );
    if (fFillRgn) {
        _wpi_deleteobject( hbrush );
    } else {
        _wpi_deletenullbrush( hbrush );
    }

    _wpi_deletecompatiblepres( mempres, memdc );
} /* RegionXorAnd */