🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
4 messages
4 total messages Started by MikeS Tue, 18 Mar 2003 08:24
TMediaPlayer and TImage
#652
Author: MikeS
Date: Tue, 18 Mar 2003 08:24
2 lines
1259 bytes
I am trying to capture a still image from the display of a TMediaPlayer Component and put it onto a TImage Canvas but all i seem to be able to get is the image of the object TMedia is displaying on or if i take a screenshot it comes out black i would be very greatfull if someone could help me
Re: TMediaPlayer and TImage
#665
Author: Andrew Warren
Date: Fri, 28 Mar 2003 12:39
6 lines
1290 bytes
"MikeS" <mps1ect@bolton.ac.uk> wrote in message news:<3e76d7c5$1@newsgroups.borland.com>...
> I am trying to capture a still image from the display of a TMediaPlayer Component and put it onto a TImage Canvas but all i seem to be able to get is the image of the object TMedia is displaying on or if i take a screenshot it comes out black i would be very greatfull if someone could help me

Try TActiveMovie (http://www.datastead.com)

Andy.
Re: TMediaPlayer and TImage
#682
Author: Marcelo R. Lopez, Jr.
Date: Tue, 15 Apr 2003 17:55
17 lines
1928 bytes
If you've assigned the TMediaPlayer to TCanvas. Then you could conceivably
get the Window Handle and do a GetBitmapBits() on the actual display.
HOWEVER, realize one thing, that the MediaPlayer is really using the Client
AREA of the canvas as it's drawing space, and in reality, what's being
displayed may very well be just like a hole punched in a piece of paper, you
see what's through the hole, and not what's actually on the canvas.

Though I think you should be able to do it...


"MikeS" <mps1ect@bolton.ac.uk> wrote in message
news:3e76d7c5$1@newsgroups.borland.com...
>
> I am trying to capture a still image from the display of a TMediaPlayer
Component and put it onto a TImage Canvas but all i seem to be able to get
is the image of the object TMedia is displaying on or if i take a screenshot
it comes out black i would be very greatfull if someone could help me
Re: TMediaPlayer and TImage
#683
Author: Marcelo R. Lopez, Jr.
Date: Tue, 15 Apr 2003 18:18
72 lines
3682 bytes
Mike,

Here's a bit of code to exactly what you want to do...it's not pretty....but
it will capture what you want...
Essentially, you have two panels, a mediaplayer with it's display property
set to the first panel. On the second panel, you
put a TIMAGE ( Image1 goes on Panel2 ). Put a button ( button1 ) and have
code like below to capture that snapshot.
You'll probably want to play with the SRC and DEST rectangles, and you could
also use StretchBlt() to size the source image to your destination, etc,
etc. Once the TImage has the snapshot, you can save the resultant bitmap out
to whatever file you'd like...
There's your snapshot....as a matter of fact, you can even feed that TImage
to your printer....and there's your snapshot on paper...

Enjoy..

Marcelo


void __fastcall TForm1::Button1Click(TObject *Sender)
{
    if ( MediaPlayer1->Mode == mpPlaying ) {
        MediaPlayer1->Pause();
        HDC dcSrc,dcDst;
        Image1->Canvas->Lock();
        dcDst = Image1->Canvas->Handle;
        dcSrc = ::GetWindowDC(Panel1->Handle);
        RECT rcSrc;
        RECT rcDst;
        ::GetWindowRect( Panel1->Handle, &rcSrc );

        DWORD dwErr =
        ::BitBlt( dcDst, // handle to destination device context
                0, // x-coordinate of destination rectangle's upper-left
corner
                0, // y-coordinate of destination rectangle's upper-left
corner
                Image1->Width, // width of destination rectangle
                Image1->Height, // height of destination rectangle
                dcSrc, // handle to source device context
                0, // x-coordinate of source rectangle's upper-left corner
                0, // y-coordinate of source rectangle's upper-left corner
                SRCCOPY  // raster operation code
              );

        if ( dwErr == 0 ) {
         // Error occurred
            dwErr = ::GetLastError();
            AnsiString msg;
            msg.sprintf( "BitBlt returned Error = %i", dwErr );
            Application->MessageBox( msg.c_str(), "BitBlt Error", MB_OK );
        }
        Image1->Canvas->Unlock();
        ::ReleaseDC(Panel1->Handle, dcSrc);
        MediaPlayer1->Resume();

        // Do whatever you're going to do with the image at this point...

    }

}



"MikeS" <mps1ect@bolton.ac.uk> wrote in message
news:3e76d7c5$1@newsgroups.borland.com...
>
> I am trying to capture a still image from the display of a TMediaPlayer
Component and put it onto a TImage Canvas but all i seem to be able to get
is the image of the object TMedia is displaying on or if i take a screenshot
it comes out black i would be very greatfull if someone could help me
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads