Page 1 of 1
TTransparentFlashPlayerControl and onFlashPaint event?
Posted: 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?
Posted: 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.
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);
pixel: PCardinal; // unsigned 32-bit (longword)
// 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
for x := 50 to (flash2.Width-1)-100 do begin
pixel^:= $640000FF; // ARGB pixel
Re: TTransparentFlashPlayerControl and onFlashPaint event?
Posted: 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?
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?
Posted: 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?
Posted: 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.