I use RaphaelJS and Raphael-Free-Transform for image processing in my project. Here I am trying to flip the image horizontally. To do this, I change the value of the free conversion scale. The image is upside down, but the image is shifted from its original position, and it is also restored to its original state, so we also lose the flip.
CODE:
$scope.flopImage = function () {
if ($scope.currentImage !== null) {
var ft = paper.freeTransform($scope.currentImage);
ft.attrs.scale.x=-ft.attrs.scale.x;
ft.apply();
}
};
CASE: 2
$scope.flopImage = function () {
if ($scope.currentImage !== null) {
var ft = paper.freeTransform($scope.currentImage);
$scope.currentImage.transform("S-1,1");
ft.apply();
}
};
NOTE:
ft = paper.freeTransform($scope.currentImage,{draw:['bbox'],
rotate: true,keepRatio:[ 'axisX', 'axisY', 'bboxCorners', 'bboxSides'],range: { rotate: [ -180, 180 ] },
scale:[ 'axisX', 'axisY', 'bboxCorners', 'bboxSides' ]});
source
share