图像剪裁属性钛

时间:2013-06-22 14:38:39

标签: image titanium clipping

我有一个使用Titanium实现的图像,我想知道是否有任何方法可以在titainum中实现图像的剪切属性。

1 个答案:

答案 0 :(得分:1)

是的,您可以使用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...
相关问题