Recent

Author Topic: [SOLVED] BGRAVirtualScreen - Set Image Size  (Read 1108 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1260
[SOLVED] BGRAVirtualScreen - Set Image Size
« on: July 13, 2019, 06:47:04 pm »
Hi,

Getting an image on the BGRAVirtualScreen works fine.

However, I want to resize the BGRAVirtualScreen's width and height to match the actual image size so i can just place in a scrollbox to have an easy working scrollbar.

Zooming would be nice too if you can point me to some good example docs/code.

Thanks
« Last Edit: July 13, 2019, 08:17:17 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: BGRAVirtualScreen - Set Image Size
« Reply #1 on: July 13, 2019, 08:17:00 pm »
Figured it out.

Code: Pascal  [Select][+][-]
  1. gif:= TBGRAAnimatedGif.Create(fName);
  2. BGRAVirtualScreen1.width:=gif.width;
  3. BGRAVirtualScreen1.height:=gif.height;


I was confused by the face that the intellisense didn't display any methods.
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: [SOLVED] BGRAVirtualScreen - Set Image Size
« Reply #2 on: July 13, 2019, 10:50:43 pm »
Zooming an image is like taking a rectangle of the source image and scaling it up, then displaying it on the BGRAVirtualScreen.

You can see how it's done in LazPaint, but his source code is very big.

Is not so easy, but is not that hard, you can try yourself to code one zooming function.

I did one for a level editor, included in BGRAGames, for example, there you have another source code, this one I think is a lot smaller than LazPaint, but his domain is not images but sprite maps.

 

TinyPortal © 2005-2018