A function there returns a bitmap and I need some help to use that bitmap. The function renders some graphics into a bitmap and I think it must be converetd to CGImage or NSImage before I can display it.
Code: Select all
bitmap = FPDFBitmap_Create(800, 600, 0) ;returns a non-zero handle
RenderPageBitmap(bitmap, pdf_pages(0), 0, 0, 800, 600, 0, $100) ;no error
; StartDrawing(CanvasOutput(0))
; DrawImage(bitmap) ;IMA!
; StopDrawing()
StartVectorDrawing(CanvasVectorOutput(0))
DrawVectorImage(bitmap) :IMA!
StopDrawing()
https://github.com/hfiguiere/pdfium/blo ... st.cc[code]
int width = static_cast<int>(FPDF_GetPageWidth(page) * scale);
int height = static_cast<int>(FPDF_GetPageHeight(page) * scale);
int alpha = FPDFPage_HasTransparency(page) ? 1 : 0;
FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, alpha);
if (bitmap) {
FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF;
FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color);
FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, FPDF_ANNOT);
FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, FPDF_ANNOT);[/code]
Any help is appreciated. Thank you.