I have an Image create wih FW_DrawImage()
How I can save and print this image ?
Print and save an Image
- Silvio.Falconi
- Posts: 7170
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 5 times
Print and save an Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: Print and save an Image
FW_DrawImage() does not create an image. It only displays/prints an image on the screen or printer.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 7170
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 5 times
Re: Print and save an Image
thanks resolved
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Otto
- Posts: 6414
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 31 times
- Been thanked: 2 times
- Contact:
Re: Print and save an Image
Silvio,
Would you mind posting how?
Best regards,
Otto
Would you mind posting how?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: Print and save an Image
Otto wrote:Silvio,
Would you mind posting how?
Best regards,
Otto
I helped Silvio, we used a modified version of TWindow:SaveToBmp( cBmpFile ), SaveToBitmap uses WndBitmap, I modified it to takes a region of window:
Code: Select all | Expand
//---------------------------------------------------------------------------//
// copied from fwh32\source\winapi\wndprint.c
HB_FUNC( WNDBITMAPRECT ) // hWnd, aRect --> hBitmap
{
HWND hWnd = ( HWND ) fw_parH( 1 );
HDC hDC = GetWindowDC( hWnd );
HDC hMem = CreateCompatibleDC( hDC );
RECT srcRect;
RECT rct;
HBITMAP hBmp, hOldBmp;
srcRect.top = hb_parvni( 2, 1 );
srcRect.left = hb_parvni( 2, 2 );
srcRect.bottom = hb_parvni( 2, 3 );
srcRect.right = hb_parvni( 2, 4 );
//GetWindowRect( hWnd, &rct );
rct.left = 0;
rct.top = 0;
rct.right = srcRect.right - srcRect.left;
rct.bottom = srcRect.bottom - srcRect.top;
hBmp = CreateCompatibleBitmap( hDC, rct.right, rct.bottom);
hOldBmp = ( HBITMAP ) SelectObject( hMem, hBmp );
BitBlt( hMem, 0, 0, rct.right, rct.bottom , hDC, srcRect.left, srcRect.top, SRCCOPY );
SelectObject( hMem, hOldBmp );
DeleteDC( hMem );
ReleaseDC( hWnd, hDC );
fw_retnll( hBmp );
}
//----------------------------------------------------------------------------//
- Otto
- Posts: 6414
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 31 times
- Been thanked: 2 times
- Contact:
Re: Print and save an Image
Antonino, thank you for posting the solution.
Best regards,
Otto
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: Print and save an Image
Not necessary.
There is already a function
that does the same thing.
For the user, it is comfortable to use
Image file can be bmp, jpg, png, etc.
I don't see any need to modify the FWH sources.
There is already a function
Code: Select all | Expand
MakeBkBmpEx( hWnd, top, left, width, height )
that does the same thing.
For the user, it is comfortable to use
Code: Select all | Expand
oWnd:SaveAsImage( anyimagefile, [ { top, left, bottom, right } ] )
Image file can be bmp, jpg, png, etc.
I don't see any need to modify the FWH sources.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India