Exemple #1
0
/*
 * CheckGridItem - Check the grid item and display the grid if necessary.
 *                 First we check if an item has been created or not, if not
 *                 we just check some flags so that when it is created, a
 *                 grid will (not) be displayed.
 */
void CheckGridItem( HMENU hmenu )
{
    WPI_ENUMPROC        fp_enum;
    HCURSOR             prevcursor;

    prevcursor = _wpi_setcursor( _wpi_getsyscursor(IDC_WAIT) );
    if ( _wpi_isitemchecked(hmenu, IMGED_GRID) ) {
        _wpi_checkmenuitem( hmenu, IMGED_GRID, MF_UNCHECKED, FALSE );
        ImgedConfigInfo.grid_on = FALSE;
        BlowupImage( NULL, NULL );
        PrintHintTextByID( WIE_GRIDTURNEDOFF, NULL );
    } else {
        _wpi_checkmenuitem( hmenu, IMGED_GRID, MF_CHECKED, FALSE );
        ImgedConfigInfo.grid_on = TRUE;
        BlowupImage( NULL, NULL );
        PrintHintTextByID( WIE_GRIDTURNEDON, NULL );
    }
    PressGridButton();

    if( DoImagesExist() ) {
        fp_enum = _wpi_makeenumprocinstance( GridEnumProc, Instance );
        _wpi_enumchildwindows( ClientWindow, fp_enum, 0L );
        _wpi_freeprocinstance( fp_enum );
    }
    _wpi_setcursor( prevcursor );
} /* CheckGridItem */
Exemple #2
0
/*
 * DrawLine - Draws a line on the drawing area.
 */
void DrawLine( HWND hwnd, WPI_POINT *start_pt, WPI_POINT *end_pt, int mousebutton )
{
    COLORREF    colour;
    COLORREF    dithered;
    WPI_POINT   imgstart_pt;
    WPI_POINT   imgend_pt;
    wie_clrtype type;
    img_node    *node;

    CheckBounds( hwnd, start_pt );
    CheckBounds( hwnd, end_pt );
    imgstart_pt.x = start_pt->x / pointSize.x;
    imgstart_pt.y = start_pt->y / pointSize.y;
    imgend_pt.x = end_pt->x / pointSize.x;
    imgend_pt.y = end_pt->y / pointSize.y;

    dithered = GetSelectedColour(mousebutton, &colour, &type);

    if (type == SCREEN_CLR) {
        LineXorAnd(BLACK, WHITE, &imgstart_pt, &imgend_pt);
    } else if (type == INVERSE_CLR) {
        LineXorAnd(WHITE, WHITE, &imgstart_pt, &imgend_pt);
    } else {
        LineXorAnd(colour, BLACK, &imgstart_pt, &imgend_pt);
    }
    node = SelectImage( hwnd );
    InvalidateRect(node->viewhwnd, NULL, FALSE);
    BlowupImage( hwnd, NULL );
} /* DrawLine */
Exemple #3
0
/*
 * ResetDrawArea - Resets the drawing area when a new image is selected from
 *                 the select icon menu option. (only for icon files).
 */
void ResetDrawArea( img_node *node )
{
    WPI_RECT    rcclient;
    WPI_RECT    rc;
    WPI_PARAM2  lparam;
    short       new_width;
    short       new_height;

    GetClientRect( node->hwnd, &rcclient );

    pointSize.x = max (1, _wpi_getwidthrect(rcclient) / node->width);
    pointSize.y = max (1, _wpi_getheightrect(rcclient) / node->height);

    if (ImgedConfigInfo.square_grid) {
        GetClientRect( ClientWindow, &rc );
        if (pointSize.y * node->height > _wpi_getheightrect(rc) ) {
            pointSize.y = pointSize.x;
        } else {
            pointSize.x = pointSize.y;
        }
        /*
         * I add 1 to cause ResizeChild to resize the window.
         */
        new_width = (short)(pointSize.x*node->width+1);
        new_height = (short)(pointSize.y*node->height+1);
        lparam = WPI_MAKEP2(new_width, new_height);
        ResizeChild(lparam, node->hwnd, TRUE );
    }
    BlowupImage( node->hwnd, NULL );
} /* ResetDrawArea */
Exemple #4
0
/*
 * CutImage - cuts the current clipping rectangle to the clipboard
 */
void CutImage( void )
{
    WPI_PRES    pres;
    WPI_PRES    mempres;
    HDC         memdc;
    HBITMAP     oldbitmap;
    short       width;
    short       height;
    img_node    *node;
    WPI_RECTDIM left;
    WPI_RECTDIM right;
    WPI_RECTDIM top;
    WPI_RECTDIM bottom;

    node = GetCurrentNode();

    if( node == NULL ) {
        return;
    }

    if( !fEnableCutCopy ) {
        _wpi_setwrectvalues( &clipRect.rect, 0, 0, node->width, node->height );
        width = node->width;
        height = node->height;
    } else {
        width = (short)_wpi_getwidthrect( clipRect.rect );
        height = (short)_wpi_getheightrect( clipRect.rect );
    }
    copyImageToClipboard( width, height, node );

    pres = _wpi_getpres( node->viewhwnd );
    mempres = _wpi_createcompatiblepres( pres, Instance, &memdc );
    _wpi_releasepres( node->viewhwnd, pres );

    oldbitmap = _wpi_selectbitmap( mempres, node->hxorbitmap );
    _wpi_getrectvalues( clipRect.rect, &left, &top, &right, &bottom );
    _wpi_patblt( mempres, left, top, width, height, WHITENESS );

    _wpi_getoldbitmap( mempres, oldbitmap );
    oldbitmap = _wpi_selectbitmap( mempres, node->handbitmap );
    _wpi_patblt( mempres, left, top, width, height, BLACKNESS );
    _wpi_getoldbitmap( mempres, oldbitmap );
    _wpi_deletecompatiblepres( mempres, memdc );

    InvalidateRect( node->viewhwnd, NULL, FALSE );
    RecordImage( node->hwnd );

    if( !fEnableCutCopy ) {
        PrintHintTextByID( WIE_ENTIREIMAGECUT, NULL );
    } else {
        PrintHintTextByID( WIE_AREACUT, NULL );
        fEnableCutCopy = FALSE;
    }
    BlowupImage( node->hwnd, NULL );

} /* CutImage */
Exemple #5
0
/*
 * ClearImage - clear the XOR and the AND bitmaps
 */
void ClearImage( void )
{
    WPI_PRES            pres;
    WPI_PRES            xorpres;
    WPI_PRES            andpres;
    HDC                 xormemdc;
    HDC                 andmemdc;
    HBITMAP             oldxor;
    HBITMAP             oldand;
    img_node            *node;
    WPI_RECT            clear_area;
    IMGED_DIM           left;
    IMGED_DIM           top;
    IMGED_DIM           right;
    IMGED_DIM           bottom;
    int                 width;
    int                 height;

    node = GetCurrentNode();
    if( node == NULL ) {
        return;
    }

    if( DoesRectExist( &clear_area ) ) {
        SetRectExists( FALSE );
    } else {
        _wpi_setwrectvalues( &clear_area, 0, 0, node->width, node->height );
    }

    pres = _wpi_getpres( HWND_DESKTOP );
    xorpres = _wpi_createcompatiblepres( pres, Instance, &xormemdc );
    andpres = _wpi_createcompatiblepres( pres, Instance, &andmemdc );
    _wpi_releasepres( HWND_DESKTOP, pres );

    oldxor = _wpi_selectobject( xorpres, node->hxorbitmap );
    oldand = _wpi_selectobject( andpres, node->handbitmap );

    _wpi_getwrectvalues( clear_area, &left, &top, &right, &bottom );
    width = _wpi_getwidthrect( clear_area );
    height = _wpi_getheightrect( clear_area );

    _wpi_patblt( xorpres, left, top, width, height, WHITENESS );
    _wpi_patblt( andpres, left, top, width, height, BLACKNESS );

    _wpi_selectobject( xorpres, oldxor );
    _wpi_selectobject( andpres, oldand );
    _wpi_deletecompatiblepres( xorpres, xormemdc );
    _wpi_deletecompatiblepres( andpres, andmemdc );

    InvalidateRect( node->viewhwnd, NULL, TRUE );
    RecordImage( node->hwnd );
    BlowupImage( node->hwnd, NULL );
    PrintHintTextByID( WIE_AREACLEARED, NULL );

} /* ClearImage */
Exemple #6
0
/*
 * RepaintDrawArea - handles the WM_PAINT message.
 */
void RepaintDrawArea( HWND hwnd )
{
    WPI_PRES            pres;
    PAINTSTRUCT         ps;

    if (hwnd) {
        pres = _wpi_beginpaint( hwnd, NULL, &ps );
        BlowupImage( hwnd, pres );
        _wpi_endpaint( hwnd, pres, &ps );
    }
} /* RepaintDrawArea */
Exemple #7
0
/*
 * TransferImage - transfer the image in the outlined box to the view window
 */
void TransferImage( HWND hwnd )
{
    POINT       topleft_desk;
    HDC         hdc;
    HDC         memdc;
    HBITMAP     oldbitmap;
    img_node    *node;

#ifdef __NT__
    SetDeskTopHook( NULL );
#endif
    redrawPrevRegion();

    GetCursorPos( &topleft_desk );
    node = SelectImage( hwnd );
    hdc = GetDC( NULL );
    memdc = CreateCompatibleDC( hdc );

    oldbitmap = SelectObject( memdc, node->handbitmap );
    PatBlt( memdc, topLeft.x, topLeft.y, snapWidth, snapHeight, BLACKNESS );

    SelectObject( memdc, node->hxorbitmap );
    BitBlt( memdc, topLeft.x, topLeft.y, snapWidth, snapHeight, hdc,
            topleft_desk.x, topleft_desk.y, SRCCOPY );
    ReleaseDC( NULL, hdc );
    SelectObject( memdc, oldbitmap );
    DeleteDC( memdc );
    ReleaseCapture();
    ShowWindow( HMainWindow, previousState );

#ifdef __NT__
    DestroyWindow( deskTopWindow );
#else
    InvalidateRect( node->viewhwnd, NULL, FALSE );
#endif
    RecordImage( hwnd );

    SetToolType( prevToolType );
    if( !DoKeepRect() ) {
        SetRectExists( FALSE );
    } else {
        SetRectExists( rectExists );
    }
#ifndef __NT__
    BlowupImage( node->hwnd, NULL );
#endif
    SetCursor( prevCursor );
    PrintHintTextByID( WIE_BMPSNAPPEDFROMDSKTOP, NULL );

} /* TransferImage */
Exemple #8
0
/*
 * FillArea - Fills the area.
 */
void FillArea( WPI_POINT *pt, int mousebutton )
{
    WPI_POINT   devicept;
    COLORREF    colour;
    wie_clrtype type;
    img_node    *node;

    devicept.x = pt->x / pointSize.x;
    devicept.y = pt->y / pointSize.y;
    colour = GetSelectedColour( mousebutton, NULL, &type );

    FillXorAnd(colour, &devicept, type);
    node = GetCurrentNode();
    InvalidateRect( node->viewhwnd, NULL, FALSE );
    BlowupImage( node->hwnd, NULL );
#ifdef __OS2_PM__
    currentMouseButton = currentMouseButton;    // just to suppres complaints
#endif
} /* FillArea */
Exemple #9
0
/*
 * ShiftImage - shift the image in the given direction
 */
void ShiftImage( WORD shiftdirection )
{
    HBITMAP     dup_and;
    HBITMAP     dup_xor;
    HBITMAP     oldbitmap;
    HBITMAP     oldsrcbitmap;
    WPI_PRES    pres;
    HDC         memdc;
    WPI_PRES    mempres;
    HDC         srcdc;
    WPI_PRES    srcpres;
    short       x_src;
    short       y_src;
    short       x_dest;
    short       y_dest;
    short       width;
    short       height;
    short       min_width;
    short       min_height;
    short       rgn_width;
    short       rgn_height;
    img_node    *node;
    WPI_RECT    rect;
    IMGED_DIM   left;
    IMGED_DIM   right;
    IMGED_DIM   top;
    IMGED_DIM   bottom;
    DWORD       message;

    node = GetCurrentNode();
    if( node == NULL ) {
        return;
    }

    dup_and = DuplicateBitmap( node->handbitmap );
    dup_xor = DuplicateBitmap( node->hxorbitmap );

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

    _wpi_torgbmode( mempres );
    _wpi_torgbmode( srcpres );

    if( DoesRectExist( &rect ) ) {
        width = (short)_wpi_getwidthrect( rect );
        height = (short)_wpi_getheightrect( rect );
    } else {
        _wpi_setwrectvalues( &rect, 0, 0, node->width, node->height );
        width = node->width;
        height = node->height;
    }

    _wpi_getwrectvalues( rect, &left, &top, &right, &bottom );

    oldbitmap = _wpi_selectobject( mempres, node->handbitmap );
    _wpi_patblt( mempres, left, top, width, height, BLACKNESS );
    _wpi_selectobject( mempres, oldbitmap );
    oldbitmap = _wpi_selectobject( mempres, node->hxorbitmap );
    _wpi_patblt( mempres, left, top, width, height, WHITENESS );

    oldsrcbitmap = _wpi_selectobject( srcpres, dup_xor );

    x_src = (short)left;
    y_src = (short)top;
    x_dest =(short)left;
    y_dest = (short)top;
    min_width = (short)min( ImgedConfigInfo.shift, width );
    min_height = (short)min( ImgedConfigInfo.shift, height );
    rgn_width = width;
    rgn_height = height;

    switch( shiftdirection ) {
    case IMGED_LEFT:
        width -= min_width;
        x_src = x_src + min_width;
        message = WIE_IMAGESHIFTEDLEFT;
        break;

    case IMGED_RIGHT:
        width -= min_width;
        x_dest = x_dest + min_width;
        message = WIE_IMAGESHIFTEDRIGHT;
        break;

    case IMGED_UP:
#ifndef __OS2_PM__
        height -= min_height;
        y_src = y_src + min_height;
#else
        height += min_height;
        y_src = y_src - min_height;
#endif
        message = WIE_IMAGESHIFTEDUP;
        break;

    case IMGED_DOWN:
#ifndef __OS2_PM__
        height -= min_height;
        y_dest = y_dest + min_height;
#else
        height += min_height;
        y_dest = y_dest - min_height;
#endif
        message = WIE_IMAGESHIFTEDDOWN;
        break;

    default:
        break;
    }

    _wpi_bitblt( mempres, x_dest, y_dest, width, height, srcpres, x_src, y_src, SRCCOPY );
    _wpi_selectobject( srcpres, oldsrcbitmap );
    oldsrcbitmap = _wpi_selectobject( srcpres, dup_and );
    _wpi_selectobject( mempres, oldbitmap );
    oldbitmap = _wpi_selectobject( mempres, node->handbitmap );
    _wpi_bitblt( mempres, x_dest, y_dest, width, height, srcpres, x_src, y_src, SRCCOPY );

    if( IsShiftWrap() ) {
        switch( shiftdirection ) {
        case IMGED_LEFT:
            width = min_width;
            x_src = (short)left;
            x_dest = (short)(right - width);
            break;

        case IMGED_RIGHT:
            width = min_width;
            x_dest = (short)left;
            x_src = (short)(right - width);
            break;

        case SHIFT_UP:
            height = min_height;
            y_src = (short)top;
            y_dest = (short)(bottom - height);
            break;

        case SHIFT_DOWN:
            height = min_height;
            y_dest = (short)top;
            y_src = (short)(bottom - height);
            break;

        default:
            break;
        }

        _wpi_bitblt( mempres, x_dest, y_dest, width, height, srcpres,
                     x_src, y_src, SRCCOPY );
        _wpi_selectobject( srcpres, oldsrcbitmap );
        _wpi_selectobject( mempres, oldbitmap );
        oldsrcbitmap = _wpi_selectobject( srcpres, dup_xor );
        oldbitmap = _wpi_selectobject( mempres, node->hxorbitmap );
        _wpi_bitblt( mempres, x_dest, y_dest, width, height, srcpres,
                     x_src, y_src, SRCCOPY );
    }
    _wpi_selectobject( srcpres, oldsrcbitmap );
    _wpi_selectobject( mempres, oldbitmap );
    _wpi_deletecompatiblepres( srcpres, srcdc );
    _wpi_deletecompatiblepres( mempres, memdc );

    _wpi_deleteobject( dup_xor );
    _wpi_deleteobject( dup_and );

    RecordImage( node->hwnd );
    BlowupImage( node->hwnd, NULL );
    InvalidateRect( node->viewhwnd, NULL, FALSE );

    IEPrintAmtText( message, ImgedConfigInfo.shift );

} /* ShiftImage */
Exemple #10
0
/*
 * clipIntoArea - clip the bitmaps into the area when rotating
 */
static void clipIntoArea( img_node *node, WPI_RECT *rect,
                          HBITMAP rotxorbmp, HBITMAP rotandbmp )
{
    WPI_PRES    pres;
    WPI_PRES    xorpres;
    HDC         xordc;
    WPI_PRES    andpres;
    HDC         anddc;
    WPI_PRES    rotxorpres;
    HDC         rotxordc;
    WPI_PRES    rotandpres;
    HDC         rotanddc;
    HBITMAP     oldxor;
    HBITMAP     oldand;
    HBITMAP     oldxorrot;
    HBITMAP     oldandrot;
    short       width;
    short       height;
    WPI_POINT   centre_pt;
    WPI_POINT   topleft;
    short       start_x;
    short       start_y;
    short       new_width;
    short       new_height;
    IMGED_DIM   left;
    IMGED_DIM   right;
    IMGED_DIM   top;
    IMGED_DIM   bottom;

    width = (short)_wpi_getwidthrect( *rect );
    height = (short)_wpi_getheightrect( *rect );

    /*
     * PM NOTE:  We use getwrectvalues so that 'topleft' can really be
     * replace with 'bottomleft' (which is our origin for blitting in PM).
     * Hence the value of 'top' is really the bottom of our rectangle.
     */
    _wpi_getwrectvalues( *rect, &left, &top, &right, &bottom );
    centre_pt.x = (width / 2) + left;
    centre_pt.y = (height / 2) + top;

    topleft.x = __max( left, centre_pt.x - centre_pt.y + top );
    topleft.y = __max( top, centre_pt.y - centre_pt.x + left );

    if( topleft.x == left ) {
        start_x = (short)(left - (centre_pt.x - centre_pt.y + top));
        new_width = width;
    } else {
        start_x = 0;
        new_width = height;
    }
    if( topleft.y == top ) {
        start_y = (short)(top - (centre_pt.y - centre_pt.x + left));
        new_height = height;
    } else {
        start_y = 0;
        new_height = width;
    }

    pres = _wpi_getpres( HWND_DESKTOP );
    xorpres = _wpi_createcompatiblepres( pres, Instance, &xordc );
    andpres = _wpi_createcompatiblepres( pres, Instance, &anddc );
    rotxorpres = _wpi_createcompatiblepres( pres, Instance, &rotxordc );
    rotandpres = _wpi_createcompatiblepres( pres, Instance, &rotanddc );
    _wpi_releasepres( HWND_DESKTOP, pres );

    _wpi_torgbmode( xorpres );
    _wpi_torgbmode( andpres );
    _wpi_torgbmode( rotxorpres );
    _wpi_torgbmode( rotandpres );

    oldxor = _wpi_selectobject( xorpres, node->hxorbitmap );
    oldand = _wpi_selectobject( andpres, node->handbitmap );
    oldxorrot = _wpi_selectobject( rotxorpres, rotxorbmp );
    oldandrot = _wpi_selectobject( rotandpres, rotandbmp );

    _wpi_patblt( xorpres, left, top, width, height, WHITENESS );
    _wpi_patblt( andpres, left, top, width, height, BLACKNESS );

    _wpi_bitblt( xorpres, topleft.x, topleft.y, new_width, new_height,
                 rotxorpres, start_x, start_y, SRCCOPY );
    _wpi_bitblt( andpres, topleft.x, topleft.y, new_width, new_height,
                 rotandpres, start_x, start_y, SRCCOPY );

    _wpi_selectobject( xorpres, oldxor );
    _wpi_selectobject( andpres, oldand );
    _wpi_selectobject( rotxorpres, oldxorrot );
    _wpi_selectobject( rotandpres, oldandrot );
    _wpi_deletecompatiblepres( xorpres, xordc );
    _wpi_deletecompatiblepres( andpres, anddc );
    _wpi_deletecompatiblepres( rotxorpres, rotxordc );
    _wpi_deletecompatiblepres( rotandpres, rotanddc );

    InvalidateRect( node->viewhwnd, NULL, TRUE );
    RecordImage( node->hwnd );
    BlowupImage( node->hwnd, NULL );

} /* clipIntoArea */
Exemple #11
0
/*
 * stretchIntoArea - stretch the rotated image into the area specified
 */
static void stretchIntoArea( img_node *node, WPI_RECT *rect,
                             HBITMAP rotxorbmp, HBITMAP rotandbmp )
{
    WPI_PRES    pres;
    WPI_PRES    xorpres;
    HDC         xordc;
    WPI_PRES    andpres;
    HDC         anddc;
    WPI_PRES    rotxorpres;
    HDC         rotxordc;
    WPI_PRES    rotandpres;
    HDC         rotanddc;
    HBITMAP     oldxor;
    HBITMAP     oldand;
    HBITMAP     oldxorrot;
    HBITMAP     oldandrot;
    short       width;
    short       height;
    IMGED_DIM   left;
    IMGED_DIM   right;
    IMGED_DIM   bottom;
    IMGED_DIM   top;

    width = (short)_wpi_getwidthrect( *rect );
    height = (short)_wpi_getheightrect( *rect );

    _wpi_getwrectvalues( *rect, &left, &top, &right, &bottom );

    pres = _wpi_getpres( HWND_DESKTOP );
    xorpres = _wpi_createcompatiblepres( pres, Instance, &xordc );
    andpres = _wpi_createcompatiblepres( pres, Instance, &anddc );
    rotxorpres = _wpi_createcompatiblepres( pres, Instance, &rotxordc );
    rotandpres = _wpi_createcompatiblepres( pres, Instance, &rotanddc );
    _wpi_releasepres( HWND_DESKTOP, pres );

    _wpi_torgbmode( xorpres );
    _wpi_torgbmode( andpres );
    _wpi_torgbmode( rotxorpres );
    _wpi_torgbmode( rotandpres );

    oldxor = _wpi_selectobject( xorpres, node->hxorbitmap );
    oldand = _wpi_selectobject( andpres, node->handbitmap );
    oldxorrot = _wpi_selectobject( rotxorpres, rotxorbmp );
    oldandrot = _wpi_selectobject( rotandpres, rotandbmp );

    _wpi_setstretchbltmode( xorpres, STRETCH_COLOR );
    _wpi_stretchblt( xorpres, left, top, width, height, rotxorpres, 0, 0,
                     height, width, SRCCOPY );

    _wpi_setstretchbltmode( andpres, STRETCH_COLOR );
    _wpi_stretchblt( andpres, left, top, width, height, rotandpres, 0, 0,
                     height, width, SRCCOPY );
    _wpi_selectobject( xorpres, oldxor );
    _wpi_selectobject( andpres, oldand );
    _wpi_selectobject( rotxorpres, oldxorrot );
    _wpi_selectobject( rotandpres, oldandrot );
    _wpi_deletecompatiblepres( xorpres, xordc );
    _wpi_deletecompatiblepres( andpres, anddc );
    _wpi_deletecompatiblepres( rotxorpres, rotxordc );
    _wpi_deletecompatiblepres( rotandpres, rotanddc );

    InvalidateRect( node->viewhwnd, NULL, TRUE );
    RecordImage( node->hwnd );
    BlowupImage( node->hwnd, NULL );

} /* stretchIntoArea */
Exemple #12
0
/*
 * DisplayRegion - Draws the region (rectangle or ellipse) first in the view
 *              window, then in the draw area.
 */
void DisplayRegion( HWND hwnd, WPI_POINT *start_pt, WPI_POINT *end_pt, int mousebutton )
{
    COLORREF    colour;
    COLORREF    dithered;
    COLORREF    solid;
    WPI_POINT   imgstart_pt;
    WPI_POINT   imgend_pt;
    WPI_RECT    rect;
    BOOL        dofillrgn;
    BOOL        is_rect;
    wie_clrtype type;
    img_node    *node;

    CheckBounds( hwnd, start_pt );
    CheckBounds( hwnd, end_pt );
    imgstart_pt.x = min(start_pt->x / pointSize.x, end_pt->x / pointSize.x);
    imgend_pt.x = max(start_pt->x / pointSize.x, end_pt->x / pointSize.x);
#ifdef __OS2_PM__
    imgstart_pt.y = max(start_pt->y / pointSize.y, end_pt->y / pointSize.y);
    imgend_pt.y = min(start_pt->y / pointSize.y, end_pt->y / pointSize.y) - 1;
#else
    imgstart_pt.y = min(start_pt->y / pointSize.y, end_pt->y / pointSize.y);
    imgend_pt.y = max(start_pt->y / pointSize.y, end_pt->y / pointSize.y) + 1;
#endif

    imgend_pt.x += 1;

    dithered = GetSelectedColour(mousebutton, &solid, &type);
    switch (toolType) {
    case IMGED_RECTO:
        dofillrgn = FALSE;
        is_rect = TRUE;
        colour = solid;
        break;

    case IMGED_RECTF:
        dofillrgn = TRUE;
        is_rect = TRUE;
        colour = dithered;
        break;

    case IMGED_CIRCLEO:
        dofillrgn = FALSE;
        is_rect = FALSE;
        colour = solid;
        break;

    case IMGED_CIRCLEF:
        dofillrgn = TRUE;
        is_rect = FALSE;
        colour = dithered;
        break;

    default:
        return;
    }

    _wpi_setrectvalues(&rect, imgstart_pt.x, imgstart_pt.y, imgend_pt.x,
                                                        imgend_pt.y);
    if (type == SCREEN_CLR) {
        RegionXorAnd(BLACK, WHITE, dofillrgn, &rect, is_rect);
    } else if (type == INVERSE_CLR) {
        RegionXorAnd(WHITE, WHITE, dofillrgn, &rect, is_rect);
    } else {
        RegionXorAnd(colour, BLACK, dofillrgn, &rect, is_rect);
    }

    node = GetCurrentNode();
    InvalidateRect( node->viewhwnd, NULL, FALSE );
    BlowupImage( hwnd, NULL );
} /* DisplayRegion */
Exemple #13
0
/*
 * ResizeChild - resizes the draw area of the child window.
 */
void ResizeChild( WPI_PARAM2 lparam, HWND hwnd, BOOL firsttime )
{
    short       min_width;
    short       width;
    short       height;
    img_node    *node;
    short       x_adjustment;
    short       y_adjustment;
    short       new_width;
    short       new_height;
    WPI_POINT   point_size;
    WPI_POINT   max;
    HWND        frame;
    HMENU       hmenu;
    WPI_RECT    rc;
    WPI_RECT    rect;

    frame = _wpi_getframe( hwnd );
    width = LOWORD( lparam );
#ifdef __OS2_PM__
    height = SHORT2FROMMP( lparam );
#else
    height = HIWORD( lparam );
#endif

    GetClientRect( hwnd, &rc );
    GetWindowRect( hwnd, &rect );
    if( frame ) {
        GetClientRect( frame, &rc );
        GetWindowRect( frame, &rect );
    }

    max.x = _wpi_getsystemmetrics( SM_CXSCREEN );
    max.y = _wpi_getsystemmetrics( SM_CYSCREEN );

    x_adjustment = _wpi_getwidthrect( rect ) - _wpi_getwidthrect( rc );
    y_adjustment = _wpi_getheightrect( rect ) - _wpi_getheightrect( rc );

    #if 1
        min_width = MIN_DRAW_WIN_WIDTH;
    #else
        min_width = (short)(2*_wpi_getsystemmetrics(SM_CXSIZE)) +
                    x_adjustment +
                    8; // fudge factor to allow some of title bar to show
    #endif

#ifdef __OS2_PM__
    ++y_adjustment;
#endif

    node = SelectImage( hwnd );
    if (!node) return;

    // the following assumes that max.x >> min_width
    point_size.x = min( max.x / node->width, width / node->width );
    point_size.x = max( min_width / node->width + 1, point_size.x );

    point_size.y = min( max.y / node->height, height / node->height );
    point_size.y = max( 1, point_size.y );

    if( ImgedConfigInfo.square_grid ) {
        point_size.x = min( point_size.x, point_size.y );
        if( point_size.x < ( min_width / node->width + 1 ) ) {
            point_size.x = min_width / node->width + 1;
        }
        if( point_size.x > ( max.y / node->height ) ) {
            hmenu = GetMenu( _wpi_getframe(HMainWindow) );
            CheckSquareGrid( hmenu );
        } else {
            point_size.y = point_size.x;
        }
    }

    new_width = (short)(point_size.x * node->width + x_adjustment);
    new_height = (short)(point_size.y * node->height + y_adjustment);

    pointSize = point_size;

    if( (pointSize.x*node->width != width) ||
        (pointSize.y*node->height != height) ) {
        SetWindowPos( frame, HWND_TOP, 0, 0, new_width, new_height,
                        SWP_SIZE | SWP_ZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);
        SetGridSize( pointSize.x, pointSize.y );
    }
    if( !firsttime ) {
        BlowupImage( node->hwnd, NULL );
    }
} /* ResizeChild */
Exemple #14
0
/*
 * simpleRotate - simply rotate the image around the center of the given rectangle
 */
static void simpleRotate( img_node *node, WPI_RECT *rect, HBITMAP rotxorbmp,
                          HBITMAP rotandbmp, BOOL rectexists )
{
    WPI_POINT   topleft;
    WPI_POINT   centre_pt;
    WPI_PRES    pres;
    HDC         xordc;
    WPI_PRES    xorpres;
    HDC         anddc;
    WPI_PRES    andpres;
    HDC         rotxordc;
    WPI_PRES    rotxorpres;
    HDC         rotanddc;
    WPI_PRES    rotandpres;
    HBITMAP     oldxor;
    HBITMAP     oldand;
    HBITMAP     oldxorrot;
    HBITMAP     oldandrot;
    short       width;
    short       height;
    WPI_RECT    new_rect;
    IMGED_DIM   left;
    IMGED_DIM   top;
    IMGED_DIM   right;
    IMGED_DIM   bottom;

    width = (short)_wpi_getwidthrect( *rect );
    height = (short)_wpi_getheightrect( *rect );

    /*
     * PM NOTE:  The rectangle comes in with bottom = yTop and top = yBottom.
     * To use the same formula to calculate the center point and top left, we
     * use getwrectvalues.
     */
    _wpi_getwrectvalues( *rect, &left, &top, &right, &bottom );
    centre_pt.x = (width / 2) + left;
    centre_pt.y = (height / 2) + top;
    topleft.x = centre_pt.x - centre_pt.y + top;
    topleft.y = centre_pt.y - centre_pt.x + left;

    pres = _wpi_getpres( HWND_DESKTOP );
    xorpres = _wpi_createcompatiblepres( pres, Instance, &xordc );
    andpres = _wpi_createcompatiblepres( pres, Instance, &anddc );
    rotxorpres = _wpi_createcompatiblepres( pres, Instance, &rotxordc );
    rotandpres = _wpi_createcompatiblepres( pres, Instance, &rotanddc );
    _wpi_releasepres( HWND_DESKTOP, pres );

    _wpi_torgbmode( xorpres );
    _wpi_torgbmode( andpres );
    _wpi_torgbmode( rotxorpres );
    _wpi_torgbmode( rotandpres );

    oldxor = _wpi_selectobject( xorpres, node->hxorbitmap );
    oldand = _wpi_selectobject( andpres, node->handbitmap );
    oldxorrot = _wpi_selectobject( rotxorpres, rotxorbmp );
    oldandrot = _wpi_selectobject( rotandpres, rotandbmp );

    _wpi_getwrectvalues( *rect, &left, &top, &right, &bottom );
    _wpi_patblt( xorpres, left, top, width, height, WHITENESS );
    _wpi_patblt( andpres, left, top, width, height, BLACKNESS );

    _wpi_bitblt( xorpres, topleft.x, topleft.y, height, width, rotxorpres, 0, 0, SRCCOPY );
    _wpi_bitblt( andpres, topleft.x, topleft.y, height, width, rotandpres, 0, 0, SRCCOPY );

    _wpi_selectobject( xorpres, oldxor );
    _wpi_selectobject( andpres, oldand );
    _wpi_selectobject( rotxorpres, oldxorrot );
    _wpi_selectobject( rotandpres, oldandrot );
    _wpi_deletecompatiblepres( xorpres, xordc );
    _wpi_deletecompatiblepres( andpres, anddc );
    _wpi_deletecompatiblepres( rotxorpres, rotxordc );
    _wpi_deletecompatiblepres( rotandpres, rotanddc );

    InvalidateRect( node->viewhwnd, NULL, TRUE );
    RecordImage( node->hwnd );
    if( DoKeepRect() ) {
        if( rectexists ) {
            _wpi_setwrectvalues( &new_rect, topleft.x, topleft.y,
                                 topleft.x+height, topleft.y + width );
            SetDeviceClipRect( &new_rect );
        }
    } else {
        rectexists = rectexists;
        new_rect = new_rect;
        SetRectExists( FALSE );
    }

    BlowupImage( node->hwnd, NULL );

} /* simpleRotate */
Exemple #15
0
/*
 * WinNewDrawPad - create a new drawing pad for Windows version
 */
HWND WinNewDrawPad( img_node *node )
{
    MDICREATESTRUCT     mdicreate;
    short               y_adjustment;
    short               x_adjustment;
    short               pad_x;
    short               pad_y;
    int                 i;
    img_node            *temp;
    POINT               origin;
    char                filename[_MAX_PATH];
    HWND                drawarea;
    HMENU               sys_menu;

    node->viewhwnd = CreateViewWin( node->width, node->height );
    pad_x = 0;
    pad_y = 0;

    temp = node->nexticon;

    for( i = 1; i < node->num_of_images; i++ ) {
        temp->viewhwnd = node->viewhwnd;
        temp = temp->nexticon;
    }

    if( node->imgtype == BITMAP_IMG ) {
        mdicreate.szClass = DrawAreaClassB;
    } else if( node->imgtype == ICON_IMG ) {
        mdicreate.szClass = DrawAreaClassI;
    } else {
        mdicreate.szClass = DrawAreaClassC;
    }

    GetFnameFromPath( node->fname, filename );
    mdicreate.szTitle = filename;
    mdicreate.hOwner = Instance;

    x_adjustment = (short)(2 * GetSystemMetrics( SM_CXFRAME ));
    y_adjustment = (short)(2 * GetSystemMetrics( SM_CYFRAME ) +
                           GetSystemMetrics( SM_CYCAPTION ) - 1);

    origin.x = 0;
    origin.y = 0;
    FindOrigin( &origin );
    CalculateDims( node->width, node->height, &pad_x, &pad_y );

    mdicreate.cx = x_adjustment + pad_x;
    mdicreate.cy = y_adjustment + pad_y;
    mdicreate.x = origin.x;
    mdicreate.y = origin.y;
    mdicreate.style = WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_VISIBLE |
                      WS_CLIPSIBLINGS | WS_DLGFRAME | WS_MINIMIZEBOX |
                      WS_THICKFRAME;
    mdicreate.lParam = (LPARAM)(LPVOID)node;

    drawarea = (HWND)SendMessage( ClientWindow, WM_MDICREATE, 0,
                                  (LPARAM)(LPVOID)&mdicreate );

    if( drawarea != (HWND)NULL ) {
        RECT    rect;
        int     w, h;
        _wpi_getclientrect( drawarea, &rect );
        w = _wpi_getwidthrect( rect );
        h = _wpi_getheightrect( rect );
        if( w != pad_x || h != pad_y ) {
            GetWindowRect( drawarea, &rect );
            w = _wpi_getwidthrect( rect ) + (pad_x - w);
            h = _wpi_getheightrect( rect ) + (pad_y - h);
            SetWindowPos( drawarea, HWND_TOP, 0, 0, w, h,
                          SWP_SIZE | SWP_NOZORDER | SWP_NOMOVE );
        }
    }

    if( ImgedIsDDE ) {
        sys_menu = GetSystemMenu( drawarea, FALSE );
        if( sys_menu != (HMENU)NULL ) {
            EnableMenuItem( sys_menu, SC_CLOSE, MF_GRAYED );
        }
    }

    BlowupImage( NULL, NULL );
    return( drawarea );

} /* WinNewDrawPad */
Exemple #16
0
/*
 * PasteImage - paste the image in the clipboard at the current point
 *            - first check to see if the image was cut/copied from our program
 *            - if it was, then we use the hXorClipped and hAndClipped bitmaps
 *              we created in order to preserve the screen colors if ther were used
 *            - otherwise, just copy from the clipboard
 */
void PasteImage( WPI_POINT *pt, WPI_POINT pointsize, HWND hwnd )
{
    HBITMAP     hbitmap;
    HBITMAP     hbitmapdup;
    HBITMAP     holddup;
    HBITMAP     oldbitmap;
    HBITMAP     oldbitmap2;
    WPI_PRES    pres;
    WPI_PRES    mempres;
    HDC         memdc;
    WPI_PRES    clippres;
    HDC         clipdc;
    WPI_RECT    client;
    WPI_POINT   truept;
    short       width;
    short       height;
    short       clipwidth;
    short       clipheight;
    img_node    *node;
    int         fstretchbmp;
    int         bm_width, bm_height;
    WPI_RECTDIM left;
    WPI_RECTDIM right;
    WPI_RECTDIM top;
    WPI_RECTDIM bottom;
    WPI_RECTDIM client_l;
    WPI_RECTDIM client_r;
    WPI_RECTDIM client_t;
    WPI_RECTDIM client_b;
#ifdef __OS2_PM__
    int         src_y, dest_y;
#endif

    if( fEnableCutCopy ) {
        _wpi_getwrectvalues( clipRect.rect, &left, &top, &right, &bottom );
        truept.x = left;
        truept.y = top;
        fstretchbmp = StretchPastedImage();
    } else {
        truept.x = pt->x / pointsize.x;
        truept.y = pt->y / pointsize.y;
        fstretchbmp = -1;
    }

    node = SelectImage( hwnd );
    pres = _wpi_getpres( node->viewhwnd );

    if( _wpi_getclipboardowner( Instance ) == HMainWindow && node->imgtype != BITMAP_IMG ) {
        _wpi_getbitmapdim( hAndClipped, &bm_width, &bm_height );
        GetClientRect( node->hwnd, &client );
        if( fEnableCutCopy ) {
            width = (short)_wpi_getwidthrect( clipRect.rect );
            height = (short)_wpi_getheightrect( clipRect.rect );
        } else {
            _wpi_getrectvalues( client, &client_l, &client_t, &client_r, &client_b );
            width = (short)( client_r / pointsize.x - truept.x );
            if( width > (short)bm_width )
                width = (short)bm_width;
            height = (short)( client_b / pointsize.y - truept.y );
            if( height > (short)bm_height ) {
                height = (short)bm_height;
            }
        }

        mempres = _wpi_createcompatiblepres( pres, Instance, &memdc );
        _wpi_setstretchbltmode( mempres, COLORONCOLOR );
        clippres = _wpi_createcompatiblepres( pres, Instance, &clipdc );

        oldbitmap = _wpi_selectbitmap( mempres, node->handbitmap );
        oldbitmap2 = _wpi_selectbitmap( clippres, hAndClipped );

        if( fstretchbmp == FALSE ) {
            clipwidth = (short)bm_width;
            if( clipwidth > (short)width )
                clipwidth = (short)width;
            clipheight = (short)bm_height;
            if( clipheight > (short)height )
                clipheight = (short)height;

            _wpi_patblt( mempres, truept.x, truept.y, width, height, BLACKNESS );
            _wpi_bitblt( mempres, truept.x, truept.y, clipwidth, clipheight,
                         clippres, 0, 0, SRCCOPY );
        } else if( fstretchbmp == TRUE ) {
            _wpi_stretchblt( mempres, truept.x, truept.y, width, height,
                             clippres, 0, 0, bm_width, bm_height, SRCCOPY);
        } else {
            _wpi_bitblt( mempres, truept.x, truept.y, width, height, clippres,
                         0, 0, SRCCOPY );
        }
        _wpi_getoldbitmap( mempres, oldbitmap );
        oldbitmap = _wpi_selectbitmap( mempres, node->hxorbitmap );

        hbitmapdup = DuplicateBitmap( hXorClipped );
        _wpi_getoldbitmap( clippres, oldbitmap2 );
        oldbitmap2 = _wpi_selectbitmap( clippres, hbitmapdup );

        if( fstretchbmp == FALSE ) {
            clipwidth = (short)bm_width;
            if( clipwidth > (short)width )
                clipwidth = (short)width;
            clipheight = (short)bm_height;
            if( clipheight > (short)height )
                clipheight = (short)height;

            _wpi_patblt( mempres, truept.x, truept.y, width, height, WHITENESS );
#ifdef __OS2_PM__
            if( bm_height > height ) {
                src_y = bm_height - height;
                dest_y = truept.y;
            } else {
                src_y = 0;
                dest_y = truept.y + (height - bm_height);
            }
            _wpi_bitblt( mempres, truept.x, dest_y, clipwidth, clipheight,
                         clippres, 0, src_y, SRCCOPY );
#else
            _wpi_bitblt( mempres, truept.x, truept.y, clipwidth, clipheight,
                         clippres, 0, 0, SRCCOPY );
#endif
        } else if( fstretchbmp == TRUE ) {
            _wpi_stretchblt( mempres, truept.x, truept.y, width, height,
                             clippres, 0, 0, bm_width, bm_height, SRCCOPY );
        } else {
            _wpi_bitblt( mempres, truept.x, truept.y, width, height, clippres,
                         0, 0, SRCCOPY );
        }
        _wpi_getoldbitmap( mempres, oldbitmap );
        _wpi_getoldbitmap( clippres, oldbitmap2 );
        _wpi_deletebitmap( hbitmapdup );
        _wpi_deletecompatiblepres( mempres, memdc );
        _wpi_deletecompatiblepres( clippres, clipdc );
    } else {
        if( node->imgtype != BITMAP_IMG ) {
            CleanupClipboard();
        }
        _wpi_openclipboard( Instance, HMainWindow );
        hbitmap = _wpi_getclipboarddata( Instance, CF_BITMAP );
        hbitmapdup = DuplicateBitmap( hbitmap );
        _wpi_closeclipboard( Instance );

        _wpi_getbitmapdim( hbitmapdup, &bm_width, &bm_height );
        GetClientRect( node->hwnd, &client );

        if( fEnableCutCopy ) {
            width = (short)_wpi_getwidthrect( clipRect.rect );
            height = (short)_wpi_getheightrect( clipRect.rect );
        } else {
            _wpi_getrectvalues( client, &client_l, &client_t, &client_r, &client_b );
            width = (short)( client_r / pointsize.x - truept.x );
            if( width > (short)bm_width )
                width = (short)bm_width;
            height = (short)( client_b / pointsize.y - truept.y );
            if( height > (short)bm_height ) {
                height = (short)bm_height;
            }
        }

        clippres = _wpi_createcompatiblepres( pres, Instance, &clipdc );
        mempres = _wpi_createcompatiblepres( pres, Instance, &memdc );
        _wpi_setstretchbltmode( mempres, COLORONCOLOR );

        holddup = _wpi_selectbitmap( clippres, hbitmapdup );
        oldbitmap = _wpi_selectbitmap( mempres, node->hxorbitmap );

        if( fstretchbmp == FALSE ) {
            clipwidth = (short)bm_width;
            if( clipwidth > (short)width )
                clipwidth = (short)width;
            clipheight = (short)bm_height;
            if( clipheight > (short)height )
                clipheight = (short)height;

            _wpi_patblt( mempres, truept.x, truept.y, width, height, WHITENESS );
#ifdef __OS2_PM__
            if( bm_height > height ) {
                src_y = bm_height - height;
                dest_y = truept.y;
            } else {
                src_y = 0;
                dest_y = truept.y + (height - bm_height);
            }
            _wpi_bitblt( mempres, truept.x, dest_y, clipwidth, clipheight,
                         clippres, 0, src_y, SRCCOPY );
#else
            _wpi_bitblt( mempres, truept.x, truept.y, clipwidth, clipheight,
                         clippres, 0, 0, SRCCOPY );
#endif
        } else if( fstretchbmp == TRUE ) {
            _wpi_stretchblt( mempres, truept.x, truept.y, width, height,
                             clippres, 0, 0, bm_width, bm_height, SRCCOPY );
        } else {
            _wpi_bitblt( mempres, truept.x, truept.y, width, height, clippres,
                         0, 0, SRCCOPY );
        }
        _wpi_getoldbitmap( clippres, holddup );
        _wpi_deletebitmap( hbitmapdup );
        _wpi_deletecompatiblepres( clippres, clipdc );

        _wpi_getoldbitmap( mempres, oldbitmap );
        oldbitmap = _wpi_selectbitmap( mempres, node->handbitmap );
        _wpi_patblt( mempres, truept.x, truept.y, width, height, BLACKNESS );

        _wpi_getoldbitmap( mempres, oldbitmap );
        _wpi_deletecompatiblepres( mempres, memdc );
    }

    ReleaseCapture();
    _wpi_releasepres( node->viewhwnd, pres );

    InvalidateRect( node->viewhwnd, NULL, TRUE );
    if( !fEnableCutCopy ) {
        _wpi_setcursor( prevCursor );
        _wpi_destroycursor( pointCursor );
        SetToolType( prevToolType );
    }

    fEnableCutCopy = FALSE;
    RecordImage( hwnd );
    BlowupImage( NULL, NULL );

    PrintHintTextByID( WIE_BITMAPPASTED, NULL );

} /* PasteImage */
Exemple #17
0
/*
 * FlipImage - flip the image along either the x-axis or the y-axis
 */
void FlipImage( WORD whichway )
{
    img_node    *node;
    short       width;
    short       height;
    short       destwidth;
    short       destheight;
    short       new_left;
    short       new_top;
    WPI_RECT    dims;
    HBITMAP     xorflip;
    HBITMAP     oldflip;
    HBITMAP     oldbitmap;
    HBITMAP     andflip;
    WPI_PRES    pres;
    WPI_PRES    mempres;
    HDC         memdc;
    WPI_PRES    flippres;
    HDC         flipdc;
    HCURSOR     prevcursor;
    IMGED_DIM   bottom;
    IMGED_DIM   left;
    IMGED_DIM   right;
    IMGED_DIM   top;

    node = GetCurrentNode();
    if( node == NULL ) {
        return;
    }

    PrintHintTextByID( WIE_FLIPPINGIMAGE, NULL );
    prevcursor = _wpi_setcursor( _wpi_getsyscursor( IDC_WAIT ) );

    if( !DoesRectExist( &dims ) ) {
        _wpi_setwrectvalues( &dims, 0, 0, (IMGED_DIM)node->width, (IMGED_DIM)node->height );
    }
    width = (short)_wpi_getwidthrect( dims );
    height = (short)_wpi_getheightrect( dims );

    pres = _wpi_getpres( HWND_DESKTOP );
    if( node->bitcount == 1 ) {
        xorflip = _wpi_createbitmap( width, height, 1, 1, NULL );
    } else {
#if 1
        xorflip = _wpi_createcompatiblebitmap( pres, width, height );
#else
        xorflip = _wpi_createbitmap( width, height, ColorPlanes, BitsPerPixel, NULL );
#endif
    }
    andflip = _wpi_createbitmap( width, height, 1, 1, NULL );

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

    _wpi_getrectvalues( dims, &left, &top, &right, &bottom );
    _wpi_preparemono( flippres, BLACK, WHITE );

    oldbitmap = _wpi_selectobject( mempres, node->hxorbitmap );
    oldflip = _wpi_selectobject( flippres, xorflip );
    _wpi_bitblt( flippres, 0, 0, width, height, mempres, left, top, SRCCOPY );
    _wpi_selectobject( mempres, oldbitmap );
    _wpi_selectobject( flippres, oldflip );

    oldbitmap = _wpi_selectobject( mempres, node->handbitmap );
    oldflip = _wpi_selectobject( flippres, andflip );
    _wpi_bitblt( flippres, 0, 0, width, height, mempres, left, top, SRCCOPY );

    if( whichway == IMGED_FLIPVERT ) {
        destwidth = -1 * width;
        new_left = right - 1;
        new_top = top;
        destheight = height;
    } else {
        destwidth = width;
        new_left = left;
        new_top = bottom - 1;
        destheight = -1 * height;
    }

    _wpi_stretchblt( mempres, new_left, new_top, destwidth, destheight,
                     flippres, 0, 0, width, height, SRCCOPY );
    _wpi_selectobject( mempres, oldbitmap );
    oldbitmap = _wpi_selectobject( mempres, node->hxorbitmap );
    _wpi_selectobject( flippres, oldflip );
    oldflip = _wpi_selectobject( flippres, xorflip );
    _wpi_stretchblt( mempres, new_left, new_top, destwidth, destheight,
                     flippres, 0, 0, width, height, SRCCOPY );
    _wpi_selectobject( mempres, oldbitmap );
    _wpi_selectobject( flippres, oldflip );

    _wpi_deleteobject( xorflip );
    _wpi_deleteobject( andflip );
    _wpi_deletecompatiblepres( mempres, memdc );
    _wpi_deletecompatiblepres( flippres, flipdc );

    InvalidateRect( node->viewhwnd, NULL, TRUE );

    if( !DoKeepRect() ) {
        SetRectExists( FALSE );
    }
    RecordImage( node->hwnd );
    BlowupImage( node->hwnd, NULL );
    if( whichway == IMGED_FLIPHORZ ) {
        PrintHintTextByID( WIE_IMAGEREFLECTEDH, NULL );
    } else {
        PrintHintTextByID( WIE_IMAGEREFLECTEDV, NULL );
    }
    _wpi_setcursor( prevcursor );

} /* FlipImage */