Recent

Author Topic: Change BGRABitmap size at runtime?  (Read 3122 times)

RWC

  • Jr. Member
  • **
  • Posts: 92
Change BGRABitmap size at runtime?
« on: August 16, 2016, 05:17:18 pm »
I’ve now modified my pseudo3d landscape to accept different screen sizes. If the User changes or maximises the window size at run time, I want the BGRABitmap screen buffer to be that new size.
Should I change it dynamically like an array?
Or should I Free it first & create a new size?

Currently the screen is preset at design time to 1024x576 pixels (16:9) - see attached example.
LAZARUS  : Lazarus-1.4.2-fpc-2.6.4-win32. OS   : Windows Vista 32bit Home Premium SP2.
CPU  : Intel Core2 Quad CPU Q6600 2.4GHz. RAM : 3GB. PCIE : NVIDIA GeForce GT610. Audo : NVIDIA HD Audio.

lainz

  • Hero Member
  • *****
  • Posts: 3699
  • Leandro Diaz
Re: Change BGRABitmap size at runtime?
« Reply #1 on: August 16, 2016, 05:51:52 pm »
Try the SetSize method. Something like this:

Code: Pascal  [Select][+][-]
  1.   if (Width <> FBGRA.Width) or (Height <> FBGRA.Height) then
  2.     FBGRA.SetSize(Width, Height);

RWC

  • Jr. Member
  • **
  • Posts: 92
Re: Change BGRABitmap size at runtime?
« Reply #2 on: August 16, 2016, 09:34:39 pm »
@lainz: SetSize works brilliantly (with ClientWidth, ClientHeight) and so simple! Here was I worrying about the memory blocks etc. Don’t you just love BGRABitmap. I know I do. Now I’ll have to find a bigger sky picture! Thank you lainz, much appreciated.
LAZARUS  : Lazarus-1.4.2-fpc-2.6.4-win32. OS   : Windows Vista 32bit Home Premium SP2.
CPU  : Intel Core2 Quad CPU Q6600 2.4GHz. RAM : 3GB. PCIE : NVIDIA GeForce GT610. Audo : NVIDIA HD Audio.

lainz

  • Hero Member
  • *****
  • Posts: 3699
  • Leandro Diaz
Re: Change BGRABitmap size at runtime?
« Reply #3 on: August 23, 2016, 11:58:00 pm »
@lainz: SetSize works brilliantly (with ClientWidth, ClientHeight) and so simple! Here was I worrying about the memory blocks etc. Don’t you just love BGRABitmap. I know I do. Now I’ll have to find a bigger sky picture! Thank you lainz, much appreciated.

BGRABitmap is just awesome, I can't imagine how hard is to develop with graphics without it.

 

TinyPortal © 2005-2018