Question

I am developing comic reading application on Android devices. I've added many features to make it more user friendly for e-ink devices, but I still face one problem.

Upon changing pages ghosting from previous pages can be seen. It is not a problem on some devices that do full page refresh on every update, like Nook Simple Touch(rooted), but can be very noticeable on other devices, like Onyx Lynx T68. Full refresh blinks the screen for a while into negative, and afterwards all ghosting is gone.

How can I perform full page refresh, to clear up all the ghosting? I think it can be done, as Onyx Lynx has included "force full refresh" option in their latest firmware update. It can be triggered by holding one of the buttons. I'm afraid though, that it might require a root.

Was it helpful?

Solution

It's really device specific. I have 2 ways of doing it.

1) Dirty hack

First create "negative" Paint:

float[] colorMatrix_Negative = { -1.0f, 0, 0, 0, 255, // red
            0, -1.0f, 0, 0, 255, // green
            0, 0, -1.0f, 0, 255, // blue
            0, 0, 0, 1.0f, 0 // alpha
    };
private final Paint mPaintNegative = new Paint();
private final ColorFilter colorFilter_Negative = new ColorMatrixColorFilter(colorMatrix_Negative);

When showing an image in ImageView you can do something like this in onDraw:

protected void onDraw(Canvas canvas) {
    if (mBitmap != null && !mBitmap.isRecycled()) {
        if(isNewImage) {
            canvas.drawBitmap(mBitmap, mImgTrans.srcRect, mImgTrans.viewRect, mPaintNegative);
            invalidate();
        } else {
            canvas.drawBitmap(mBitmap, mImgTrans.srcRect, mImgTrans.viewRect, mPaint);
        }
     }
}

This will first paint negative picture for a frame, then normal one. It works pretty well with removing ghosting, and simulates the real thing. You can improve on it in many ways, for example show negative frame a bit longer etc. Overall it's pretty ugly hack, but works well on most devices.

2) Real way

As far as Onyx Devices are concerned you can ask Onyx to provide you with access to their SDK. It provides EpdController which has functions like:

  • refreshScreen(view, mode)
  • invalidate(view, mode)
  • postInvalidate(view, mode)

which let you force a refresh when necessary. You can also select the refreshing mode depending on your needs, but it's not well documented which mode is what.

Even better you can use, in the same Controller

  • setViewDefaultUpdateMode(view, mode)

Which lets you change to a mode more fitting your needs and let the device take care of the rest. There are tons of other useful things over there.

I've used sales@onyx-international.com in order to contact them, but you probably would do better to use dev@onyx-international.com

Since you can detect if you are on Onyx device using that SDK you can still let users activate E-ink mode in settings and then fallback into hack from answer 1) or something similar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top