|
메모리에 캡쳐한 이미지가 있고...그걸...화면에 뿌리려면....
일단...DC라는 걸 만들어야 합니다...
한마디로...DC는 Windows에서 쓰는 메모리 블럭인데요....
그 DC의 형태로 RAW Image를 변경한 후
그 DC를 만들고 그 DC에 해당하는 Bitmap을 만듭니다..
글구...뿌리고자 하는 Window의 DC에 BitBlt를 이용해서 뿌리는거죠...
좀더 자세한...내용은...
MSDN 라이브러리의 윈도우의 전체 화면을 캡쳐해서 저장하는
예제 프로그램이 있습니다...그걸 참고하세요...
MSDN의 색인 탭에서 ...
CreateCompatibleDC라고 치고...그 맨밑에...예제로 링크가 되어있는데...
그리로 가면...예제가 자세히...나와 있습니다...
그럼...좋은 결과 있기를 바라며...
새해에도...복많이...받고...
즐거운 새해 되세요...
그럼...꾸벅....^^
에구...그냥...아예...원문을 올리죠..뭐..제가....^^
Capturing an Image
You can use a bitmap to capture an image, and you can store the captured image in memory, display it at a different location in your application's window, or display it in another window.
In some cases, you may want your application to capture images and store them only temporarily. For example, when you scale or zoom a picture created in a drawing application, the application must temporarily save the normal view of the image and display the zoomed view. Later, when the user selects the normal view, the application must replace the zoomed image with a copy of the normal view that it temporarily saved.
To store an image temporarily, your application must call CreateCompatibleDC to create a DC that is compatible with the current window DC. After you create a compatible DC, you create a bitmap with the appropriate dimensions by calling the CreateCompatibleBitmap function and then select it into this device context by calling the SelectObject function.
After the compatible device context is created and the appropriate bitmap has been selected into it, you can capture the image. The BitBlt function captures images. This function performs a bit block transfer — that is, it copies data from a source bitmap into a destination bitmap. However, the two arguments to this function are not bitmap handles. Instead, BitBlt receives handles that identify two device contexts and copies the bitmap data from a bitmap selected into the source DC into a bitmap selected into the target DC. In this case, the target DC is the compatible DC, so when BitBlt completes the transfer, the image has been stored in memory. To redisplay the image, call BitBlt a second time, specifying the compatible DC as the source DC and a window (or printer) DC as the target DC.
The following example code, from an application that captures an image of the entire desktop, creates a compatible device context and a bitmap with the appropriate dimensions, selects the bitmap into the compatible DC, and then copies the image using the BitBlt function.
// Create a normal DC and a memory DC for the entire screen. The
// normal DC provides a "snapshot" of the screen contents. The
// memory DC keeps a copy of this "snapshot" in the associated
// bitmap.
hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = CreateCompatibleDC(hdcScreen);
// Create a compatible bitmap for hdcScreen.
hbmScreen = CreateCompatibleBitmap(hdcScreen,
GetDeviceCaps(hdcScreen, HORZRES),
GetDeviceCaps(hdcScreen, VERTRES));
if (hbmScreen == 0)
errhandler("hbmScreen", hwnd);
// Select the bitmaps into the compatible DC.
if (!SelectObject(hdcCompatible, hbmScreen))
errhandler("Compatible Bitmap Selection", hwnd);
// Hide the application window.
ShowWindow(hwnd, SW_HIDE);
//Copy color data for the entire display into a
//bitmap that is selected into a compatible DC.
if (!BitBlt(hdcCompatible,
0,0,
bmp.bmWidth, bmp.bmHeight,
hdcScreen,
0,0,
SRCCOPY))
errhandler("Screen to Compat Blt Failed", hwnd);
// Redraw the application window.
ShowWindow(hwnd, SW_SHOW);
hans 님이 쓰신 글 :
: Direct X 를 이용하여 캡쳐 보드에서 캡쳐한 영상을
: 화면에 뿌려주려고 합니다.
: 아래에서도 질문을 한번 드렸었는데요..
: 간단히 윈도우 핸들만 넘겨주면 된다고 하셨는데..
: 전혀 이해하지 못하고 있습니다..ㅜ.ㅜ
: 초봅니다..^^
: 어떠한 API들을 사용하여 프로그래밍 해야 하는지 알려주세요..ㅜ.ㅜ
: 혹..예제라도 구할 수 없을까요?
:
: 그리고...
: 캡쳐보드 메모리에서 그래픽 카드 메모리로 영상을 바로 보내서
: 뿌려주는 방법도 있는지 알고 싶습니다..^^
:
: 미리 감사드립니다..^^
|