{"id":396,"date":"2012-10-09T06:46:54","date_gmt":"2012-10-09T06:46:54","guid":{"rendered":"http:\/\/blog.zhukunqian.com\/?p=396"},"modified":"2012-10-12T07:21:03","modified_gmt":"2012-10-12T07:21:03","slug":"ndk%e4%b8%8b%e4%bd%bf%e7%94%a8%e5%8a%a8%e6%80%81%e5%ba%93%e5%8f%8a%e9%9d%99%e6%80%81%e5%ba%93","status":"publish","type":"post","link":"https:\/\/blog.zhukunqian.com\/?p=396","title":{"rendered":"ndk\u4e0b\u4f7f\u7528\u52a8\u6001\u5e93\u53ca\u9759\u6001\u5e93"},"content":{"rendered":"<p>\u4ee5libpng\u4e3a\u4f8b\u3002<\/p>\n<p>\u5982\u679c\u4f7f\u7528\u52a8\u6001\u5e93\uff1a<\/p>\n<p>\uff11\u3001\u65b0\u5efaandroid\u5de5\u7a0b\uff0c\u521b\u5efajni\u76ee\u5f55\uff0c\u5176\u5b83\u6b65\u9aa4\u4e0d\u591a\u8bf4\u4e86\uff0c\u53c2\u8003\u5b98\u65b9\u7684ndk\u5165\u95e8\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u5c06libpng\u6240\u9700\u6e90\u6587\u4ef6\u653e\u5728jni\u76ee\u5f55\u4e0b\uff0c<\/p>\n<p>\u5e76\u7f16\u5199Android.mk<\/p>\n<p>LOCAL_PATH := $(call my-dir)<br \/>\ninclude $(CLEAR_VARS)<\/p>\n<p>LOCAL_CFLAGS :=<\/p>\n<p>LOCAL_MODULE\u00a0\u00a0\u00a0 := png<br \/>\nLOCAL_SRC_FILES :=\\<br \/>\npng.c \\<br \/>\npngerror.c \\<br \/>\npngget.c \\<br \/>\npngmem.c \\<br \/>\npngpread.c \\<br \/>\npngread.c \\<br \/>\npngrio.c \\<br \/>\npngrtran.c \\<br \/>\npngrutil.c \\<br \/>\npngset.c \\<br \/>\npngtrans.c \\<br \/>\npngwio.c \\<br \/>\npngwrite.c \\<br \/>\npngwtran.c \\<br \/>\npngwutil.c<\/p>\n<p>LOCAL_LDLIBS := -lz<\/p>\n<p>#include $(BUILD_SHARED_LIBRARY)<br \/>\ninclude $(BUILD_STATIC_LIBRARY)<\/p>\n<p>\u7f16\u5199Application.mk<\/p>\n<p>APP_OPTIM := release<br \/>\nAPP_MODULES := libpng<\/p>\n<p>\u7136\u540e\u7f16\u8bd1\uff0c\u6267\u884c\u6210\u529f\u540e\u4f1a\u751f\u6210<\/p>\n<p>libpng.so\u6587\u4ef6\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u52a8\u6001\u94fe\u63a5\u5e93\u5df2\u7ecf\u751f\u6210\u3002\u5c06\u6b64\u6587\u4ef6\u590d\u5236\u81f3\u81ea\u5df1\u7684\u5de5\u7a0b\u7684jni\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>Android.mk\u4fee\u6539\u5982\u4e0b\uff1a<\/p>\n<p># See the License for the specific language governing permissions and<br \/>\n# limitations under the License.<br \/>\n#<br \/>\nLOCAL_PATH := $(call my-dir)<br \/>\ninclude $(CLEAR_VARS)<br \/>\nLOCAL_MODULE := png<br \/>\nLOCAL_SRC_FILES := libpng.so<br \/>\ninclude ${PREBUILT_SHARED_LIBRARY}<\/p>\n<p>include $(CLEAR_VARS)<br \/>\nLOCAL_MODULE\u00a0\u00a0\u00a0 := libgl2jni<br \/>\nLOCAL_CFLAGS\u00a0\u00a0\u00a0 := -Werror<br \/>\nLOCAL_SHARED_LIBRARIES := png<br \/>\n#LOCAL_STATIC_LIBRARIES := libpng<br \/>\n#LOCAL_C_INCLUDES += $(LOCAL_PATH)\/png<br \/>\nLOCAL_SRC_FILES := gl_code.cpp<br \/>\nLOCAL_LDLIBS\u00a0\u00a0\u00a0 := -llog -lGLESv1_CM -lz<br \/>\ninclude $(BUILD_SHARED_LIBRARY)<\/p>\n<p>\u5728java\u4ee3\u7801\u4e2d\u4e5f\u522b\u5fd8\u8bb0\u52a0\u8f7d\u52a8\u6001\u5e93\uff1a<\/p>\n<p>static {<br \/>\nSystem.loadLibrary(&#8220;stlport_shared&#8221;); \/\/ \u52a0\u8f7dstl\u7684\u52a8\u6001\u5e93<br \/>\nSystem.loadLibrary(&#8220;png&#8221;); \/\/ \u52a0\u8f7dgl2\u5e93<br \/>\nSystem.loadLibrary(&#8220;gl2jni&#8221;); \/\/ \u52a0\u8f7dgl2\u5e93<br \/>\n}<\/p>\n<p>\u56e0\u4e3agl2jni\u4f7f\u7528\u4e86png\u5e93\uff0c\u6240\u4ee5\u8981\u5148\u52a0\u8f7dpng\u5e93\uff0c\u518d\u52a0\u8f7dgl2jni\u5e93\u3002<\/p>\n<p>\u4e3a\u4e86\u65b9\u4fbf\uff0c\u5728google code\u5df2\u7ecf\u5efa\u7acb\u597d\u4e86\u5de5\u7a0b\uff0c\u53ef\u4f4d\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7d\u7f16\u8bd1\uff1a<\/p>\n<p><a href=\"http:\/\/code.google.com\/p\/android-ndk-libpng\/\">http:\/\/code.google.com\/p\/android-ndk-libpng\/<\/a><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>\u5982\u679c\u4f7f\u7528\u9759\u6001\u5e93\uff1a<\/p>\n<p>\u5c06\u4ee5\u4e0a\u6e90\u4ee3\u7801\u653e\u5728\u9879\u76ee\u7684jni\u76ee\u5f55\u4e0b<\/p>\n<p>\u4fee\u6539Android.mk\u4e3a\uff1a<\/p>\n<p>LOCAL_PATH:= $(call my-dir)<\/p>\n<p>include $(CLEAR_VARS)<br \/>\nLOCAL_MODULE\u00a0\u00a0\u00a0 := libgl2jni<br \/>\nLOCAL_CFLAGS\u00a0\u00a0\u00a0 := -Werror<br \/>\nLOCAL_SRC_FILES := gl_code.cpp<br \/>\nLOCAL_STATIC_LIBRARIES := png<br \/>\n#LOCAL_C_INCLUDES += $(LOCAL_PATH)\/png<br \/>\nLOCAL_LDLIBS\u00a0\u00a0\u00a0 := -llog -lGLESv1_CM -lz<\/p>\n<p>include $(BUILD_SHARED_LIBRARY)<\/p>\n<p>include $(CLEAR_VARS)<\/p>\n<p>include $(LOCAL_PATH)\/png\/Android.mk<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5libpng\u4e3a\u4f8b\u3002 \u5982\u679c\u4f7f\u7528\u52a8\u6001\u5e93\uff1a \uff11\u3001\u65b0\u5efaandroid\u5de5\u7a0b\uff0c\u521b\u5efajni\u76ee &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/blog.zhukunqian.com\/?p=396\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/396"}],"collection":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=396"}],"version-history":[{"count":4,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/396\/revisions"}],"predecessor-version":[{"id":400,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/396\/revisions\/400"}],"wp:attachment":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}