我正在尝试编写一个程序,将传入的USB数据放到折线图上。我这样做的方法是在画布上绘制一串连接所有数据点的直线。问题是生成的线条不平滑,如下所示:
我尝试使用图形上下文的lineTo(x, y)
方法,但这让它变得更糟。我也尝试更改Line Cap和Line Join参数,但这并没有多大帮助。
是否有更好的游戏方式"连接点"使用JavaFX图形上下文?也许是贝塞尔曲线?如果有,请告诉我。
答案 0 :(得分:2)
我最终选择了最简单的问题解决方案,即使用BoxBlur效果:
07-28 10:38:46.196 2560-2560/? E/libprocessgroup: failed to make and chown /acct/uid_10080: Read-only file system
07-28 10:38:46.196 2560-2560/? W/Zygote: createProcessGroup failed, kernel missing CONFIG_CGROUP_CPUACCT?
07-28 10:38:46.197 2560-2560/? I/art: Not late-enabling -Xcheck:jni (already on)
07-28 10:38:46.211 2560-2570/? E/art: Failed sending reply to debugger: Broken pipe
07-28 10:38:46.211 2560-2570/? I/art: Debugger is no longer active
07-28 10:38:46.293 2560-2560/? I/InstantRun: starting instant run server: is main process
07-28 10:38:46.334 2560-2560/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-28 10:38:46.426 2560-2583/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
[ 07-28 10:38:46.427 2560: 2560 D/ ]
HostConnection::get() New Host Connection established 0xb3ee71f0, tid 2560
[ 07-28 10:38:46.428 2560: 2560 W/ ]
Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1
07-28 10:38:46.428 2560-2560/? D/Atlas: Validating map...
07-28 10:38:46.451 2560-2583/? I/OpenGLRenderer: Initialized EGL, version 1.4
07-28 10:38:46.452 2560-2583/? W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
07-28 10:38:46.460 2560-2583/? D/EGL_emulation: eglCreateContext: 0xb3eb8940: maj 2 min 0 rcv 2
07-28 10:38:46.464 2560-2583/? D/EGL_emulation: eglMakeCurrent: 0xb3eb8940: ver 2 0
07-28 10:38:46.467 2560-2583/? D/OpenGLRenderer: Enabling debug mode 0
07-28 10:38:46.500 2560-2583/? D/EGL_emulation: eglMakeCurrent: 0xb3eb8940: ver 2 0
07-28 10:38:46.555 2560-2560/? W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
07-28 10:38:51.028 2560-2560/com.example.easypc.creatingacloneimagefrompixels D/AndroidRuntime: Shutting down VM
07-28 10:38:51.030 2560-2560/com.example.easypc.creatingacloneimagefrompixels E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.easypc.creatingacloneimagefrompixels, PID: 2560
java.lang.IllegalStateException
at android.graphics.Bitmap.setPixel(Bitmap.java:1420)
at com.example.easypc.creatingacloneimagefrompixels.MainActivity$1.onClick(MainActivity.java:53)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
这不是一个确切的解决方案,但它适用于我的目的。