From ed7423f30d91fe5b44ac98ff78e3be84a37b2a93 Mon Sep 17 00:00:00 2001 From: amrita@123 Date: Fri, 10 Jun 2016 16:03:08 +0530 Subject: [PATCH] Refs: #4464 --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 109 insertions(+), 3 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 9388ded..094230a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -26,6 +26,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.TBDrawStartX; $scope.TBDrawStartY; + $scope.isHighLight = false; + $scope.coloredImageCanvasList = []; //array for bodyviewid correspoing to male female(used for gender change) $scope.correspondingBodyViewIds = { @@ -445,6 +447,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo .select(); //} + $scope.ColoredImageSRC = []; + angular.forEach($scope.bodyRegionCoordinates, function (value, key) { @@ -460,6 +464,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var src = $scope.GetImageSource(value._BodyRegionId); $scope.imageSource = src; // debugger; + + $scope.ColoredImageSRC.push( + { + "bodyRegionId": value._BodyRegionId, "SRC": src, + "Height": rectangle.scaledHeight, + "Width": rectangle.scaledWidth, + "x": rectangle.scaledX, + "y": rectangle.scaledY, + "haveMirror": 'true' + } + ); + + //2.Draw mirror image $scope.DrawMirroredImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N'); // debugger; @@ -482,6 +499,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //0. Scaling as per default zoom var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, 0); + $scope.ColoredImageSRC.push( + { + "bodyRegionId": value._BodyRegionId, "SRC": src, + "Height": rectangle.scaledHeight, + "Width": rectangle.scaledWidth, + "x": rectangle.scaledX, + "y": rectangle.scaledY, + "haveMirror": 'false' + } + ); + + //1.Draw body region which have mirror image $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N'); $scope.BodyRegionCordinatesData.push( @@ -512,6 +541,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var src = $scope.GetImageSource(value._BodyRegionId); $scope.imageSource = src; } + + $scope.ColoredImageSRC.push( + { + "bodyRegionId": value._BodyRegionId, "SRC": src, + "Height": rectangle.scaledHeight, + "Width": rectangle.scaledWidth, + "x": rectangle.scaledX, + "y": rectangle.scaledY, + "haveMirror": 'false' + } + ); + //2.Draw body region which don't have mirror image $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N'); @@ -1219,7 +1260,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }) - } else { @@ -1240,6 +1280,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $timeout(function () { $scope.DisableProgressBar() }, 1000); } + if ($scope.isHighLight) { + //alert('isHighlight: ' + $scope.isHighLight); + + $('#btnHighLight').removeClass('btn btn-black'); + $('#btnHighLight').addClass('btn-primary'); + + $timeout(function () { $scope.highLightBody() }, 350); + + } + } $scope.DisableProgressBar = function () { @@ -2478,6 +2528,64 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } + $scope.enableHighlight = function () { + $scope.isHighLight = true; + + // alert('enableHighlight is called'); + + $scope.highLightBody(); + } + + $scope.highLightBody = function () { + + // alert('highlight body is called'); + angular.forEach($scope.ColoredImageSRC, function (value, key) { + + + var id; + if (value.haveMirror == 'true') { + id = 'imageCanvas' + value.bodyRegionId + '_MR'; + } + else { + id = 'imageCanvas' + value.bodyRegionId; + } + + var imageCanvas = document.getElementById(id); + + var context_gray = imageCanvas.getContext('2d'); + + var dataURL = imageCanvas.toDataURL(); + + + var img = new Image(); + + img.src = dataURL; + + + var DAData = new BitmapData(img.width, img.height); + DAData.draw(img); + var RED = 0.3086; // luminance contrast value for red + var GREEN = 0.694; // luminance contrast value for green + var BLUE = 0.0820; // luminance contrast value for blue + + var RGB = [RED, GREEN, BLUE, 0, 0]; + var RGB2 = [RED, GREEN, BLUE, 0, 0]; + var RGB3 = [RED, GREEN, BLUE, 0, 0]; + var ALPHA = [0, 0, 0, 1, 0]; + + var rgbPx = RGB.concat(RGB2); + var rgbPx2 = rgbPx.concat(RGB3); + var matrix = rgbPx2.concat(ALPHA); + + var zeroPoint = new Point(); + var grayScale = new ColorMatrixFilter(matrix); + DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale); + + context_gray.putImageData(DAData.data, 0, 0) + + }); + + } $scope.OnGenderChange = function (event) { debugger; @@ -2522,6 +2630,4 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }] - - ); -- libgit2 0.21.4