Recent

Author Topic: BGRAVirtualScreen - AutoScale even specifically disabled  (Read 1226 times)

backprop

  • Jr. Member
  • **
  • Posts: 93
BGRAVirtualScreen - AutoScale even specifically disabled
« on: August 09, 2024, 07:03:01 pm »
In application, I specifically disabled  BitmapAutoScale:

Code: Pascal  [Select][+][-]
  1. BGRAVirtualScreen1.BitmapAutoScale := False;
  2.  

I have also tried to disable it in IDE, but result is the same - always doing autoscale.

- Drop BGRAVirtualScreen on new project form, change in IDE BitmapAutoScale or disable it inside FormCreate event.
- Enlarge size of the component to approx size of the form
- Assign small image (approx 320x200) in OnRedraw event

The image will anyway be automatically scaled.

Linux KDE.




« Last Edit: August 09, 2024, 07:22:32 pm by backprop »

circular

  • Hero Member
  • *****
  • Posts: 4350
    • Personal webpage
Re: BGRAVirtualScreen - AutoScale even specifically disabled
« Reply #1 on: August 11, 2024, 08:31:50 am »
Hi backprop,

BitmapAutoscale is about scaling the bitmap depending on the canvas scale factor. On MacOS, the components have integer coordinates, but this does not correspond to pixels. So a scaling can be necessary.

BGRAVirtualScreen always covers all its surface. If you would like to have a smaller image, you can draw it on the bitmap of the virtual screen. The Bitmap parameter of the OnRedraw event is like the canvas you would use on a regular component.

Regards
Conscience is the debugger of the mind

backprop

  • Jr. Member
  • **
  • Posts: 93
Re: BGRAVirtualScreen - AutoScale even specifically disabled
« Reply #2 on: August 11, 2024, 10:59:43 am »
Hi,

Then I misunderstand BitmapAutoScale property.

circular

  • Hero Member
  • *****
  • Posts: 4350
    • Personal webpage
Re: BGRAVirtualScreen - AutoScale even specifically disabled
« Reply #3 on: August 12, 2024, 10:58:39 am »
I suppose you would like to have a component like TImage but with BGRABitmap? This component wouldn't be too complicated to make.
Conscience is the debugger of the mind

backprop

  • Jr. Member
  • **
  • Posts: 93
Re: BGRAVirtualScreen - AutoScale even specifically disabled
« Reply #4 on: August 12, 2024, 03:57:24 pm »
I actually want to mimic such behavior with very large images (e.g. 4K), including zooming and scrolling.  Basically, I need very simple image editor / viewer. Thus constant scaling part of the image is not desirable behavior.

For now, to work as intended, I need to set size of the bitmap exactly as is size of the BGRAVirtualScreen and copy pre-processed part of the image with desired scaling.

If it is 100% match of the size, it still doing some pre-modifications on the image? If yes, that will not be desirable. Image must be 100% equal to original if it is 1:1 and custom resampled if it is zoomed in or out. Basically, very limited IDE similar to GIMP.

Since it should work on very large images, it need to be very, very fast.
« Last Edit: August 12, 2024, 04:13:15 pm by backprop »

circular

  • Hero Member
  • *****
  • Posts: 4350
    • Personal webpage
Re: BGRAVirtualScreen - AutoScale even specifically disabled
« Reply #5 on: August 13, 2024, 08:50:48 am »
Ah ok, that would be more advanced than TImage. If you would like to zoom and scroll the image, you may draw it directly on the bitmap of BGRAVirtualScreen in the OnRedraw event, for example by calling StretchPutImage with the adequate theoretical coordinates or PutImageAffine with the adequate matrix.

About the autoscaling, the idea is that you can choose between two modes. If you want to have the full resolution on MacOS, you will need to turn this feature off. However if you do that, you need to be aware that even if on the form, the control has for example a width of 320, if the screen is scaled by a factor of 2 in the system option, then in fact, the resolution is 640 pixels.

If you would like to have the full resolution on MacOS, I recommend you test your program on this system, because this is not trivial. For example, mouse events would need also to be scaled. BitmapAutoScale property is here to make it easier for you, if you don't have the time or resources to customize your application for MacOS.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018