Recent

Author Topic: write on sdpoFastForm  (Read 1781 times)

LaurentDelaon

  • New Member
  • *
  • Posts: 20
write on sdpoFastForm
« on: October 08, 2021, 01:04:28 pm »
HI ,

I try to write on sdpoFastForm canvas but not working...
I have use sample with video and sample  fastForm with sdpopackage each other compile and well running separatly.
I don't understand how can I do it ?

Code: Pascal  [Select][+][-]
  1. procedure TFMain.VideoFrame(Sender: TObject; FramePtr: PByte);
  2. var
  3.  
  4.   c: TBGRAPixel;
  5. begin
  6.   //FrameRate:=round(1/((GetTickCount-FrameTime)/1000)*0.5 + FrameRate*0.5);
  7.   FrameRate:=round(1/((GetTickCount-FrameTime)/1000));
  8.   FrameTime:=GetTickCount;
  9.   StatusBar.SimpleText := format('(%d, %d) %d fps', [video.Width, Video.Height, FrameRate]);
  10.  
  11.   if Video.Width * Video.Height <> Image.Width * Image.Height then
  12.   begin
  13.     // I have seen this happening when the driver accepted
  14.     // the video dimensions without complaining but then
  15.     // silently set them to its own liking. For the sake of
  16.     // simplicity we simply raise an exception here and don't
  17.     // attempt to fix it.
  18.     raise Exception.Create('Video picture size is different from what we had requested');
  19.   end;
  20.  
  21.   case Video.PixelFormat of
  22.     uvcpf_YUYV:
  23.       YUYV_to_Gray(PLongWord(FramePtr), PLongWord(Image.Data), Video.Width * Video.Height);
  24.     uvcpf_YUV420:
  25.       YUV420_to_Gray(FramePtr, Image.Data, Video.Width * Video.Height);
  26.     uvcpf_RGB24:
  27.       RGB24_to_TrueColor(PRGB24Pixel(FramePtr), Image.Data, Video.Width * Video.Height);
  28.     uvcpf_BGR24:
  29.       BGR24_to_TrueColor(PRGB24Pixel(FramePtr), Image.Data, Video.Width * Video.Height);
  30.   end;
  31.    //++++++++++++++++++++++++++++++++++++++++++++here my code to write
  32.    // ok on canvas but seem clear by  BGR24_to_TrueColor how to supperpose ??
  33.     Image.DrawToPixmap;
  34.     Image.Canvas.TextOut(TextPos,Image.Height div 2,'coucou!');
  35.     inc(TextPos);
  36.     //Image.Canvas.Rectangle(Bounds(5,5,Image.Width-2*5,Image.Height-2*5));
  37.     Image.PaintFromPixmap;
  38.     //Image.Paint;
  39.     //Image.Sync;
  40. end;  

Regards
Laurent.
« Last Edit: October 08, 2021, 09:02:42 pm by LaurentDelaon »
lazarus 2.2.0
lazarus 2.2.0
fpc 3.2.2
linux x86 gtk2 ubuntu 18.04.6LTS

 

TinyPortal © 2005-2018