Cut out an area of the screen
Cut out an area of the screen
How can I cut out an area of the screen and save it as a picture in the clipboard ?
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Cut out an area of the screen
the new Class xImage make this
http://forums.fivetechsupport.com/viewt ... 22&start=0
http://forums.fivetechsupport.com/viewt ... 22&start=0
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Cut out an area of the screen
Very nice, but I need to use bitblt()
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Cut out an area of the screen
why ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Cut out an area of the screen
I made a TcropImage class and I use bitblt()
https://github.com/silviofalconi/TCropImage
https://github.com/silviofalconi/TCropImage
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Cut out an area of the screen
Do you mean taking the screen shot of an screen area within a FWH application itself, or just within a windows desktop in general? If the latter from Windows 7 on Windows has included a utility named Snipping Tool that works reasonably well. It has existed in Windows 10 for a while but it looks like Microsoft is moving the functionality to a tool they have named Snip & Sketch (which I just learned now when I started the Snipping Tool).
Re: Cut out an area of the screen
Yes, I mean a screenshot of a part of the screen. I get his device context GetDc() and convert to bitmap (don't remember how to do it)
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Cut out an area of the screen
can you use HB_CROPPED I use in that class
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Cut out an area of the screen
it's like ? Can examplecan you use HB_CROPPED I use in that class
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Cut out an area of the screen
see the class I post
Code: Select all
Function CutImage(nBoxTop,nBoxLeft,nBoxBottom,nBoxRight)
local nType:= 2 //jpg
Local cNameFileCropped:="cropped.jpg"
Local nWBmp,nHBmp
oImageCropped:hBitmap:= CropImage( oImage:hBitmap,nBoxTop,nBoxLeft, nBoxBottom, nBoxRight)
oImageCropped:SaveImage( cNameFileCropped, nType)
oImageCropped:LoadBmp( cNameFileCropped )
nWBmp := alltrim(str(nBmpWidth( oImageCropped:hBitmap )))
nHBmp := alltrim(str(nBmpHeight( oImageCropped:hBitmap ) ))
oGroupCropped:setText("Image Cropped : Dim. "+nWBmp+"X"+nHBmp )
oGroupCropped:refresh()
return nil
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Cut out an area of the screen
Natter wrote:How can I cut out an area of the screen and save it as a picture in the clipboard ?
Code: Select all
hBmp := FWSaveScreen( GetDesktopWindow(), nTop, nLeft, nBottom, nRight )
DEFINE CLIPBOARD oClp FORMAT BITMAP OF oWnd
oClp:Open()
oClp:SetBitmap( hBmp )
oClp:Close()
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Cut out an area of the screen
Thank you, Mr. Rao.
Is it possible to insert the cut fragment at the specified position of the screen ?
Is it possible to insert the cut fragment at the specified position of the screen ?
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Cut out an area of the screen
Do you want to replace the desktop wallpaper?Natter wrote:Thank you, Mr. Rao.
Is it possible to insert the cut fragment at the specified position of the screen ?
Looks more like an academic question than of any practical application in software.
May I know what exactly you want to achieve?
It is possible to capture the entire desktop (as it appears) as a bitmap, copy a specified portion and paste it another location of the same bitmap and generate a new bitmap. Then if you like, you can replace the desktop wallpaper.
But, there is a catch. When you capture the desktop or any part of it, you also get the icons visible at that time.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Cut out an area of the screen
I drew something on the window - a line, a polygon, etc.. Then I want to erase the painting.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Cut out an area of the screen
So, you are not talking about the desktop, but FWH application window.Natter wrote:I drew something on the window - a line, a polygon, etc.. Then I want to erase the painting.
If you let us see your code how are you drawing and displaying the line, polygon, etc, then we can help you how to clear the screen also.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India