コード例 #1
0
ファイル: ieutil.c プロジェクト: Azarien/open-watcom-v2
/*
 * OutlineRectangle - outline a rectangle with the XOR pen
 */
void OutlineRectangle( bool firsttime, WPI_PRES pres, WPI_RECT *prevrc, WPI_RECT *newrc )
{
    int         prevrop2;
    HBRUSH      holdbrush;
    HBRUSH      nullbrush;
    HPEN        holdpen;
    HPEN        whitepen;
    int         left, top, right, bottom;

    _wpi_torgbmode( pres );

    nullbrush = _wpi_createnullbrush();
    whitepen = _wpi_createpen( PS_SOLID, 0, WHITE );
    holdbrush = _wpi_selectobject( pres, nullbrush );
    holdpen = _wpi_selectobject( pres, whitepen );

    prevrop2 = _wpi_setrop2( pres, R2_XORPEN );
    if( !firsttime ) {
        _wpi_getintrectvalues( *prevrc, &left, &top, &right, &bottom );
        /*
         * In this case don't call _wpi_convertheight because of the
         * way the rectangle values are set in iedraw.c
         */
        _wpi_rectangle( pres, left, top, right, bottom );
    }

    _wpi_getintrectvalues( *newrc, &left, &top, &right, &bottom );
    _wpi_rectangle( pres, left, top, right, bottom );

    _wpi_selectobject( pres, holdbrush );
    _wpi_selectobject( pres, holdpen );
    _wpi_setrop2( pres, prevrop2 );
    _wpi_deleteobject( whitepen );
    _wpi_deletenullbrush( nullbrush );

} /* OutlineRectangle */
コード例 #2
0
ファイル: window.c プロジェクト: ABratovic/open-watcom-v2
void _winitwindow(
/****************/
/* this must be called once before using any of the other window functions */

    WPI_RECT            *area
) {
    int                 left, right, top, bottom;

    _wpi_getintrectvalues( *area, &left, &top, &right, &bottom );
    Width = right - left;
    Height = bottom - top;
    Win_x_start = left;
    Win_y_start = top;

#if 0
    /* if Windows 3.0 worked intelligently, the following code would
       also work. But 'GetDeviceCaps' for metafiles hangs! */
    if( GetDeviceCaps( Win_dc, TECHNOLOGY ) == DT_METAFILE ) {
        /* metafiles don't have arbitary coords... assume square pixels */
        Aspect_ratio = ( float ) Height / (float) Width;
    } else {
        Aspect_ratio = ((float)Height / GetDeviceCaps( Win_dc, LOGPIXELSY ) ) /
                    ( (float)Width / GetDeviceCaps( Win_dc, LOGPIXELSX ) );
    }
#else
    if( Is_metafile ) {
        /* BIG assumption with metafiles: use LAST real device's Aspect
           ratio and logical information */
    } else {
        Log_x = _wpi_devicecapableinch( Win_dc, LOGPIXELSX );
        Log_y = _wpi_devicecapableinch( Win_dc, LOGPIXELSY );
        Aspect_ratio = ((float)Height / Log_y) / ((float)Width / Log_x);
        Pixel_aspect_ratio = (float)Log_y / (float)Log_x;
    }
#endif
}
コード例 #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 */