I'm trying to implement above as you mentioned but I'm having problems to do this.
I think the structure is ok but I didn't understood how to use BMP and DIB objects, could you please help me on that?
For now, I have:
protected void RenderThumb() {
Bitmap bitmap = null;
if (m_status == 2) return;
if (m_page == null)
m_page = m_doc.GetPage(m_pageno);
File thumbPath = getThumbPath(m_pageno);
if (thumbPath.exists()) {
bitmap = CommonUtil.loadThumb(thumbPath);
BMP bmp = new BMP();
bmp.Create(bitmap);
m_dib = new DIB();
bmp.DrawToDIB(m_dib, m_dibw, m_dibh);
Matrix mat = new Matrix(m_scale, -m_scale, 0, m_dibh);
//How to get a Bitmap object and add to DIB Object
//How to render a page using a DIB OBJECT
m_page.RenderPrepare(m_dib);
m_page.Render(m_dib, mat);
mat.Destroy();
} else {
if (m_dib == null) {
DIB dib = new DIB();
dib.CreateOrResize(m_dibw, m_dibh);
m_page.RenderPrepare(dib);
m_dib = dib;
} else m_page.RenderPrepare(m_dib);
if (m_status == 2) return;
if (!m_page.RenderThumbToDIB(m_dib)) {
Matrix mat = new Matrix(m_scale, -m_scale, 0, m_dibh);
m_page.Render(m_dib, mat);
bitmap = Bitmap.createBitmap(m_dibw, m_dibh, Bitmap.Config.ARGB_8888);
//IS IT NECESSARY TO RENDER AS THUMB HERE?? I Tried m_dib.ToBMP without success
m_page.RenderThumb(bitmap);
CommonUtil.saveThumb(bitmap, thumbPath);
mat.Destroy();
}
}
if (m_status != 2)
m_status = 1;
}
The files are saved correctly but loading it and render the page from the file is not working.
Tks,
Thiago