Search code examples
androidmupdf

how can i change highlight color in mupdf library android


My project is using mupdf for android.I am not able to change color of highlighted text.Anyone who can help me. Thank you in advance.


Solution

  • In Mupdf library they have used some default color for highlight as below

     color[0] = 1.0;
     color[1] = 1.0;
     color[2] = 0.0;
    

    To change the color dynamically, You can pass the integer color value as a parameter to the corresponding method and assign it like below.

    color[0] = ((intcolor >> 16) & 0xFF) / 255.0;  // Extract the RR byte
    color[1] = ((intcolor >> 8) & 0xFF) / 255.0;   // Extract the GG byte
    color[2] = (intcolor & 0xFF) / 255.0; // Extract the BB byte