Recent

Author Topic: jBitmap rotation  (Read 564 times)

neuro

  • Jr. Member
  • **
  • Posts: 94
jBitmap rotation
« on: October 30, 2025, 03:31:21 pm »
File
C:\fpcupdeluxe\ccr\lamw\android_bridges\Laz_And_Controls.pas
contains functions
Code: Pascal  [Select][+][-]
  1. function jBitmap.ClockWise(_bmp: jObject): jObject;
  2. function jBitmap.AntiClockWise(_bmp: jObject): jObject;

There are no examples showing how to use these functions.
I have tried many variants but none of them work, jBitmap does not rotate.
Please write sample program code which shows how to use these functions.

Ally

  • Jr. Member
  • **
  • Posts: 80

neuro

  • Jr. Member
  • **
  • Posts: 94
Re: jBitmap rotation
« Reply #2 on: October 30, 2025, 05:41:51 pm »
https://forum.lazarus.freepascal.org/index.php/topic,70654.msg550977.html#msg550977

This code is not suitable for Android.
Unfortunately Android uses jBitmap instead of TCustomBitmap.
We need sample program code for jBitmap rotation.

neuro

  • Jr. Member
  • **
  • Posts: 94
Re: jBitmap rotation
« Reply #3 on: October 31, 2025, 01:05:53 am »
I have found out how to use function “AntiClockWise” (which rotates jBitmap by 90 degrees), the sample program code is the following:
Code: Pascal  [Select][+][-]
  1. jBitmapRotated.SetImage(jBitmap1.AntiClockWise(jBitmapOriginal.GetImage()));

I have updated LAMW by writing 3 new functions for jBitmap: Rotate, FlipHorizontal, FlipVertical.
“Rotate” function rotates jBitmap by any angle.

The sample program code us usage is the following:
Code: Pascal  [Select][+][-]
  1. jBitmapRotated.SetImage(jBitmap1.Rotate(jBitmapOriginal.GetImage(), Single(rotation_angle)));
  2. jBitmapFlipped.SetImage(jBitmap1.FlipHorizontal(jBitmapRotated.GetImage()));
  3. jBitmapFlipped.SetImage(jBitmap1.FlipVertical(jBitmapRotated.GetImage()));

In github I have created pull requests for “lazandroidmodulewizard” project of jmpessoa.
jmpessoa, please confirm pull requests for github updates.

Newly added jBitmap rotation functions are located in updated LAMW files:
Quote
C:\fpcupdeluxe\ccr\lamw\android_wizard\smartdesigner\java\jBitmap.java
C:\fpcupdeluxe\ccr\lamw\android_bridges\Laz_And_Controls.pas
C:\fpcupdeluxe\ccr\lamw\android_bridges\androidwidget.pas
« Last Edit: November 03, 2025, 09:20:21 pm by neuro »

neuro

  • Jr. Member
  • **
  • Posts: 94
Re: jBitmap rotation
« Reply #4 on: November 11, 2025, 10:01:43 pm »
I have used jBitmap rotation in free open-source game “Kwazy Quilt Puzzle No. 7114”.

It is available at Google Play at the address:
https://play.google.com/store/apps/details?id=com.cognaxon.KwazyQuiltPuzzleNo7114

Source code is available at the address:
https://games.cognaxon.com/?page=kwazy_quilt_puzzle_no_7114

 

TinyPortal © 2005-2018