Last active
March 13, 2016 02:04
-
-
Save fkruege/61bcf6de074e0d7b5541 to your computer and use it in GitHub Desktop.
PDF Renderer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public Bitmap getBitmap(int position) { | |
| int index = getIndexFromPosition(position); | |
| if (mBitmapArray[index] == null) { | |
| createBitmapAtIndex(index); | |
| } | |
| mBitmapArray[index].eraseColor(Color.TRANSPARENT); | |
| return mBitmapArray[index]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public PDFPagerAdapter(Context context, String pdfPath, float renderQuality, int offScreenSize) { | |
| this.pdfPath = pdfPath; | |
| this.context = context; | |
| mRenderQuality = renderQuality; | |
| mOffScreenSize = offScreenSize; | |
| init(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected void initBitmapPool() { | |
| PdfRenderer.Page samplePage = getPDFPage(0); | |
| width = (int) (samplePage.getWidth() * mRenderQuality); | |
| height = (int) (samplePage.getHeight() * mRenderQuality); | |
| samplePage.close(); | |
| mBitmapPool = new SimpleBitmapPool(mOffScreenSize, width, height, Bitmap.Config.ARGB_8888); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment