Recent

Author Topic: SVG, graphics 32  (Read 10184 times)

huberte

  • Jr. Member
  • **
  • Posts: 78
SVG, graphics 32
« on: April 27, 2012, 06:00:16 am »
Quote
Quote
from: huberte on April 25, 2012, 08:37:43 am
Hello, meandrix, would it be possible to explain how you did this ? :
http://wiki.lazarus.freepascal.org/File:vpr-android.png

thanks (maybe I have to post on the forum ? )

It's okay, but I'll post my reply to the public fpc4android thread, in case anyone else is curious.

I'm basically using the VirtualBox image that is found on the following page (I tried to set it up in Windows initially, but eventually I realized it was easier to just go with the VB image):
http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android



I'm using Graphics32 together with the new GR32_Backends_LCL_CustomDrawn backend (it will be used automatically if you compile with the CustomDrawn widget set:
http://www.graphics32.org

How ? Do I need to put this library in androidlcl.lpi and then compile ?

Quote
I'm using a slightly updated version of VPR and a rather light-weight SVG renderer that I have not published (because I'm working on a more advanced version):
http://vpr.sourceforge.net

Lost
Quote
However, since I've made modifications to VPR that are not checked in, I would suggest that you wait with trying to use the current head revision. VPR will be natively included in Graphics32 in the next major release (the release after the 1.9.1. update.) Then it should be much easier to use it on Android.

Could you be a little bit more specific ?

Can I build an app with a image.svg in it, and how (with a little bit details please :()

thks

lainz

  • Guest
Re: SVG, graphics 32
« Reply #1 on: April 27, 2012, 04:03:24 pm »
seems that vpr is a nice renderer

huberte

  • Jr. Member
  • **
  • Posts: 78
Re: SVG, graphics 32
« Reply #2 on: April 27, 2012, 07:14:07 pm »
how to render ?

meanderix

  • Jr. Member
  • **
  • Posts: 50
Re: SVG, graphics 32
« Reply #3 on: April 27, 2012, 11:59:04 pm »
As I said, the SVG renderer has not been published, and I have to check in the changes I made to VPR before you can use it on FPC and Android.

You should be able to use Graphics32 on Android though, since it now includes the CustomDrawn backend class. When VPR is included in Graphics32, it will probably work on Android as well.

However, Graphics32 should be extended with support for BGRA (as opposed to ARGB), in order to avoid the overhead of format conversions.

huberte

  • Jr. Member
  • **
  • Posts: 78
Re: SVG, graphics 32
« Reply #4 on: April 28, 2012, 12:18:37 am »
You should be able to use Graphics32 on Android though, since it now includes the CustomDrawn backend class. When VPR is included in Graphics32, it will probably work on Android as well.

sorry but again... How...

meanderix

  • Jr. Member
  • **
  • Posts: 50
Re: SVG, graphics 32
« Reply #5 on: April 28, 2012, 02:05:03 pm »
You should be able to use Graphics32 on Android though, since it now includes the CustomDrawn backend class. When VPR is included in Graphics32, it will probably work on Android as well.

sorry but again... How...
Can you be a bit more specific? What do you want to know?

huberte

  • Jr. Member
  • **
  • Posts: 78
Re: SVG, graphics 32
« Reply #6 on: April 28, 2012, 02:09:47 pm »
Just  the steps on how to build an apk with a svg in it (fo example a form with an image which is a vectorial image ? Is this ok ? )

thks

meanderix

  • Jr. Member
  • **
  • Posts: 50
Re: SVG, graphics 32
« Reply #7 on: April 28, 2012, 06:47:41 pm »
Just  the steps on how to build an apk with a svg in it (fo example a form with an image which is a vectorial image ? Is this ok ? )

I'm using the TPaintBox32 control which is included in Graphics32.

I've added the svg file to a resource script that looks like this:
Code: [Select]
SVGDATA STR tiger.svg
In the lpr file I have {$R svgdata.rc}

My TForm.OnCreate event handler looks like this:
Code: [Select]
procedure TForm1.FormCreate(Sender: TObject);
var
  S: TResourceStream;
begin
  PaintBox.BufferOversize := 0;
  SetGamma(1.65);

  Doc := TSVGDocument.Create;
  S := TResourceStream.Create(HINSTANCE, PChar('SVGDATA'), PChar('STR'));
  try
    Doc.LoadFromStream(S);
  finally
    S.Free;
  end;
end;

I have added a TPaintBox32.OnPaintBuffer event handler that looks like this:
Code: [Select]
procedure TForm1.PaintBoxPaintBuffer(Sender: TObject);
begin
  PaintBox.Buffer.Clear(clWhite32);
  Doc.DrawTo(PaintBox.Buffer, T);
end;

huberte

  • Jr. Member
  • **
  • Posts: 78
Re: SVG, graphics 32
« Reply #8 on: April 28, 2012, 10:00:23 pm »
Thks meanderix. I will try this week end. thks for your patience, but I'm really noob on this. I dont see precisly where I should put those code, saying I start from androidlcl example,

  • I modify nonandroidtest.lpr with {$R svgdata.rc}
  • I add a Tformcreate like you said

Not understood where I should put the tpaintbox32.

thks again

edit : did you read this ?

http://code.google.com/p/svg-android/w/list

EDIT2 :

Installation procedure for Lazarus for grapics32 :

If you got error, you have to go to the repo  here : https://graphics32.svn.sourceforge.net/svnroot/graphics32/trunk/Source/
« Last Edit: May 01, 2012, 03:08:07 pm by huberte »

huberte

  • Jr. Member
  • **
  • Posts: 78
Re: SVG, graphics 32
« Reply #9 on: May 01, 2012, 08:09:57 pm »
Really, it's pretty hard to build this.

First you need the latest SVN, then you need to  install VPr or not ?

"You should be able to use Graphics32 on Android though, since it now includes the CustomDrawn backend class."

But how since I need TSGVDocument ?
« Last Edit: May 01, 2012, 08:42:01 pm by huberte »

 

TinyPortal © 2005-2018