Ejemplo n.º 1
0
    void BookEngineInterface.BEIGoToPage(IntPtr handle, int page)
    {
        switch (format)
        {
        case BookFormat.coolreader:
            cri.BEIGoToPage(handle, page);
            break;

        case BookFormat.poppler:
            pop.BEIGoToPage(handle, page);
            break;
        }
    }
Ejemplo n.º 2
0
    // Render and copy a given page to the specified texture.
    public void retrievePageToTexture(int page, Texture2D texture)
    {
        bookEngine.BEIGoToPage(bookHandle, page);
        bookEngine.BEIRenderPage(bookHandle, page, directRenderTexture.GetNativeTexturePtr());

        // Create a mip-mapped texture version. This is extra work but produces much more readable texture.
        RenderTexture texcopy = RenderTexture.GetTemporary(directRenderTexture.width, directRenderTexture.height, 0, RenderTextureFormat.Default, RenderTextureReadWrite.Linear);

        Graphics.Blit(directRenderTexture, texcopy);

        RenderTexture previous = RenderTexture.active;

        RenderTexture.active = texcopy;
        texture.ReadPixels(new Rect(0, 0, directRenderTexture.width, directRenderTexture.height), 0, 0);
        texture.Apply();
        RenderTexture.active = previous;
        RenderTexture.ReleaseTemporary(texcopy);
    }