On Wed, 09 Nov 2005 12:47:03 +0100
Michael Obenland <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I want to get an old kylix program to work with lazarus. It should
> display a picture of my Quickcam Webcam but I can't get the Bitmap part
> to work.
> 
> The work-in-progress procedure is as follows:
> 
> procedure TForm1.Button2Click(Sender: TObject);
> var
>    TempIntfImg : TLazIntfImage;
>    h, w        : word;
>    bitmap      : TBitmap;
>    TempBitmap  : TBitmap;
>    RGBcolor    : TRGBTriple;
>    CurColor    : TFPColor;
>    ImgHandle,
>    ImgMaskHandle : HBitmap;
> 
> begin
>    bitmap := TBitmap.create;
>    bitmap.width  := win.width;
>    bitmap.height := win.height;
>    FpRead( cam, videoBuffer, win.width * win.height * 3 );
>    TempIntfImg := TLazIntfImage.Create( 0, 0 );
>    TempIntfImg.LoadFromBitmap( bitmap.Handle, bitmap.MaskHandle );
>    for h := 0 to win.height-1 do begin
>       for w := 0 to win.width-1 do begin
>          RGBColor := videoBuffer[w+h*win.width];
>          CurColor.Red   := 0;//RGBColor.trirgbRed ;
>          CurColor.Green := 0;//RGBColor.trirgbGreen;
>          CurColor.Blue  := 0;//RGBColor.trirgbBlue;
> >>>>>>   TempIntfImg.Colors[w,h] := colYellow;
>       end;
>    end;
> 
>    TempIntfImg.CreateBitmap( ImgHandle, ImgMaskHandle, false );
>    TempBitmap := TBitmap.Create;
>    TempBitmap.Handle := ImgHandle;
>    TempBitmap.MaskHandle := ImgMaskHandle;
>    Canvas.Draw( 25, 25, TempBitmap );
>    bitmap.free;
>    TempIntfImg.Free;
>    TempBitmap.Free;
> end;
> 
> If I run this procedure, the bitmap is displayed in yellow. Great
> success. But if I change the marked line to:
> 
>    TempIntfImg.Colors[w,h] := CurColor;
> 
> all I see is a black bitmap, no matter what I code for the Red / Green /
> Blue values. 

Red/Green/Blue is 0..65535.


> Not to think about the real thing copying the values from
> the video buffer to the bitmap.
> 
> What is going wrong here? I kept to the Lazarus fading example as close
> as I could but I have no clue where to look and what to try.


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to