Recent

Author Topic: BGRABitmap.Resample issue  (Read 3866 times)

codewar65

  • New Member
  • *
  • Posts: 13
BGRABitmap.Resample issue
« on: September 10, 2017, 06:05:03 am »
I am working on a project that runs flawlessly so far (knock wood) in Windows, however the Linux compile is having an issue when scaling BGRABitmaps.

Is there anything special I should know about cross platform BGRABitmap usage? Scanline direction, RGB ordering, etc?

Thanks,
Dan

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRABitmap.Resample issue
« Reply #1 on: September 10, 2017, 10:09:51 am »
I am not sure what the problem is. Is it that instead of a character a fill rectangle is displayed ?

That can be related to the opacity. But I am not sure how you display the characters. Basically it is recommended to have an opaque image that you draw on the window. You can use a temporary bitmap or virtual screen for that.
Conscience is the debugger of the mind

codewar65

  • New Member
  • *
  • Posts: 13
Re: BGRABitmap.Resample issue
« Reply #2 on: September 10, 2017, 10:03:43 pm »
I am not sure what the problem is. Is it that instead of a character a fill rectangle is displayed ?

That can be related to the opacity. But I am not sure how you display the characters. Basically it is recommended to have an opaque image that you draw on the window. You can use a temporary bitmap or virtual screen for that.

Yup. The characters are built from a unicode bitmap font I have in the program. There are actually many fonts that can be used. I generate a cell (8x16) bitmap based on foreground color, background color, and other character attributes (italics, underline, bold, etc). There is no opaque involved. Most of the scaling is powers of two (x2 size, x4 size, x8 size etc). For these I use simplestretch. When the scaling goes down below 1 (1/2, 1/4, 1/8), I use rfMitchell. Sometimes it's the character cell that gets scaled (for individual character displays) or it's the entire document image (when zoomed in/out or in the preview window).

Everything displays great in Linux when no scaling is performed (see document which is @ 1:1, and the FKey drawing characters along the status bar). I am calling resample somehow differently under Linux it would appear.

I will have my Linux porter see if he can make some headway.

Thanks for the reply!
Dan

codewar65

  • New Member
  • *
  • Posts: 13
Re: BGRABitmap.Resample issue
« Reply #3 on: September 17, 2017, 06:10:11 am »
I found my problem..

I was calling TBitmap.Draw(canvas, ....  (which apparently doesn't work) instead of TCanvas.Draw(x,y,TBGRABitmap.Bitmap) / TCanvas.StretchDraw(...

Anyway, thanks for trying to help this n00b. :)

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRABitmap.Resample issue
« Reply #4 on: September 18, 2017, 08:20:21 am »
Happy you found a fix.

In fact the recommended method is TBGRABitmap.Draw.
http://wiki.freepascal.org/BGRABitmap_tutorial_2

Regards
Conscience is the debugger of the mind

codewar65

  • New Member
  • *
  • Posts: 13
Re: BGRABitmap.Resample issue
« Reply #5 on: September 18, 2017, 07:59:52 pm »
Happy you found a fix.

In fact the recommended method is TBGRABitmap.Draw.
http://wiki.freepascal.org/BGRABitmap_tutorial_2

Regards

I couldn't get TBGRABitmap.Draw to work properly in Linux. It does work correctly in Windows for me however. Going to TCanvas.Draw(x,y,TBGRABitmap.Bitmap) works for me on both platforms. Something to look into I suppose.

Peace,
Dan

 

TinyPortal © 2005-2018