From 2f15deae2b2cbbc94c683d1e82285c1c6183d5d1 Mon Sep 17 00:00:00 2001 From: nikita Date: Thu, 20 Apr 2017 18:27:02 +0530 Subject: [PATCH] tried multiple approch byt gray issue is not resolved --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------- 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 02e9323..4ca7d0f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -4223,7 +4223,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.loadTransparencyImage = function (bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged, isResized) { - + $scope.IncludedBodyRegions.push({ 'BRID': bodyRegionId }); var transparencyCanvas = document.getElementById('transparencyCanvas'); @@ -4461,7 +4461,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var contxModestyTemp = document.getElementById(modestyTempCanvasId).getContext('2d'); var tbTempCanvas = document.getElementById(tempCanvasID) contxModestyTemp.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); - + $scope.transparencyDrawnRegions.push({ 'BRID': bodyRegionId }); } } else { @@ -4470,12 +4470,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var contx = document.getElementById('tempCanvas').getContext('2d'); var tbTempCanvas = document.getElementById(tempCanvasID) contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); + $scope.transparencyDrawnRegions.push({ 'BRID': bodyRegionId }); } } - - $scope.DrawOnTBWithSelectedTransparency(tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId); - + if ($scope.transparencyDrawnRegions.length == $scope.IncludedBodyRegions.length) { + $scope.DrawOnTBWithSelectedTransparency(tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId); + } } @@ -4746,14 +4747,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var transNumber = $scope.transNumber;//txtTransparencyChange.value; //this changes the transparency when transparency is already activated and user resizes or chage the layer - var tempCtx = document.getElementById(tempCanvasID).getContext('2d'); + var tempCtx = document.getElementById('tempCanvas').getContext('2d'); - var imageD = tempCtx.getImageData(0, 0, Width, Height); - var imageData = imageD.data; - var length = imageData.length; + + + var transC = document.getElementById('transparencyCanvas'); + var ctx = transC.getContext('2d'); + var height = parseInt(((transC.style.height).toString()).replace('px', '')); + var width = parseInt(((transC.style.width).toString()).replace('px', '')); + + var tempCanavsImageData = tempCtx.getImageData(0, 0, width, height); + + + ctx.putImageData(tempCanavsImageData, 0, 0); // set every fourth value to the desired number of transparency + var transCanvasImgData = ctx.getImageData(0, 0, width, height); + var imageData = transCanvasImgData.data; + var length = imageData.length; for (var i = 3; i < length; i += 4) { if ($scope.voId == "9" || $scope.voId == "11") { @@ -4772,68 +4784,68 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - tempCtx.putImageData(imageD, 0, 0); + ctx.putImageData(transCanvasImgData, 0, 0); - $scope.widthOfImage = WidthforTransImage; - $scope.heightOfImage = HeightforTransImage; - $scope.xOfImage = XforTransImage; - $scope.yOfImage = YforTransImage; + // $scope.widthOfImage = WidthforTransImage; + // $scope.heightOfImage = HeightforTransImage; + // $scope.xOfImage = XforTransImage; + // $scope.yOfImage = YforTransImage; - var ctx = transparencyCanvas.getContext('2d'); + // var ctx = transparencyCanvas.getContext('2d'); - var tmpCanvasContext = document.getElementById(tempCanvasID);//.getContext('2d'); + // var tmpCanvasContext = document.getElementById(tempCanvasID);//.getContext('2d'); - var ctx; - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { - var modestyTransCanvasId = 'modestyTransCanavs_' + bodyRegionId - ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); - } - else - ctx = transparencyCanvas.getContext('2d'); + // var ctx; + // if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + // var modestyTransCanvasId = 'modestyTransCanavs_' + bodyRegionId + // ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); + // } + // else + // ctx = transparencyCanvas.getContext('2d'); - // var ctx = transparencyCanvas.getContext('2d'); - ctx.drawImage(tmpCanvasContext, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage) + // // var ctx = transparencyCanvas.getContext('2d'); + // ctx.drawImage(tmpCanvasContext, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage) - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + // if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { - var imageD1 = ctx.getImageData(0, 0, Width, Height); - var imageData1 = imageD1.data; - var length1 = imageData1.length; + // var imageD1 = ctx.getImageData(0, 0, Width, Height); + // var imageData1 = imageD1.data; + // var length1 = imageData1.length; - // set every fourth value to the desired number of transparency - for (var i = 0; i < imageData1.length; i += 4) { - if (imageData1[i] == imageData1[i + 1] && imageData1[i + 1] == imageData1[i + 2] && imageData1[i + 2] === 0) { - imageData1[i + 3] = 0; - } + // // set every fourth value to the desired number of transparency + // for (var i = 0; i < imageData1.length; i += 4) { + // if (imageData1[i] == imageData1[i + 1] && imageData1[i + 1] == imageData1[i + 2] && imageData1[i + 2] === 0) { + // imageData1[i + 3] = 0; + // } - } + // } - ctx.putImageData(imageD1, 0, 0); + // ctx.putImageData(imageD1, 0, 0); - } + // } - // $scope.transparencyDrawnRegions.push(bodyRegionId); - $scope.transparencyDrawnRegions.push({ 'BRID': bodyRegionId }); + // // $scope.transparencyDrawnRegions.push(bodyRegionId); + //// $scope.transparencyDrawnRegions.push({ 'BRID': bodyRegionId }); - $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); + // $rootScope.isLoading = false; + // $('#spinner').css('visibility', 'hidden'); - if ($scope.transparencyDrawnRegions.length == $scope.IncludedBodyRegions.length) { + // if ($scope.transparencyDrawnRegions.length == $scope.IncludedBodyRegions.length) { - transparencyCanvas.style.visibility = 'visible'; - $('.rectangle').remove(); + // transparencyCanvas.style.visibility = 'visible'; + // $('.rectangle').remove(); - } + // } } -- libgit2 0.21.4