Commit 2f15deae2b2cbbc94c683d1e82285c1c6183d5d1
1 parent
222f5c84
tried multiple approch byt gray issue is not resolved
Showing
1 changed file
with
57 additions
and
45 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -4223,7 +4223,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4223 | 4223 | } |
4224 | 4224 | |
4225 | 4225 | $scope.loadTransparencyImage = function (bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged, isResized) { |
4226 | - | |
4226 | + $scope.IncludedBodyRegions.push({ 'BRID': bodyRegionId }); | |
4227 | 4227 | |
4228 | 4228 | var transparencyCanvas = document.getElementById('transparencyCanvas'); |
4229 | 4229 | |
... | ... | @@ -4461,7 +4461,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4461 | 4461 | var contxModestyTemp = document.getElementById(modestyTempCanvasId).getContext('2d'); |
4462 | 4462 | var tbTempCanvas = document.getElementById(tempCanvasID) |
4463 | 4463 | contxModestyTemp.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); |
4464 | - | |
4464 | + $scope.transparencyDrawnRegions.push({ 'BRID': bodyRegionId }); | |
4465 | 4465 | } |
4466 | 4466 | } |
4467 | 4467 | else { |
... | ... | @@ -4470,12 +4470,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4470 | 4470 | var contx = document.getElementById('tempCanvas').getContext('2d'); |
4471 | 4471 | var tbTempCanvas = document.getElementById(tempCanvasID) |
4472 | 4472 | contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); |
4473 | + $scope.transparencyDrawnRegions.push({ 'BRID': bodyRegionId }); | |
4473 | 4474 | |
4474 | 4475 | } |
4475 | 4476 | } |
4476 | - | |
4477 | - $scope.DrawOnTBWithSelectedTransparency(tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId); | |
4478 | - | |
4477 | + if ($scope.transparencyDrawnRegions.length == $scope.IncludedBodyRegions.length) { | |
4478 | + $scope.DrawOnTBWithSelectedTransparency(tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId); | |
4479 | + } | |
4479 | 4480 | } |
4480 | 4481 | |
4481 | 4482 | |
... | ... | @@ -4746,14 +4747,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4746 | 4747 | var transNumber = $scope.transNumber;//txtTransparencyChange.value; |
4747 | 4748 | //this changes the transparency when transparency is already activated and user resizes or chage the layer |
4748 | 4749 | |
4749 | - var tempCtx = document.getElementById(tempCanvasID).getContext('2d'); | |
4750 | + var tempCtx = document.getElementById('tempCanvas').getContext('2d'); | |
4750 | 4751 | |
4751 | - var imageD = tempCtx.getImageData(0, 0, Width, Height); | |
4752 | - var imageData = imageD.data; | |
4753 | - var length = imageData.length; | |
4752 | + | |
4753 | + | |
4754 | + var transC = document.getElementById('transparencyCanvas'); | |
4755 | + var ctx = transC.getContext('2d'); | |
4756 | + var height = parseInt(((transC.style.height).toString()).replace('px', '')); | |
4757 | + var width = parseInt(((transC.style.width).toString()).replace('px', '')); | |
4758 | + | |
4759 | + var tempCanavsImageData = tempCtx.getImageData(0, 0, width, height); | |
4760 | + | |
4761 | + | |
4754 | 4762 | |
4763 | + ctx.putImageData(tempCanavsImageData, 0, 0); | |
4755 | 4764 | |
4756 | 4765 | // set every fourth value to the desired number of transparency |
4766 | + var transCanvasImgData = ctx.getImageData(0, 0, width, height); | |
4767 | + var imageData = transCanvasImgData.data; | |
4768 | + var length = imageData.length; | |
4757 | 4769 | for (var i = 3; i < length; i += 4) { |
4758 | 4770 | if ($scope.voId == "9" || $scope.voId == "11") { |
4759 | 4771 | |
... | ... | @@ -4772,68 +4784,68 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4772 | 4784 | |
4773 | 4785 | } |
4774 | 4786 | |
4775 | - tempCtx.putImageData(imageD, 0, 0); | |
4787 | + ctx.putImageData(transCanvasImgData, 0, 0); | |
4776 | 4788 | |
4777 | 4789 | |
4778 | - $scope.widthOfImage = WidthforTransImage; | |
4779 | - $scope.heightOfImage = HeightforTransImage; | |
4780 | - $scope.xOfImage = XforTransImage; | |
4781 | - $scope.yOfImage = YforTransImage; | |
4790 | + // $scope.widthOfImage = WidthforTransImage; | |
4791 | + // $scope.heightOfImage = HeightforTransImage; | |
4792 | + // $scope.xOfImage = XforTransImage; | |
4793 | + // $scope.yOfImage = YforTransImage; | |
4782 | 4794 | |
4783 | - var ctx = transparencyCanvas.getContext('2d'); | |
4795 | + // var ctx = transparencyCanvas.getContext('2d'); | |
4784 | 4796 | |
4785 | 4797 | |
4786 | - var tmpCanvasContext = document.getElementById(tempCanvasID);//.getContext('2d'); | |
4798 | + // var tmpCanvasContext = document.getElementById(tempCanvasID);//.getContext('2d'); | |
4787 | 4799 | |
4788 | 4800 | |
4789 | 4801 | |
4790 | - var ctx; | |
4791 | - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { | |
4792 | - var modestyTransCanvasId = 'modestyTransCanavs_' + bodyRegionId | |
4793 | - ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); | |
4794 | - } | |
4795 | - else | |
4796 | - ctx = transparencyCanvas.getContext('2d'); | |
4802 | + // var ctx; | |
4803 | + // if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { | |
4804 | + // var modestyTransCanvasId = 'modestyTransCanavs_' + bodyRegionId | |
4805 | + // ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); | |
4806 | + // } | |
4807 | + // else | |
4808 | + // ctx = transparencyCanvas.getContext('2d'); | |
4797 | 4809 | |
4798 | - // var ctx = transparencyCanvas.getContext('2d'); | |
4799 | - ctx.drawImage(tmpCanvasContext, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage) | |
4810 | + // // var ctx = transparencyCanvas.getContext('2d'); | |
4811 | + // ctx.drawImage(tmpCanvasContext, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage) | |
4800 | 4812 | |
4801 | 4813 | |
4802 | - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { | |
4814 | + // if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { | |
4803 | 4815 | |
4804 | - var imageD1 = ctx.getImageData(0, 0, Width, Height); | |
4805 | - var imageData1 = imageD1.data; | |
4806 | - var length1 = imageData1.length; | |
4816 | + // var imageD1 = ctx.getImageData(0, 0, Width, Height); | |
4817 | + // var imageData1 = imageD1.data; | |
4818 | + // var length1 = imageData1.length; | |
4807 | 4819 | |
4808 | 4820 | |
4809 | - // set every fourth value to the desired number of transparency | |
4810 | - for (var i = 0; i < imageData1.length; i += 4) { | |
4811 | - if (imageData1[i] == imageData1[i + 1] && imageData1[i + 1] == imageData1[i + 2] && imageData1[i + 2] === 0) { | |
4812 | - imageData1[i + 3] = 0; | |
4813 | - } | |
4821 | + // // set every fourth value to the desired number of transparency | |
4822 | + // for (var i = 0; i < imageData1.length; i += 4) { | |
4823 | + // if (imageData1[i] == imageData1[i + 1] && imageData1[i + 1] == imageData1[i + 2] && imageData1[i + 2] === 0) { | |
4824 | + // imageData1[i + 3] = 0; | |
4825 | + // } | |
4814 | 4826 | |
4815 | - } | |
4827 | + // } | |
4816 | 4828 | |
4817 | 4829 | |
4818 | - ctx.putImageData(imageD1, 0, 0); | |
4830 | + // ctx.putImageData(imageD1, 0, 0); | |
4819 | 4831 | |
4820 | - } | |
4832 | + // } | |
4821 | 4833 | |
4822 | 4834 | |
4823 | 4835 | |
4824 | - // $scope.transparencyDrawnRegions.push(bodyRegionId); | |
4825 | - $scope.transparencyDrawnRegions.push({ 'BRID': bodyRegionId }); | |
4836 | + // // $scope.transparencyDrawnRegions.push(bodyRegionId); | |
4837 | + //// $scope.transparencyDrawnRegions.push({ 'BRID': bodyRegionId }); | |
4826 | 4838 | |
4827 | - $rootScope.isLoading = false; | |
4828 | - $('#spinner').css('visibility', 'hidden'); | |
4839 | + // $rootScope.isLoading = false; | |
4840 | + // $('#spinner').css('visibility', 'hidden'); | |
4829 | 4841 | |
4830 | - if ($scope.transparencyDrawnRegions.length == $scope.IncludedBodyRegions.length) { | |
4842 | + // if ($scope.transparencyDrawnRegions.length == $scope.IncludedBodyRegions.length) { | |
4831 | 4843 | |
4832 | - transparencyCanvas.style.visibility = 'visible'; | |
4833 | - $('.rectangle').remove(); | |
4844 | + // transparencyCanvas.style.visibility = 'visible'; | |
4845 | + // $('.rectangle').remove(); | |
4834 | 4846 | |
4835 | 4847 | |
4836 | - } | |
4848 | + // } | |
4837 | 4849 | } |
4838 | 4850 | |
4839 | 4851 | ... | ... |