Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: pixelink on July 13, 2019, 06:47:04 pm

Title: [SOLVED] BGRAVirtualScreen - Set Image Size
Post by: pixelink 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
Title: Re: BGRAVirtualScreen - Set Image Size
Post by: pixelink 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.
Title: Re: [SOLVED] BGRAVirtualScreen - Set Image Size
Post by: lainz 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