- Posts: 7
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
Show rectangle of annotation
IP: 192.168.0.71
7 years 11 months ago #13667
by vitdos1
Show rectangle of annotation was created by vitdos1
hello, how i can show rectangle of ink annotation on the screen programmatically (such as when i tap to annotation on the screen)?
IP: 192.168.0.71
7 years 11 months ago #13670
by Davide
Replied by Davide on topic Show rectangle of annotation
Hi,
you have to get the annot rect and rescale it to screen size, then you have to draw it to your canvas.
Code is taken from onSingleTapConfirmed in PDFLayoutView.
you have to get the annot rect and rescale it to screen size, then you have to draw it to your canvas.
Code:
m_annot_rect = m_annot.GetRect();
m_annot_page = m_layout.vGetPage(pageno);
float tmp = m_annot_rect[1];
m_annot_rect[0] = m_annot_page.GetVX(m_annot_rect[0]) - m_layout.vGetX();
m_annot_rect[1] = m_annot_page.GetVY(m_annot_rect[3]) - m_layout.vGetY();
m_annot_rect[2] = m_annot_page.GetVX(m_annot_rect[2]) - m_layout.vGetX();
m_annot_rect[3] = m_annot_page.GetVY(tmp) - m_layout.vGetY();
Paint paint = new Paint();
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(2);
paint.setARGB(0x80, 0, 0, 0);
canvas.drawRect(m_annot_rect[0], m_annot_rect[1], m_annot_rect[2], m_annot_rect[3], paint);
Code is taken from onSingleTapConfirmed in PDFLayoutView.
IP: 192.168.0.71
7 years 11 months ago - 7 years 11 months ago #13699
by vitdos1
Replied by vitdos1 on topic Show rectangle of annotation
thanks but i have error of native library when i try this method:
canvas.drawRect(m_annot_rect[0], m_annot_rect[1], m_annot_rect[2], m_annot_rect[3], paint);
i take canvas from PDFLayoutView.onDraw (Canvas canvas)
error:
beginning of crash
04-11 09:50:27.768 17719-17719/by.mrsoft.mrdoc A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 17719 (by.mrsoft.mrdoc)
04-11 09:50:27.807 17797-17797/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86/generic_x86:8.0.0/OSR1.180220.006/4662038:userdebug/dev-keys'
Revision: '0'
ABI: 'x86'
pid: 17719, tid: 17719, name: by.mrsoft.mrdoc >>> by.mrsoft.mrdoc <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
Cause: null pointer dereference
eax 00000008 ebx b4137ce4 ecx 00000009 edx 93bf4880
esi 00000008 edi 00000014
xcs 00000073 xds 0000007b xes 0000007b xfs 0000003b xss 0000007b
eip b40a8814 ebp bfd0e958 esp bfd0e920 flags 00010206
04-11 09:50:27.977 17797-17797/? A/DEBUG: backtrace:
#00 pc 00051814 /system/lib/libhwui.so (_ZN7android10uirenderer15LinearAllocator9allocImplEj+36)
#01 pc 00091607 /system/lib/libhwui.so (_ZN7android10uirenderer15RecordingCanvas10drawGlyphsEPKtPKfiRK7SkPaintfffffff+103)
#02 pc 0002cc1b /system/lib/libhwui.so (_ZN7android15DrawTextFunctorclEjj+475)
#03 pc 0002c601 /system/lib/libhwui.so (_ZN7android12MinikinUtils10forFontRunINS_15DrawTextFunctorEEEvRKN7minikin6LayoutEPNS_5PaintERT_+401)
#04 pc 0002c39a /system/lib/libhwui.so (_ZN7android6Canvas8drawTextEPKtiiiffiRKNS_5PaintEPNS_8TypefaceE+426)
#05 pc 000fbf89 /system/lib/libandroid_runtime.so (_ZN7android9CanvasJNIL14drawTextStringEP7_JNIEnvP8_jobjectxP8_jstringiiffixx+137)
#06 pc 011f4371 /system/framework/x86/boot-framework.oat (offset 0x5e7000) (android.view.RecordingCanvas.nDrawText [DEDUPED]+305)
#07 pc 000e455a /dev/ashmem/dalvik-jit-code-cache (deleted)
canvas.drawRect(m_annot_rect[0], m_annot_rect[1], m_annot_rect[2], m_annot_rect[3], paint);
i take canvas from PDFLayoutView.onDraw (Canvas canvas)
error:
beginning of crash
04-11 09:50:27.768 17719-17719/by.mrsoft.mrdoc A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 17719 (by.mrsoft.mrdoc)
04-11 09:50:27.807 17797-17797/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86/generic_x86:8.0.0/OSR1.180220.006/4662038:userdebug/dev-keys'
Revision: '0'
ABI: 'x86'
pid: 17719, tid: 17719, name: by.mrsoft.mrdoc >>> by.mrsoft.mrdoc <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
Cause: null pointer dereference
eax 00000008 ebx b4137ce4 ecx 00000009 edx 93bf4880
esi 00000008 edi 00000014
xcs 00000073 xds 0000007b xes 0000007b xfs 0000003b xss 0000007b
eip b40a8814 ebp bfd0e958 esp bfd0e920 flags 00010206
04-11 09:50:27.977 17797-17797/? A/DEBUG: backtrace:
#00 pc 00051814 /system/lib/libhwui.so (_ZN7android10uirenderer15LinearAllocator9allocImplEj+36)
#01 pc 00091607 /system/lib/libhwui.so (_ZN7android10uirenderer15RecordingCanvas10drawGlyphsEPKtPKfiRK7SkPaintfffffff+103)
#02 pc 0002cc1b /system/lib/libhwui.so (_ZN7android15DrawTextFunctorclEjj+475)
#03 pc 0002c601 /system/lib/libhwui.so (_ZN7android12MinikinUtils10forFontRunINS_15DrawTextFunctorEEEvRKN7minikin6LayoutEPNS_5PaintERT_+401)
#04 pc 0002c39a /system/lib/libhwui.so (_ZN7android6Canvas8drawTextEPKtiiiffiRKNS_5PaintEPNS_8TypefaceE+426)
#05 pc 000fbf89 /system/lib/libandroid_runtime.so (_ZN7android9CanvasJNIL14drawTextStringEP7_JNIEnvP8_jobjectxP8_jstringiiffixx+137)
#06 pc 011f4371 /system/framework/x86/boot-framework.oat (offset 0x5e7000) (android.view.RecordingCanvas.nDrawText [DEDUPED]+305)
#07 pc 000e455a /dev/ashmem/dalvik-jit-code-cache (deleted)
Last edit: 7 years 11 months ago by vitdos1.
IP: 192.168.0.71
7 years 11 months ago #13701
by nermeen
Replied by nermeen on topic Show rectangle of annotation
Actually the crash is in the system's native libs (not in librdpdf.so)
And the cause is null pointer reference .. so make sure that you are initializing every parameter correctly.
And the cause is null pointer reference .. so make sure that you are initializing every parameter correctly.
Time to create page: 0.396 seconds