Menu

#28 Error: (5038) identifier idents no member "Init_BPP32_R8G8B8_BIO_TTB"

Current version
closed
nobody
None
1
2019-04-25
2015-09-10
Anonymous
No

When compiling bgrabitmap 8.7 with qt4 support (--widgetset=qt argument to lazbuild) it causes following error:

/tmp/lazpaint-qt4/src/bgrabitmap8.7/bgraqtbitmap.pas(110,26) Error: (5038) identifier idents no member "Init_BPP32_R8G8B8_BIO_TTB"

$ lazbuild --version
1.4.2
$ fpc
Free Pascal Compiler version 2.6.4 [2014/03/12] for x86_64

Discussion

  • Anonymous

    Anonymous - 2015-11-13

    Apparently something like this patch works:

    diff --git a/bgraqtbitmap.pas b/bgraqtbitmap.pas
    index c232c8d..39cb0f9 100644
    --- a/bgraqtbitmap.pas
    +++ b/bgraqtbitmap.pas
    @@ -107,9 +107,9 @@ begin
    
       RawImage.Init;
       if TBGRAPixel_RGBAOrder then
    
    -    RawImage.Description.Init_BPP32_R8G8B8_BIO_TTB(AWidth, AHeight)
    +    RawImage.Description.Init_BPP32_R8G8B8A8_BIO_TTB(AWidth, AHeight)
       else
    -    RawImage.Description.Init_BPP32_B8G8R8_BIO_TTB(AWidth, AHeight);
    +    RawImage.Description.Init_BPP32_B8G8R8A8_BIO_TTB(AWidth, AHeight);
       RawImage.Description.LineOrder := ALineOrder;
       RawImage.Description.LineEnd := rileDWordBoundary;
       RawImage.Data     := PByte(AData);
    
     
  • Fabio Luis Girardi

    The same patch, but stored in a file.

    My environment is FPC 3.1.1 + Laz 1.7 Linux 64

     
  • circular

    circular - 2016-04-28

    Thanks for the patch. However I don't think I can apply as it is. Indeed if the alpha value is not set to 255, as a result a transparent image would be drawn. However this function is suppose to draw an opaque image.

     
  • user01

    user01 - 2016-08-01

    Went into same problem. It won't compile against qt. Lazarus trunk still have no function BPP32_R8G8B8_BIO_TTB at the moment.

    Not good with graphic stuff, but was thinking. Does 32 bit means additional bits for alpha value? What about 24 bit? Does it mean it's always have alpha set to 255? Or am i understanding it wrong? There is a function Init_BPP24_R8G8B8_BIO_TTB.

     
  • user01

    user01 - 2016-08-01

    Ended up with different thing

    In uscaledpi

      for i := 0 to high(TempBGRA) do
      begin
        {$IFDEF Windows}
        If TBGRAPixel_RGBAOrder then TempBGRA[i].SwapRedBlue;
        {$ENDIF}
        TargetList.Add(TempBGRA[i].Bitmap,nil);
        TempBGRA[i].Free;
      end;  
    

    to

      for i := 0 to high(TempBGRA) do
      begin
        {$IFDEF LCLWin32}
        If TBGRAPixel_RGBAOrder then TempBGRA[i].SwapRedBlue;
        {$ENDIF}
        TargetList.Add(TempBGRA[i].Bitmap,nil);
        TempBGRA[i].Free;
      end;  
    
     
  • circular

    circular - 2016-08-01

    Ok applied change to uscaledpi.

    Regarding DataDrawOpaque function, would it work to just remove the function DataDrawOpaque from BGRAQtBitmap unit? Indeed the function is already defined in the base class to use RGB/BGR format.

     
  • Fabio Luis Girardi

    I think that isn't a BGRABitmap bug, but a Lazarus QT bug? I reported this thinking that TRawImage is a BGRABitmap class, instead it is a Lazarus class.

     

    Last edit: Fabio Luis Girardi 2016-08-01
  • circular

    circular - 2016-08-01

    It is not really a bug of TRawImage in the sense that it is not necessarily providing all possible initialisers. We could instead initialise manually with the adequate values. But before trying that, can you try to remove the DataDrawOpaque function, it is just an override, so the base class function will be used instead, and it may work just fine. To check it, just draw a TBGRABitmap on a canvas using the TBGRABitmap.Draw function with the Opaque parameter set to True. It would be helpful for me if you could try it.

     
  • Fabio Luis Girardi

    I'll do that.

     
  • Fabio Luis Girardi

    Something like this? Testing it and everything appears to be ok

     
  • user01

    user01 - 2016-08-01

    It wasn't all. Looks like it went to compile using precompiled unit 24bit function. With clean compile got error again. So changed if to ifdef

      if TBGRAPixel_RGBAOrder then
        RawImage.Description.Init_BPP32_R8G8B8_BIO_TTB(AWidth, AHeight)
      else
        RawImage.Description.Init_BPP32_B8G8R8_BIO_TTB(AWidth, AHeight);
    

    to

      {$IFDEF BGRABITMAP_RGBAPIXEL}
       RawImage.Description.Init_BPP32_R8G8B8_BIO_TTB(AWidth, AHeight)
      {$Else}
       RawImage.Description.Init_BPP32_B8G8R8_BIO_TTB(AWidth, AHeight);
      {$EndIf}   
    

    {$IFDEF LCLWin32} still should be there in uscaledpi

    clean compiled several times against win32, gtk2 and qt4. went without a hitch.
    http://i.imgur.com/d9vKFqC.gif

     
  • user01

    user01 - 2016-08-01

    further talking about uscaledpi i might suggest this

    {$IFDEF LCL qt}
      Font.Size := 0;
    {$ELSE}
      Font.Height := ScaleY(Font.GetTextHeight('Hg'),FromDPI);
    {$ENDIF}
    

    to

    if Font.Height < 0 then
      Font.Height := ScaleY(Font.Height,FromDPI);
    

    seem to work on win32, qt and gtk2 on windows.

    GetTextHeight('Hg') seem resets size to default or doing something similar. so if an app has some label with big text it will be resized to small size.

    http://i.imgur.com/RvbaRZb.gif

     

    Last edit: user01 2016-08-01
  • circular

    circular - 2016-08-02

    @fabio: for now I have removed on Git the function in BGRAQtBitmap.

    If we change the function in BGRALCLBitmap with the following, would that still work?

    Here is a test program to check speed:
    http://forum.lazarus.freepascal.org/index.php?action=dlattach;topic=33530.0;attach=16095

    procedure DataDrawOpaqueImplementation(ACanvas: TCanvas; Rect: TRect;
      AData: Pointer; ALineOrder: TRawImageLineOrder; AWidth, AHeight: integer);
    var
      Temp:      TBitmap;
      RawImage:  TRawImage;
      BitmapHandle, MaskHandle: HBitmap;
      CreateResult: boolean;
      tempShift: byte;
    begin
      if (AHeight = 0) or (AWidth = 0) then
        exit;
    
      RawImage.Init;
      RawImage.Description.Init_BPP32_B8G8R8_BIO_TTB(AWidth,AHeight);
      RawImage.Description.LineOrder := ALineOrder;
      RawImage.Description.LineEnd := rileDWordBoundary;
      RawImage.Data := PByte(AData);
      RawImage.DataSize:= AWidth*AHeight*sizeof(TBGRAPixel);
      if TBGRAPixel_RGBAOrder then
      begin
        tempShift := RawImage.Description.RedShift;
        RawImage.Description.RedShift := RawImage.Description.BlueShift;
        RawImage.Description.BlueShift := tempShift;
      end;
      CreateResult := RawImage_CreateBitmaps(RawImage, BitmapHandle, MaskHandle, False);
    
      if not CreateResult then
        raise FPImageException.Create('Failed to create bitmap handle');
    
      Temp := TBitmap.Create;
      Temp.Handle := BitmapHandle;
      Temp.MaskHandle := MaskHandle;
      ACanvas.StretchDraw(Rect, Temp);
      Temp.Free;
    end;       
    
     
  • Fabio Luis Girardi

    The test is returning a number between 10-20ms/100 shapes? Is a bad number?

     
  • circular

    circular - 2016-08-02

    10-20 ms is ok. I guess we can validate the change.

     
  • Fabio Luis Girardi

    11-12ms / 100 shapes with -O4, without debugging symbols and running outside lazarus

     
  • circular

    circular - 2016-08-02

    Thanks very much. That seems wonderful to me.

     
  • circular

    circular - 2018-07-08
    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB