TTransparentFlashPlayerControl and onFlashPaint event?

F-IN-BOX for Delphi / Builder C++ / VCL
whome
Posts: 9
Joined: Mon Sep 04, 2006 7:13 am

TTransparentFlashPlayerControl and onFlashPaint event?

Postby whome » Fri Nov 12, 2010 2:47 pm

[WinXP and Win7, f-in-box 3.5.3, Flash OCX 10.1.85.3 ]

Transparent flash component has a flashpaint event method.
FlashPaint(ASender: TObject; pPixels: Pointer);

Help or forum search tells nothing about it. But I think its called on every frame rendering. Event is not available in opaque TFlashPlayerControl.

Can you tell me more about the pPixels format.
- proper cast to ARGB pixels or whatever is byte ordering?
- pointer address is never changed at runtime?
- if I want to save argb pixels somewhere I must copy entire buffer because of next frame reuses same memory space?
- width and height of pixel buffer if player is smaller than animation clip, or what properties should be used as a buffer dimensions?

Do you have a proof of concept example foreach loop to manipulate pixels?

whome
Posts: 9
Joined: Mon Sep 04, 2006 7:13 am

Postby whome » Fri Nov 12, 2010 4:51 pm

Think I got something usefull out of it. Please can you verify my findings and question in an original post. Pixel pointer is upside down ordering (from bottom to up, from right to left) what made traditional XY loop wild.
thx

Here is my proof of concept loop, it modifies some of the pixels inside the flash rendering buffer. I convert pointer offsets to a traditional XY coordinates.

Code: Select all

procedure TfrmMain.flash2FlashPaint(ASender: TObject; pPixels: Pointer);
var
  rgb: Cardinal;
  x,y: Cardinal;
  pixel: PCardinal;  // unsigned 32-bit (longword)
begin
  // pointer holds ARGB in bottomright-topleft ordering
  for y := 50 to (flash2.Height-1)-100 do begin
    pixel := PCardinal(pPixels);
    //Inc(pixel, flash2.Height*flash2.Width-1); // move pointer to topleft (0,0)
    //Dec(pixel, (y+1)*flash2.Width); // move to start of Y row
    //Inc(pixel, 50); // move to start of X row index

    // previous steps combined, turtle moved to topleft origo
    Inc(pixel, (flash2.Height*flash2.Width-1)-((y+1)*flash2.Width)+50);
    for x := 50 to (flash2.Width-1)-100 do begin
      pixel^:= $640000FF; //  ARGB pixel
      Inc(pixel);
    end;
  end;
end;

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: TTransparentFlashPlayerControl and onFlashPaint event?

Postby Softanics » Wed Nov 17, 2010 9:39 am

Thank you for your question.

whome wrote:- proper cast to ARGB pixels or whatever is byte ordering?


It seems that the format is ARGB.

whome wrote:- pointer address is never changed at runtime?


It can be changed by f-in-box if movie size is changing.

whome wrote:- if I want to save argb pixels somewhere I must copy entire buffer because of next frame reuses same memory space?


Yes.

whome wrote:- width and height of pixel buffer if player is smaller than animation clip, or what properties should be used as a buffer dimensions?


Use properties .Width and .Height.

whome wrote:Do you have a proof of concept example foreach loop to manipulate pixels?


Unfortunaly, no.

Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

whome
Posts: 9
Joined: Mon Sep 04, 2006 7:13 am

Postby whome » Sat Nov 27, 2010 11:46 am

Thx, ok I can manage with my PoC pixel loop. Was able to analyze pixels before drawn on a screen.

But I do find one issues, its seems onFlashPaint event is published only for TTransparencyFlashPlayerControl. Its not available in an opaque TFlashPlayerCOntrol.

I do have a source code license, is there some simple .pas hack to be done or can subclass opaque component to publish onFlashPaint event?

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Tue Nov 30, 2010 8:47 am

Indeed, OnFlashPaint is available for TTransparencyFlashPlayerControl only due to nature of TTransparencyFlashPlayerControl. TFlashPlayerControl is not painted itself, it contains a native flash windows inside.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html


Return to “Delphi / Builder / VCL Edition”

Who is online

Users browsing this forum: No registered users and 0 guests

cron