我最近一直在学习Scheme,并遇到了一个以下列方式定义的函数:
(define remove!
(let ((null? null?)
(cdr cdr)
(eq? eq?))
(lambda ... function that uses null?, cdr, eq? ...)
Run Code Online (Sandbox Code Playgroud)
绑定null的目的是什么?为空?或cdr到cdr,当这些是在没有let块的函数定义中可用的函数中构建的?
在将项目转换为Android构建系统的过程中,每当我尝试编译时都会收到此错误.
Gradle: Error parsing XML: prefix must not be bound to one of the reserved namespace names
合并的values.xml文件包含以下根元素:
<resources xmlns:ns1="http://www.w3.org/2000/xmlns/">
导致此错误的原因是什么?如何解决?
在我的应用程序中,我使用ACTION_IMAGE_CAPTUREIntent来拍照.当相机返回时,将检查文件,如果旋转是纵向,则使用以下代码旋转位图并将其保存到磁盘:
BitmapFactory.Options options = new Options();
options.inPreferredConfig = Bitmap.Config.RGB_565;
Bitmap bmp = BitmapFactory.decodeFile(f.getAbsolutePath(), options);
if (bmp != null) {
Matrix m = new Matrix();
m.postRotate(90);
Bitmap rotated = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), m,
true);
rotated = rotated.copy(Bitmap.Config.RGB_565, false); // added based on comment
f.delete();
FileOutputStream fos = new FileOutputStream(f);
rotated.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();
}
Run Code Online (Sandbox Code Playgroud)
这应该工作,但文件大小是非旋转图片的两倍.我已经尝试将密度设置BitmapFactory.Options为0并将比例设置为false,但两者都没有达到预期的效果.我希望我转换的图像大小与从磁盘加载的图像大小相同.我的代码中是否存在阻止这种情况发生的事情?