使用muPDF,卷曲/翻页效果 [英] Using muPDF with curl/flip effect

查看:1992
本文介绍了使用muPDF,卷曲/翻页效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 muPDF 阅读PDF文件在我的应用程序。我不喜欢它的默认的动画(切换水平)。在另一边,我发现的辉煌库卷曲效果的图像,和的这个项目的布局翻转瓣效果。

I'm using muPDF for reading PDFs in my application. I don't like its default animation (Switching horizontally). In other side i found this brilliant library for curl effect on images, and this project for flip-flap effect on layouts.

在袅袅示例项目,在CurlActivity,所有的数据都是图像和PageProvider设置是这样的:

In curl sample project, in CurlActivity, all of data are images and set in PageProvider like this:

private class PageProvider implements CurlView.PageProvider {

    // Bitmap resources.
    private int[] mBitmapIds = { R.drawable.image1, R.drawable.image2,
            R.drawable.image3, R.drawable.image4};

和使用这样的:

private CurlView mCurlView;
mCurlView = (CurlView) findViewById(R.id.curl);
mCurlView.setPageProvider(new PageProvider());

和CurlView从GLSurfaceView扩展并实现View.OnTouchListener,CurlRenderer.Observer

And CurlView extends from GLSurfaceView and implements View.OnTouchListener, CurlRenderer.Observer

但在muPDF,如果我没有记错,数据是核心对象。核心是MuPDFCore的实例。并用它是这样的:

But in muPDF if i'm not mistaken, data are in core object. core is instance of MuPDFCore. And using it like this:

MuPDFReaderView mDocView;
MuPDFView pageView = (MuPDFView) mDocView.getDisplayedView();
mDocView.setAdapter(new MuPDFPageAdapter(this, this, core));

MuPDFReaderView延伸ReaderView和ReaderView扩展适配器视图,并实现GestureDetector.OnGestureListener,ScaleGestureDetector.OnScaleGestureListener,可运行。

MuPDFReaderView extends ReaderView and ReaderView extends AdapterView and implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener, Runnable.

我的问题是如何在这里可以用卷曲效果muPDF我?我应该从哪里得到的页面逐一将它们转换为位图?然后更改适配器的muPDF方面CurlView。

My question is where how can i using curl effect in muPDF? Where should i get pages one by one and converting them to bitmaps? and then changing aspects of the Adapter in muPDF to CurlView.

在翻转瓣样本项目,在FlipHorizo​​ntalLayoutActivity(我喜欢这个效果也是如此),我们有这些:

In flip-flap sample project, in FlipHorizontalLayoutActivity (I like this effect too), we have these:

private FlipViewController flipView;
flipView = new FlipViewController(this, FlipViewController.HORIZONTAL);
flipView.setAdapter(new TravelAdapter(this));
setContentView(flipView);

和FlipViewController扩展适配器视图,和数据TravelAdapter扩展BaseAdapter设置。

And FlipViewController extends AdapterView, and data set in TravelAdapter that extends BaseAdapter.

没有人这样做过?或者,可以帮助我做到这一点?!

No one has done this before? Or can help me to do that?!

编辑:

我发现了另一个优秀的开源PDF阅读器名为 fbreaderJ 的卷曲效果。它的开发者说的 href="https://fbreader.org/content/fbreader-pdf-plugin" rel="nofollow">附加的模块,允许在的FBReader打开PDF文件的

I found another good open source PDF reader with curl effect called fbreaderJ. its developer says "An additional module that allows to open PDF files in FBReader. Based on radaee pdf library."

我弄糊涂了!造成 radaeepdf 是闭源和的下载的项目是仅用于演示和插入的用户名和密码是这个包。 人们希望改变整个的FBReader项目,如包名。

I got confused! cause radaeepdf is closed source and downloadable project is just for demo and inserted username and password is for this package. People want to change whole fbreader project such as package name.

另外一个问题了让我迷惑的地方是这是额外的模块源$ C ​​$ C?!

Another issue for make me confused is where is this additional module source code?!

无论如何,如果有人想帮我,的FBReader做得很好。

Anyway, if someone wants to help me, fbreader has done it very well.

编辑:

我跟罗宾·沃茨,谁开发muPDF(或开发商),他说:

I talked to Robin Watts, who developed muPDF (or one of developers), and he said:

你读过平台/安卓/ ClassStructure.txt? MuPDF是   主要是一个C语言库。因此,标准的API是一个C的。宁可   比公开的API完全一样是Java的(这将是   最好的解决办法,有什么东西,我已经做了一些工作,但   不是因为缺乏时间),我们已经实现MuPDFCore已完成   包只是我们需要的位。 MuPDFCore处理打开一个PDF文件,   并在视图中使用从中得到位图。或者更确切地说,MuPDFCore   返回的意见,而不是位图。如果你需要的位图,那么你会   需要做的MuPDFCore变化。

Have you read platform/android/ClassStructure.txt ? MuPDF is primarily a C library. The standard api is therefore a C one. Rather than exposing that api exactly as is to Java (which would be the nicest solution, and something that I've done some work on, but have not completed due to lack of time), we've implemented MuPDFCore to wrap up just the bits we needed. MuPDFCore handles opening a PDF file, and getting bitmaps from it to be used in views. or rather, MuPDFCore returns 'views', not 'bitmaps'. If you need bitmaps, then you're going to need to make changes in MuPDFCore.

改变MuPDFReaderView类的一小部分时,有太多的错误。我感到困惑!这些都与彼此

There are too many errors when changing a little part of MuPDFReaderView class. I get confused! These are related to each other.

请回答更多的precisely。

Please answer more precisely.

编辑:

和赏金已经过期。

推荐答案

如果该muPDF不支持渲染为位图,你没有其他选择,而不是渲染到普通视图,并进行屏幕转储到这样的位图:

If the muPDF does not support rendering to a bitmap, you have no other choice than rendering to a regular view and take a screen dump to a bitmap like this:

View content = findViewById(R.id.yourPdfView);
Bitmap bitmap = content.getDrawingCache();

然后使用该位图作为输入到其他库。

Then use this bitmap as input to your other library.

这篇关于使用muPDF,卷曲/翻页效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆