Add increase contrast filter

This commit is contained in:
Nesswit 2016-01-05 01:22:35 +09:00
parent 95dddf1992
commit 2e55ceba0c
4 changed files with 23 additions and 1 deletions

View File

@ -73,6 +73,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem
case 3: case 3:
renderingmode.setSummary(getString(R.string.name_inverted_grayscale)); renderingmode.setSummary(getString(R.string.name_inverted_grayscale));
break; break;
case 4:
renderingmode.setSummary(getString(R.string.name_increase_contrast));
break;
} }
textEncoding.setSummary(mPreferenceManager.getTextEncoding()); textEncoding.setSummary(mPreferenceManager.getTextEncoding());
@ -135,7 +138,8 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem
CharSequence[] chars = {mActivity.getString(R.string.name_normal), CharSequence[] chars = {mActivity.getString(R.string.name_normal),
mActivity.getString(R.string.name_inverted), mActivity.getString(R.string.name_inverted),
mActivity.getString(R.string.name_grayscale), mActivity.getString(R.string.name_grayscale),
mActivity.getString(R.string.name_inverted_grayscale)}; mActivity.getString(R.string.name_inverted_grayscale),
mActivity.getString(R.string.name_increase_contrast)};
int n = mPreferenceManager.getRenderingMode(); int n = mPreferenceManager.getRenderingMode();
@ -156,6 +160,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem
case 3: case 3:
renderingmode.setSummary(getString(R.string.name_inverted_grayscale)); renderingmode.setSummary(getString(R.string.name_inverted_grayscale));
break; break;
case 4:
renderingmode.setSummary(getString(R.string.name_increase_contrast));
break;
} }
} }
}); });

View File

@ -85,6 +85,12 @@ public class LightningView {
0, 0, -1.0f, 0, 255, // blue 0, 0, -1.0f, 0, 255, // blue
0, 0, 0, 1.0f, 0 // alpha 0, 0, 0, 1.0f, 0 // alpha
}; };
private static final float[] mIncreaseContrastColorArray = {
2.0f, 0, 0, 0, -160.f, // red
0, 2.0f, 0, 0, -160.f, // green
0, 0, 2.0f, 0, -160.f, // blue
0, 0, 0, 1.0f, 0 // alpha
};
private final WebViewHandler mWebViewHandler = new WebViewHandler(this); private final WebViewHandler mWebViewHandler = new WebViewHandler(this);
private final Map<String, String> mRequestHeaders = new ArrayMap<>(); private final Map<String, String> mRequestHeaders = new ArrayMap<>();
@ -506,6 +512,13 @@ public class LightningView {
mInvertPage = true; mInvertPage = true;
break; break;
case 4:
ColorMatrixColorFilter IncreaseHighContrast = new ColorMatrixColorFilter(
mIncreaseContrastColorArray);
mPaint.setColorFilter(IncreaseHighContrast);
setHardwareRendering();
break;
} }
} }

View File

@ -135,6 +135,7 @@
<string name="name_inverted">반전</string> <string name="name_inverted">반전</string>
<string name="name_grayscale">그레이스케일</string> <string name="name_grayscale">그레이스케일</string>
<string name="name_inverted_grayscale">반전된 그레이스케일</string> <string name="name_inverted_grayscale">반전된 그레이스케일</string>
<string name="name_increase_contrast">대비 증가</string>
<string name="name_normal">보통</string> <string name="name_normal">보통</string>
<string name="sync_history">Google과 기록 동기화</string> <string name="sync_history">Google과 기록 동기화</string>
<string name="title_file_chooser">파일 선택기</string> <string name="title_file_chooser">파일 선택기</string>

View File

@ -175,6 +175,7 @@
<string name="name_inverted">Inverted</string> <string name="name_inverted">Inverted</string>
<string name="name_grayscale">Grayscale</string> <string name="name_grayscale">Grayscale</string>
<string name="name_inverted_grayscale">Inverted Grayscale</string> <string name="name_inverted_grayscale">Inverted Grayscale</string>
<string name="name_increase_contrast">Increase Contrast</string>
<string name="name_normal">Normal</string> <string name="name_normal">Normal</string>
<string name="sync_history">Sync history with Google</string> <string name="sync_history">Sync history with Google</string>
<string name="title_file_chooser">File Chooser</string> <string name="title_file_chooser">File Chooser</string>