mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
renamed the Crop filter to Mask
This commit is contained in:
2
Thorfile
2
Thorfile
@@ -5,7 +5,7 @@ class Build < Thor
|
|||||||
# This is the list of files to concatenate. The first file will appear at the top of the final file. All files are relative to the lib directory.
|
# This is the list of files to concatenate. The first file will appear at the top of the final file. All files are relative to the lib directory.
|
||||||
FILES = [
|
FILES = [
|
||||||
"src/Global.js", "src/util/Type.js", "src/Canvas.js", "src/util/Tween.js", "src/util/Transform.js", "src/util/Collection.js",
|
"src/Global.js", "src/util/Type.js", "src/Canvas.js", "src/util/Tween.js", "src/util/Transform.js", "src/util/Collection.js",
|
||||||
"src/filters/Grayscale.js", "src/filters/Brighten.js", "src/filters/Invert.js", "src/filters/Blur.js", "src/filters/Crop.js",
|
"src/filters/Grayscale.js", "src/filters/Brighten.js", "src/filters/Invert.js", "src/filters/Blur.js", "src/filters/Mask.js",
|
||||||
"src/Node.js", "src/Animation.js", "src/DragAndDrop.js", "src/Transition.js", "src/Container.js", "src/Shape.js", "src/Stage.js", "src/Layer.js", "src/Group.js",
|
"src/Node.js", "src/Animation.js", "src/DragAndDrop.js", "src/Transition.js", "src/Container.js", "src/Shape.js", "src/Stage.js", "src/Layer.js", "src/Group.js",
|
||||||
"src/shapes/Rect.js", "src/shapes/Circle.js", "src/shapes/Wedge.js", "src/shapes/Ellipse.js", "src/shapes/Image.js", "src/shapes/Polygon.js", "src/shapes/Text.js", "src/shapes/Line.js", "src/shapes/Spline.js", "src/shapes/Blob.js", "src/shapes/Sprite.js",
|
"src/shapes/Rect.js", "src/shapes/Circle.js", "src/shapes/Wedge.js", "src/shapes/Ellipse.js", "src/shapes/Image.js", "src/shapes/Polygon.js", "src/shapes/Text.js", "src/shapes/Line.js", "src/shapes/Spline.js", "src/shapes/Blob.js", "src/shapes/Sprite.js",
|
||||||
"src/plugins/Path.js", "src/plugins/TextPath.js", "src/plugins/RegularPolygon.js", "src/plugins/Star.js", "src/plugins/Label.js"
|
"src/plugins/Path.js", "src/plugins/TextPath.js", "src/plugins/RegularPolygon.js", "src/plugins/Star.js", "src/plugins/Label.js"
|
||||||
|
@@ -163,7 +163,7 @@
|
|||||||
Kinetic.Filters = Kinetic.Filters || {};
|
Kinetic.Filters = Kinetic.Filters || {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Crop Filter
|
* Mask Filter
|
||||||
*
|
*
|
||||||
* Only crop unicolor background images for instance
|
* Only crop unicolor background images for instance
|
||||||
*
|
*
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
* @param {Object} config
|
* @param {Object} config
|
||||||
* @param {Integer} config.threshold The RGB euclidian distance threshold (default : 10)
|
* @param {Integer} config.threshold The RGB euclidian distance threshold (default : 10)
|
||||||
*/
|
*/
|
||||||
Kinetic.Filters.Crop = function(idata, config) {
|
Kinetic.Filters.Mask = function(idata, config) {
|
||||||
// Detect pixels close to the background color
|
// Detect pixels close to the background color
|
||||||
var mask = backgroundMask(idata, config);
|
var mask = backgroundMask(idata, config);
|
||||||
if (mask) {
|
if (mask) {
|
@@ -408,7 +408,7 @@ Test.Modules.IMAGE = {
|
|||||||
|
|
||||||
showHit(layer);
|
showHit(layer);
|
||||||
},
|
},
|
||||||
'crop unicolor background filter': function(containerId) {
|
'*mask unicolor background filter': function(containerId) {
|
||||||
var imageObj = new Image();
|
var imageObj = new Image();
|
||||||
imageObj.onload = function() {
|
imageObj.onload = function() {
|
||||||
var stage = new Kinetic.Stage({
|
var stage = new Kinetic.Stage({
|
||||||
@@ -436,13 +436,13 @@ Test.Modules.IMAGE = {
|
|||||||
layer.add(filtered);
|
layer.add(filtered);
|
||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
|
|
||||||
filtered.applyFilter(Kinetic.Filters.Crop, {
|
filtered.applyFilter(Kinetic.Filters.Mask, {
|
||||||
threshold: 10
|
threshold: 10
|
||||||
}, function() {
|
}, function() {
|
||||||
layer.draw();
|
layer.draw();
|
||||||
var dataUrl = layer.toDataURL();
|
var dataUrl = layer.toDataURL();
|
||||||
//console.log(dataUrl);
|
//console.log(dataUrl);
|
||||||
testDataUrl(dataUrl, 'crop filter', 'problem with Crop filter.');
|
testDataUrl(dataUrl, 'mask filter', 'problem with Mask filter.');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
imageObj.src = '../assets/bamoon.jpg';
|
imageObj.src = '../assets/bamoon.jpg';
|
||||||
|
@@ -176,7 +176,7 @@ Test.Modules.Text = {
|
|||||||
var text = new Kinetic.Text({
|
var text = new Kinetic.Text({
|
||||||
x: 10,
|
x: 10,
|
||||||
y: 10,
|
y: 10,
|
||||||
text: 'HEADING\n\nAll the world\'s a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.',
|
text: 'HEADING\n\nAll the world\'s a stage, merely players. They have their exits and their entrances; And one man in his time plays many parts.',
|
||||||
//text: 'HEADING\n\nThis is a really cool paragraph. \n And this is a footer.',
|
//text: 'HEADING\n\nThis is a really cool paragraph. \n And this is a footer.',
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontFamily: 'Calibri',
|
fontFamily: 'Calibri',
|
||||||
@@ -185,7 +185,7 @@ Test.Modules.Text = {
|
|||||||
//width: 20,
|
//width: 20,
|
||||||
width: 380,
|
width: 380,
|
||||||
//width: 200,
|
//width: 200,
|
||||||
padding: 0,
|
padding: 10,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
draggable: true,
|
draggable: true,
|
||||||
wrap: 'WORD'
|
wrap: 'WORD'
|
||||||
|
Reference in New Issue
Block a user