Invisible

Submitted by eLenka on 10 October, 2010 - 15:14

Invisible controls. Used to get access to clip image without displaying it. In this sample, used for making screenshots of Flash movies.

Note. Flash Viewer Engine is needed.

Source archive: invisible.zip (0.75Mb)
 

 
Some sample source: 
procedure TdlgShots.FormPaint(Sender: TObject);
var
  il: integer;
  P: TPoint;
  R: TRect;
begin
  Canvas.Font.Height := round(TextLine * 0.75);
  if BMPList.Count > 0 then
  begin
    P := Point(Tree.Margins.ExplicitWidth, Tree.Margins.Top);
    for il := 0 to BMPList.Count - 1 do
    begin
      Canvas.Draw(P.X, P.Y, TBitmap(BMPList[il]));
      R := Rect(P.X, P.Y + PreviewSizeY, P.X + PreviewSizeX, P.Y + PreviewSizeY + TextLine);
      DrawText(Canvas.Handle, PChar(Format('%d sec', [il + 1])), 5, R, DT_CENTER);
      P.X := P.X + PreviewSizeX + Tree.Margins.Right;
      if P.X > ClientWidth then
        P := Point(Tree.Margins.ExplicitWidth, P.Y + PreviewSizeY + TextLine);
    end;
  end;
end;
 
procedure TdlgShots.Timer1Timer(Sender: TObject);
var
  B: TBitmap;
begin
  inc(ShotCount);
 
  B := TBitmap.Create;
  BMPList.Add(B);
  FlashViewerInvisible.CopyFrameTo(B);
  InvalidateRect(Handle, nil, true);
 
  if ShotCount = 4 then
  begin
    Timer1.Enabled := false;
    FlashViewerInvisible.Volume := 0;
    FlashViewerInvisible.StopPlay;
  end;
end;