Recent

Author Topic: [SOLVED] How to flip image vertically?  (Read 324 times)

artem101

  • Full Member
  • ***
  • Posts: 114
[SOLVED] How to flip image vertically?
« on: November 18, 2025, 06:59:28 pm »
How to flip/mirror bitmap vertically with bgrabitmap?

« Last Edit: November 18, 2025, 07:34:32 pm by artem101 »

Lulu

  • Sr. Member
  • ****
  • Posts: 347
Re: How to flip image vertically?
« Reply #1 on: November 18, 2025, 07:25:40 pm »
hi,
Code: Pascal  [Select][+][-]
  1. MyImage: TBGRABitmap;
  2. ...
  3. MyImage.VerticalFlip;

You have also method HorizontalFlip.
I think they are for this purpose.
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12572
  • FPC developer.
Re: How to flip image vertically?
« Reply #2 on: November 18, 2025, 07:27:16 pm »
In some cases this can be done by zero-op (e.g. with opengl glstorepixel)  instead of drawing (x1,y1) - (x2,y2)  draw  (x1,y2) to (x2,y1);
,

artem101

  • Full Member
  • ***
  • Posts: 114
Re: How to flip image vertically?
« Reply #3 on: November 18, 2025, 07:30:24 pm »
MyImage.VerticalFlip

This is what I need! Thank you.

Lulu

  • Sr. Member
  • ****
  • Posts: 347
Re: How to flip image vertically?
« Reply #4 on: November 18, 2025, 07:47:51 pm »
@artem101
I use Lazarus IDE to code.

To easily find the method name with the IDE code completion,  I've opened a project that use BGRABitmap, in a procedure, I've declared a variable "b" of type TBGRABitmap, and in the procedure body, enter b. ("b" followed by a dot).
After a short delay, Lazarus IDE open a small window with the list of TBGRABitmap method and properties -> Enter Flip -> the IDE show only the method/properties that contain "Flip".
That's how I found the answer.
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

 

TinyPortal © 2005-2018