Recent

Author Topic: Zooming and Panning in a TImage.  (Read 468 times)

OC DelGuy

  • Full Member
  • ***
  • Posts: 130
Zooming and Panning in a TImage.
« on: November 03, 2024, 05:25:47 pm »
Is there a way to Zoom and Pan around in a TImage?

I have a picture that is larger than the screen and TImage just shows the top left of the pic.
Free Pascal Lazarus Version #: 2.2.4
Date: 24 SEP 2022
FPC Version: 3.2.2
Revision: Lazarus_2_2_4
x86_64-win64-win32/win64

cdbc

  • Hero Member
  • *****
  • Posts: 1644
    • http://www.cdbc.dk
Re: Zooming and Panning in a TImage.
« Reply #1 on: November 03, 2024, 05:33:01 pm »
Hi
Have a look at 'BGRABitmap' it's available in OPM.
This framework & components will make your life a lot easier, when it comes to graphics in fpc/laz
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

OC DelGuy

  • Full Member
  • ***
  • Posts: 130
Re: Zooming and Panning in a TImage.
« Reply #2 on: November 05, 2024, 05:11:04 am »
Hi
Have a look at 'BGRABitmap' it's available in OPM.
This framework & components will make your life a lot easier, when it comes to graphics in fpc/laz
Regards Benny

I have that.  :D  I used the BGRA Controls: TDTAnalogClock, TBGRAKnob, TDTAnalogGauge in a previous application I wrote.  But I don't see an Image Control.  Am I missing something?

Also, Is there something like a textbook available online for BGRA for free?  I don't have much money and the little I have mostly goes to bills.  I tried using the TDTAnalogClock, but all I can get it to do is display the system time.  Is there a way to use it as a timer or stopwatch?
Free Pascal Lazarus Version #: 2.2.4
Date: 24 SEP 2022
FPC Version: 3.2.2
Revision: Lazarus_2_2_4
x86_64-win64-win32/win64

TRon

  • Hero Member
  • *****
  • Posts: 3618
Re: Zooming and Panning in a TImage.
« Reply #3 on: November 05, 2024, 05:32:25 am »
But I don't see an Image Control.  Am I missing something?
Dunno, but there isn't an image control so perhaps that complicates matters ?

Depending on the use-case there is TBGRAGraphicControl and TBGRAVirtualScreen but besides that you can use TBGRABitmap (in code) and draw it to any canvas.

Quote
Also, Is there something like a textbook available online for BGRA for free?
Not that I am aware of (but I haven't  looked very hard either).

There are tutorials on the wiki for TBGRABitmap and BGRABitmap also has it's own website here. Searching through the forums might perhaps also be use/helpful.

BTW: ATImageBox (OPM) seems able to pan and zoom images.
« Last Edit: November 05, 2024, 06:22:39 am by TRon »
This tagline is powered by AI

cdbc

  • Hero Member
  • *****
  • Posts: 1644
    • http://www.cdbc.dk
Re: Zooming and Panning in a TImage.
« Reply #4 on: November 05, 2024, 07:27:43 am »
Hi
I think you should keep an eye out for the wiki and their website.
Another possibility is to ask your questions here in the forum and maybe dedicate it to @circular (He is the owner/author of BGRABitmat), or to @lainz(He oversees the BGRAControls), or search for entries by @gigatron(He's made some really cool stuff with BGRAVirtualScreen amo.)
I, for one, know that to zoom, you use the method 'TBGRABitmap.Getpart(aRect: TRect)'...
Regards Benny

eta: Have a look at the source for 'LazPaint' it's on github, it knows how to do the stuff you ask for... That app is the *Showroom* for BGRA.
« Last Edit: November 05, 2024, 07:32:27 am by cdbc »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

 

TinyPortal © 2005-2018