Recent

Author Topic: Using BGRABitmap in Android  (Read 9992 times)

stab

  • Full Member
  • ***
  • Posts: 234
Using BGRABitmap in Android
« on: November 29, 2012, 11:45:14 pm »
Hi,

Managed to use BGRABitmap in an Android-app but was forced to uncomment all of
perspectivescan2.inc. It was arguing about:
perspectivescan2.inc(1,2) Error: Illegal assembler style specified "INTEL"

I only used scanline property but was impressed to be able to display a map in a custom format.

Thanks alot for a good job!

Regards
stab :D

lainz

  • Guest
Re: Using BGRABitmap in Android
« Reply #1 on: November 30, 2012, 12:05:42 am »
Oh really it works on Android? Amazing. When circular check this maybe he can help you. Or try to contact him by messages.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Using BGRABitmap in Android
« Reply #2 on: November 30, 2012, 04:00:13 am »
Quote
perspectivescan2.inc(1,2) Error: Illegal assembler style specified "INTEL"
Intel style assembler is only recognized on x86, other arch (ARM I guess in your case) should have uniform style.

circular

  • Hero Member
  • *****
  • Posts: 4224
    • Personal webpage
Re: Using BGRABitmap in Android
« Reply #3 on: December 02, 2012, 08:03:37 pm »
Oh I think I know what is missing : {$IFDEF CPUI386}
Conscience is the debugger of the mind

fredycc

  • Sr. Member
  • ****
  • Posts: 264
Re: Using BGRABitmap in Android
« Reply #4 on: December 03, 2012, 01:25:55 am »

perspectivescan2.inc(1,2) Error: Illegal assembler style specified "INTEL"


The same message is displayed when I try to compile for ARM platform in my case raspbian(raspberry pi).

circular, any tip?. I would appreciate your support.

thanks


circular

  • Hero Member
  • *****
  • Posts: 4224
    • Personal webpage
Re: Using BGRABitmap in Android
« Reply #5 on: December 05, 2012, 10:17:45 am »
Didn't you see my previous message ?

Try this code for the first line :
Code: [Select]
{$ifdef CPUI386]{$asmmode intel}{$endif}
Conscience is the debugger of the mind

stab

  • Full Member
  • ***
  • Posts: 234
Re: Using BGRABitmap in Android
« Reply #6 on: December 07, 2012, 11:02:26 am »
Sorry didn't see your last post until now.
Changed according to your suggestion and NO errors any more

Thanks
stab :D

circular

  • Hero Member
  • *****
  • Posts: 4224
    • Personal webpage
Re: Using BGRABitmap in Android
« Reply #7 on: December 07, 2012, 01:04:39 pm »
Ok. Fine. I've updated on subversion.  :)
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4224
    • Personal webpage
Re: Using BGRABitmap in Android
« Reply #8 on: December 07, 2012, 01:11:07 pm »
By the way, stab or someelse using android, if you come up with some optimisations, like those for Windows or Linux, you can post it here.

Just out of curiosity, what do you mean by displaying a map in custom format, that you mention in your first post?
Conscience is the debugger of the mind

stab

  • Full Member
  • ***
  • Posts: 234
Re: Using BGRABitmap in Android
« Reply #9 on: December 08, 2012, 04:51:31 pm »
Hi again,

I'm working in a goverment corporation in gis (formerly a part of the Land Survey of Sweden) and have written an object-code that is handling a custom format for maps. Want to be able to use this in android app as part in a system for customers. The custom format is built up from small z-lib compressed map-blocks and a 256 color palette. I use TBGRABitmap to fill scanline data like in the code below:

        row := 0;
        while row < FInfo.BlockSizeNorth do
        begin
          if FInfo.ZLibPackad then
            p := BGRABitmap.ScanLine[(row - StartRow + 1) * FInfo.BlockSizeNorth - 1 - row]
          else
            p := BGRABitmap.ScanLine[row * FInfo.BlockSizeNorth + row];

          p := p + (col - StartCol) * FInfo.BlockSizeEast;

          col := 0;
          while kol < FInfo.BlockSizeEast do
          begin
            index := FBlockData[col + row * FInfo.BlockSizeNorth];

            try
              p^.red:=FInfo.Palette[index].Red;
              p^.green:=FInfo.Palette[index].Green;
              p^.blue:=FInfo.Palette[index].Blue;
              p^.alpha:=255;
            except
              on E:Exception do
                MessageDlg(E.Message, mtError, [mbOK], 0);
            end;

            Inc(p);

            Inc(col);
          end;

          Inc(row);
        end;

        BGRABitmap.InvalidateBitmap;

To display in a TImage on android screen I use:

    lazImage.SetSize(BGRABitmap.Width,BGRABitmap.Height);
    lazImage.Assign(BGRABitmap);
    Image1.Picture.Bitmap.LoadFromIntfImage(lazImage);

Could this be still optimized?
Could one in some way skip the step with lazImage? %)

/stab





Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Using BGRABitmap in Android
« Reply #10 on: December 08, 2012, 05:05:11 pm »
I'm working in a goverment corporation in gis (formerly a part of the Land Survey of Sweden) and have written an object-code that is handling a custom format for maps.

Just curious, but have you considered using a mobile GIS to display the maps instead of doing it yourself?

Thanks.

-Phil

circular

  • Hero Member
  • *****
  • Posts: 4224
    • Personal webpage
Re: Using BGRABitmap in Android
« Reply #11 on: December 10, 2012, 07:06:54 pm »
Hi again,

I'm working in a goverment corporation in gis (formerly a part of the Land Survey of Sweden) and have written an object-code that is handling a custom format for maps. Want to be able to use this in android app as part in a system for customers.
Ok now I understand what you mean by map.

Quote
          if FInfo.ZLibPackad then
            p := BGRABitmap.ScanLine[(row - StartRow + 1) * FInfo.BlockSizeNorth - 1 - row]
          else
            p := BGRABitmap.ScanLine[row * FInfo.BlockSizeNorth + row];
I don't understand the formula you're using. For example, in the second case, p gets the address of the line number row * (BlockSizeNorth+1). Does it mean that the code afterwards fills BlockSizeNorth+1 lines ?

Quote
          p := p + (col - StartCol) * FInfo.BlockSizeEast;

          col := 0;
Not sure about the initialization of col. It looks like it's always equal to BlockSizeEast.

Quote
          while kol < FInfo.BlockSizeEast do
Is it 'col' instead of 'kol' ?

Quote
To display in a TImage on android screen I use:

    lazImage.SetSize(BGRABitmap.Width,BGRABitmap.Height);
    lazImage.Assign(BGRABitmap);
    Image1.Picture.Bitmap.LoadFromIntfImage(lazImage);

Could this be still optimized?
Well, maybe you can use a TPaintBox, and in the OnPaint event do :
Code: [Select]
  BGRABitmap.Draw(PaintBox1.Canvas,0,0);
(which means you need to keep BGRABitmap variable available)
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4473
    • https://lainz.github.io/
Re: Using BGRABitmap in Android
« Reply #12 on: October 13, 2014, 05:15:18 pm »
I know this is an old post, someone else has run BGRABitmap on Android?

There is some example application / tutorial how to achieve that?

neuro

  • Jr. Member
  • **
  • Posts: 62
Re: Using BGRABitmap in Android
« Reply #13 on: March 10, 2022, 01:22:54 am »
Please read:
https://forum.lazarus.freepascal.org/index.php/topic,58624.0.html
BGRABitmap for Android demo provides fast pixel access for jBitmap

It contains attachment “AppBGRABitmapDemo1.zip”.

 

TinyPortal © 2005-2018