【发布时间】:2013-06-19 13:38:08
【问题描述】:
我有一个使用 Titanium 实现的图像,我想知道是否有任何方法可以在 titainum 中实现图像的裁剪属性。
【问题讨论】:
我有一个使用 Titanium 实现的图像,我想知道是否有任何方法可以在 titainum 中实现图像的裁剪属性。
【问题讨论】:
是的,您可以使用Titanium.Blob.imageAsCropped 函数裁剪图像。
例如:
// Load your image from the file system
var imagefile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, "yourimage.png");
var imageBlob = imagefile.read();
// Crop it as you like
var croppedImage = blob.imageAsCropped({x : 20, y : 20, width : 100, height : 100});
// Stick it in an image view
var imageView = Ti.UI.createImageView({
image : croppedImage,
... other attributes ...
});
// Do what you want to it...
【讨论】: