Пример #1
0
/*
 * LineXorAnd - draw the line on the XOR and the AND bitmaps
 */
void LineXorAnd( COLORREF xorcolor, COLORREF andcolor,
                 WPI_POINT *startpt, WPI_POINT *endpt )
{
    HPEN        oldpen;
    HPEN        hpen;
    HDC         memdc;
    WPI_PRES    pres;
    WPI_PRES    mempres;
    HBITMAP     oldbitmap;
    HDC         anddc;

    anddc = anddc;
    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, xorcolor );
    oldpen = _wpi_selectobject( mempres, hpen );
    oldbitmap = _wpi_selectobject( mempres, activeImage->hxorbitmap );

    _wpi_movetoex( mempres, startpt, NULL );
    _wpi_lineto( mempres, endpt );
    _wpi_setpixel( mempres, endpt->x, endpt->y, xorcolor );

    _wpi_selectobject( mempres, oldpen );
    _wpi_deleteobject( hpen );
    _wpi_selectobject( mempres, oldbitmap );

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

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

    _wpi_movetoex( mempres, startpt, NULL );
    _wpi_lineto( mempres, endpt );
    _wpi_setpixel( mempres, endpt->x, endpt->y, andcolor );

    _wpi_selectobject( mempres, oldpen );
    _wpi_deleteobject( hpen );
    _wpi_selectobject( mempres, oldbitmap );
    _wpi_deletecompatiblepres( mempres, anddc );

} /* LineXorAnd */
Пример #2
0
void _wline(
/**********/

    int                 px,
    int                 py,
    BOOL                fill_last,
    BOOL                rgn_on,
    BOOL                line_with_two_boxes
) {
    WPI_POINT           initial_pos;

    _wpi_getcurrpos( Win_dc, &initial_pos );

#if 0
    if( Save_style_on ) {
        wide_line_to_style( Win_dc, px, py, Set_wl_width, Set_wl_style,
                            Set_color, &Save_style, Set_end_marker );
    } else {
        wide_line_to( Win_dc, px, py, Set_wl_width, Set_wl_style, Set_color );
    }

    if( rgn_on ) {
        if( line_with_two_boxes ) {
            rgn_line_boxes( initial_pos.x, initial_pos.y, px, py );
        } else {
            rgn_line( initial_pos.x, initial_pos.y, px, py );
        }
    }
#else
    rgn_on = rgn_on;
    line_with_two_boxes = line_with_two_boxes;
    {
        WPI_POINT       pt;

        pt.x = px;
        pt.y = py;
        _wpi_lineto( Win_dc, &pt );
    }

#endif

#ifdef PLAT_WIN
    if( fill_last ) {
        _wpi_setpixel( Win_dc, px, py, Set_color );
    }
#else
    /* in OS/2, the last pixel is always filled. Don't need to do this
       crap. */
    fill_last = fill_last;
#endif
}