Recent

Author Topic: BGRABitmap.Draw on TBitmap: Windows error - gtk2 okay  (Read 783 times)

winni

  • Hero Member
  • *****
  • Posts: 1437
BGRABitmap.Draw on TBitmap: Windows error - gtk2 okay
« on: December 08, 2019, 11:33:56 pm »
Hi!

I have just detected that a part of my code with BGRA works fine with Linux/gtk2 but not with Windows 7.

A BGRABitmap.draw on a BitBtn.Glyph.canvas do not work in Win: Just a black glyph.

My temp code now looks that way:

Code: Pascal  [Select][+][-]
  1. var bit: TBGRABitmap
  2.       R : Trect;
  3.       BitBtn2 : TBitBtn;
  4. ....
  5.  
  6. {$IFDEF LINUX}
  7. bit.draw(BitBtn2.Glyph.canvas,0,0,true);
  8. {$ELSE}
  9. R := Rect (0,0,wi,hi);
  10. BitBtn2.Glyph.Canvas.CopyRect(R,bit.canvas,R);
  11. {$ENDIF}
  12. Bit.free;    
  13.  

So copyrect works fine in windows.

I don't know where this error is based and for a debug tour through the widget set I do not know enough about it.

 Winni

circular

  • Hero Member
  • *****
  • Posts: 3329
    • Personal webpage
Re: BGRABitmap.Draw on TBitmap: Windows error - gtk2 okay
« Reply #1 on: December 10, 2019, 03:26:14 pm »
That's strange indeed.

Conscience is the debugger of the mind

winni

  • Hero Member
  • *****
  • Posts: 1437
Re: BGRABitmap.Draw on TBitmap: Windows error - gtk2 okay
« Reply #2 on: December 10, 2019, 08:54:33 pm »
@circular

In case of Windows BGRABitmap.draw should call

TBGRAWinBitmap.draw

but it is never executed. Why????

Winni

winni

  • Hero Member
  • *****
  • Posts: 1437
Re: BGRABitmap.Draw on TBitmap: Windows error - gtk2 okay
« Reply #3 on: December 13, 2019, 11:08:35 pm »
@circular

More details to the strange behaviour:

If I set opaque = false in draw then everything is fine!
It leads to BgraWinBitmap.draw --> Canvas.StretchDraw

If I set opaque = true everything is black!
It leads to BgraWinBitmap.draw --> StretchDIBits --> external 'gdi32'

So you can blame gdi32 ......

Wrong  call from my 64bit system???

Winni


circular

  • Hero Member
  • *****
  • Posts: 3329
    • Personal webpage
Re: BGRABitmap.Draw on TBitmap: Windows error - gtk2 okay
« Reply #4 on: December 14, 2019, 10:32:34 am »
Hmmm does it make a difference if you compile in 32 bits ?
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018