本文整理汇总了TypeScript中@ephox/imagetools.ResultConversions类的典型用法代码示例。如果您正苦于以下问题:TypeScript ResultConversions类的具体用法?TypeScript ResultConversions怎么用?TypeScript ResultConversions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ResultConversions类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
return function () {
const state = tempState || currentState;
ResultConversions.blobToImageResult(state.blob).
then(function (ir) {
fn.apply(this, [ir].concat(args)).then(imageResultToBlob).then(addTempState);
});
};
示例2: update
function update(value) {
ResultConversions.blobToImageResult(currentState.blob).
then(function (ir) {
return filter(ir, value);
}).
then(imageResultToBlob).
then(function (blob) {
const newTempState = createState(blob);
displayState(newTempState);
destroyState(tempState);
tempState = newTempState;
});
}
示例3: crop
function crop() {
const rect = imagePanel.selection();
ResultConversions.blobToImageResult(currentState.blob).
then(function (ir) {
ImageTransformations.crop(ir, rect.x, rect.y, rect.w, rect.h).
then(imageResultToBlob).
then(function (blob) {
addBlobState(blob);
cancel();
});
});
}
示例4: block
const blobManipulate = (anyInSystem: AlloyComponent, blob: Blob, filter: (ir: ImageResult) => ImageResult | PromiseLike<ImageResult>, action: (blob: Blob) => string, swap: () => void): Promise<Option<Element>> => {
block(anyInSystem);
return ResultConversions.blobToImageResult(blob).
then(filter).
then(imageResultToBlob).
then(action).
then((url) => {
return updateSrc(anyInSystem, url).then((oImg) => {
updateButtonUndoStates(anyInSystem);
swap();
unblock(anyInSystem);
return oImg;
});
}).catch((err) => {
console.log(err); // TODO: Notify the user?
unblock(anyInSystem);
return err;
});
};