ABExtDrawing

positrom2

Active Member
Licensed User
Longtime User
Hi,
ABMeter is a very nice example.
But where can I find the documentation of ABExtDrawing library?
For instance, what does save2 do?
Thanks for advice.
 

positrom2

Active Member
Licensed User
Longtime User
Thanks hdtvirl,
but
in the ABMeter example there is
"ExDraw.save2(Canv, ExDraw.MATRIX_SAVE_FLAG)"

On save2() I don't find a reference in the cited documentation
("android.graphics | Android Developers
the documentation is on the google developers site.").

Regards, positrom
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Hi positrom2,

The reason there is a Save2 is because b4a cannot have the same name for two functions. In the documentation there are two Save methods:

int save()
Saves the current matrix and clip onto a private stack.

and

int save(int saveFlags)
Based on saveFlags, can save the current matrix and clip onto a private stack.

In this case Save2 is the second save method.

The same you can see with the DrawBitmap functions. They are just variations on one function.

I know not all the functions are yet documented in the library but I'll try to update them soon.

Cheers,

Alwaysbusy
 
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
Hi alwaysbusy,
thousand thanks for the clarification. That's a valuable addition to b4a, but for a newbie all (and not just this issue) is hard stuff.
Anyway, I will check for updates on the ABExtDrawing docu every day ....

Regards, positrom2
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
Well, I created an Android 4.03 WSVGA emulator and modified the program with designer for the larger screen the program runs every other time -runs once, fails once, etc.
When it does run it turns the ENTIRE DEVICE upside down! That is the graphic is upside down, but so is the Android menu. It goes from the bottom to the top with all icons inverted. When the program is closed the menu returns to the bottom. I had the same results with other emulators and unmodified code.

Using the debugger I have Stopped the program on the first line of Activity_Create. The screen has already been turned upside down. I have several other programs. None of them do this.

Also, the actual pointer on the thermometer is never displayed.

Here is the log when it runs:

START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.ab.abmeter/.main} from pid 176
Failure taking screenshot for (374x230) to layer 21005
Start proc com.ab.abmeter for activity com.ab.abmeter/.main: pid=748 uid=10040 gids={}
Turning on JNI app bug workarounds for target SDK version 4...
Reconfiguring input devices. changes=0x00000004
Device reconfigured: id=0, name='qwerty2', surface size is now 1024x600, mode is 1
createScreenshotSurface failed (Function not implemented)
setKernelCountSet(10040, 1) failed with errno -2
setLightsOn(true)
** Activity (main) Create, isFirst = true **
GC_FOR_ALLOC freed 106K, 4% free 6537K/6787K, paused 50ms
Grow heap (frag case) to 8.735MB for 2394016-byte allocation
GC_CONCURRENT freed 6K, 4% free 8869K/9159K, paused 4ms+4ms
GC_FOR_ALLOC freed 4K, 4% free 9236K/9543K, paused 173ms
Grow heap (frag case) to 11.322MB for 2342416-byte allocation
GC_CONCURRENT freed <1K, 3% free 11523K/11847K, paused 5ms+3ms
** Activity (main) Resume **
Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@411ab438 (uid=10009 pid=176)
Emulator without GPU emulation detected.
Displayed com.ab.abmeter/.main: +2s477ms
setKernelCountSet(10009, 0) failed with errno -2
GC_EXPLICIT freed 60K, 12% free 8624K/9735K, paused 5ms+10ms

Here is the log when it fails:

START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.ab.abmeter/.main} from pid 176
Failure taking screenshot for (374x230) to layer 21005
Reconfiguring input devices. changes=0x00000004
Device reconfigured: id=0, name='qwerty2', surface size is now 1024x600, mode is 1
createScreenshotSurface failed (Function not implemented)
setKernelCountSet(10040, 1) failed with errno -2
unable to find stats for iface rmnet0
** Activity (main) Create, isFirst = false **
setLightsOn(true)
GC_FOR_ALLOC freed 12K, 3% free 11914K/12231K, paused 141ms
Grow heap (frag case) to 13.937MB for 2342416-byte allocation
GC_CONCURRENT freed 1K, 3% free 14201K/14535K, paused 5ms+5ms
main_drawbackground (java line: 334)
java.lang.NullPointerException
at com.AB.ABExtDrawing.ABExtDrawing.drawBitmap2(ABExtDrawing.java:232)
at com.ab.abmeter.main._drawbackground(main.java:334)
at com.ab.abmeter.main._drawme(main.java:407)
at com.ab.abmeter.main._activity_create(main.java:293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at com.ab.abmeter.main.afterFirstLayout(main.java:89)
at com.ab.abmeter.main.access$100(main.java:16)
at com.ab.abmeter.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@411ab438 (uid=10009 pid=176)
Displayed com.ab.abmeter/.main: +2s969ms
setKernelCountSet(10009, 0) failed with errno -2
GC_EXPLICIT freed 95K, 12% free 8631K/9735K, paused 5ms+10ms
 
Upvote 0

noclass1980

Active Member
Licensed User
Longtime User
Hi, can someone help me with this? I want to draw an array of points using the AB Ext Drawing libary. The code below doesn't work, can someone point me in the right direction?

B4X:
sub Drawp(Canv as Canvas)
Dim pts(5,1) As Float
For i=0 To 5
pts(i,0)=10 + (10*i)
pts(i,1)= 10 + (10*i)
Next
pointpaint.Initialize
pointpaint.SetColor(0x9f004d0f)
pointpaint.SetStrokeWidth(0.005)
pointpaint.SetAntiAlias(True)
ExtDraw.drawPoints2(Canv,pts(5,1),pointpaint)
End Sub

the DrawP sub is called from another sub by Drawp(PanelCanvas1) and the PanelCanvas1 has previously been initialised to the Panel and ExtDraw dimed as ABExtDrawing. On compiling there is an error message saying it cannot cast Type.
Thanks in advance
 
Last edited:
Upvote 0

noclass1980

Active Member
Licensed User
Longtime User
Thanks for the reply but unfortunately it didn't work. so I've tried the following separately with the resulting error messages

B4X:
ExtDraw.drawPoints2(Canv,pts(5,1),pointpaint) 'error is cannot cast to type (Type=Float, Rank=0) to (Type=Float, Rank=1)
ExtDraw.drawPoints2(Canv,pts(),pointpaint) ' error is missing parameter
ExtDraw.drawPoints2(Canv,pts,pointpaint) 'error is cannot cast to type (Type=Float, Rank=2) to (Type=Float, Rank=1)

but if I try this code, it works
B4X:
For i=0 To 4
ExtDraw.drawPoint(Canv,pts(i,0), pts(i,1),pointpaint)
Next
Any suggestions?
 
Last edited:
Upvote 0
Top