2013-06-22 55 views

回答

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... 
+0

我可以给你举个例子:假设你有汽车无使用一些文本这是不能在主视图(视图1)可以看出旋转轮。但是,当具有文本的轮子部分通过另一个视图时(视图2);通过view2的部分文本变得可见。这就是我想要创造的;我很困惑如何创建像blob imagecrop这样的东西 – user782400

+0

这不是在你的问题。您只会询问如何裁剪/裁剪图像。 –