Recent

Author Topic: Zoom in, zoom out and rotate images  (Read 3791 times)

rc.1990

  • Jr. Member
  • **
  • Posts: 54
Zoom in, zoom out and rotate images
« on: September 27, 2016, 06:10:39 pm »
I am using Lazarus 1.6.0 and FPC 3.0.0.

How can I zoom in, zoom out and rotate images using a TImage component?

Handoko

  • Hero Member
  • *****
  • Posts: 3757
  • My goal: build my own game engine using Lazarus
Re: Zoom in, zoom out and rotate images
« Reply #1 on: September 27, 2016, 07:20:29 pm »
I think you should not use TImage, it's only the very basic image component to show image on the form. Also it is very slow and can cause flicker if you update the content frequently.

More info on TImage:
http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/timage.html
http://wiki.freepascal.org/Developing_with_Graphics#Draw_to_a_TImage

A list of 'better' image manipulation options can be found here:
http://wiki.freepascal.org/Developing_with_Graphics#2D_drawing

I recommend you to use BGRABitmap, which has a lot of features, tutorials and better support from the developer in this forum:
http://wiki.freepascal.org/BGRABitmap_tutorial
http://forum.lazarus.freepascal.org/index.php/board,46.0.html

You may interested to see BGRABitmap tutorial #10, it shows how to rotate texture:
http://wiki.freepascal.org/BGRABitmap_tutorial_10
« Last Edit: September 27, 2016, 07:23:39 pm by Handoko »

circular

  • Hero Member
  • *****
  • Posts: 3440
    • Personal webpage
Re: Zoom in, zoom out and rotate images
« Reply #2 on: September 27, 2016, 11:42:23 pm »
Yes, and if you want to rotate an image, you can use a TBGRAVirtualScreen and in the redraw event use PutImageAngle (rotation) or Bitmap.PutImageAffine (any affine transformation, so you can zoom and rotate).
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018