【问题标题】:Image clipping property titanium图像剪切属性钛
【发布时间】:2013-06-19 13:38:08
【问题描述】:

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

【问题讨论】:

    标签: image titanium clipping


    【解决方案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...
    

    【讨论】:

    • 我可以给你一个例子:考虑你有一些在主视图(view1)上看不到的文本的持续旋转的轮子。但是,当带有文本的轮子部分通过另一个视图(view2)时;通过 view2 的文本部分变为可见。这就是我想要创造的;我对如何使用 blob imagecrop 创建类似的东西感到困惑
    • 这不是你的问题。您只询问了如何裁剪/剪辑图像。
    猜你喜欢
    • 1970-01-01
    • 2014-08-08
    • 2018-04-10
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 2013-09-30
    • 2014-12-09
    • 2015-07-07
    相关资源
    最近更新 更多