Changeset 7625 for ImageMagick/branches/ImageMagick-6/magick/composite.c
- Timestamp:
- 04/25/12 00:47:23 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ImageMagick/branches/ImageMagick-6/magick/composite.c
r7603 r7625 1646 1646 return(MagickFalse); 1647 1647 GetMagickPixelPacket(image,&zero); 1648 exception=(&image->exception); 1648 1649 destination_image=(Image *) NULL; 1649 1650 amount=0.5; … … 1687 1688 break; 1688 1689 status=MagickTrue; 1689 exception=(&image->exception);1690 1690 composite_view=AcquireVirtualCacheView(composite_image,exception); 1691 1691 image_view=AcquireAuthenticCacheView(image,exception); … … 1783 1783 1784 1784 /* 1785 Blur Image by resampling. 1786 1785 1787 Blur Image dictated by an overlay gradient map: X = red_channel; 1786 1788 Y = green_channel; compose:args = x_scale[,y_scale[,angle]]. 1787 1789 */ 1788 1790 destination_image=CloneImage(image,image->columns,image->rows,MagickTrue, 1789 &image->exception);1791 exception); 1790 1792 if (destination_image == (Image *) NULL) 1791 1793 return(MagickFalse); 1792 1794 /* 1793 Determine the horizontal and vertical maximim blur.1795 Gather the maximum blur sigma values from user. 1794 1796 */ 1795 1797 SetGeometryInfo(&geometry_info); … … 1799 1801 flags=ParseGeometry(value,&geometry_info); 1800 1802 if ((flags & WidthValue) == 0 ) { 1803 (void) ThrowMagickException(exception,GetMagickModule(), 1804 OptionWarning,"InvalidGeometry","'%s' '%s'", 1805 "compose:args",value); 1801 1806 destination_image=DestroyImage(destination_image); 1802 1807 return(MagickFalse); 1803 1808 } 1804 /* Width and height of ellipse. 1805 Note: The Gaussian Filter uses a sigma = 0.5, so to compensate the 1806 input sigma must be doubled to give a correct 'area to resample'. 1809 /* 1810 Users input sigma now needs to be converted to the EWA ellipse size. 1811 The filter defaults to a sigma of 0.5 so to make this match 1812 the elipse size needs to be doubled. 1807 1813 */ 1808 1814 width=height=geometry_info.rho*2.0; 1809 1815 if ((flags & HeightValue) != 0 ) 1810 1816 height=geometry_info.sigma*2.0; 1811 1812 /* Hack -- this make gaussian work! -- But it is not needed for cubic! */1813 width*=2.0; height*=2.0;1814 1817 1815 1818 /* default the unrotated ellipse width and height axis vectors */ … … 1830 1833 blur.y2=height*cos(angle); 1831 1834 } 1832 /* otherwise lets set a angle range and calculate in the loop */1835 /* Otherwise lets set a angle range and calculate in the loop */ 1833 1836 angle_start=0.0; 1834 1837 angle_range=0.0; … … 1839 1842 } 1840 1843 /* 1841 Blur Image by resampling. 1842 1843 FUTURE: this is currently broken, especially for small sigma blurs 1844 This needs to be fixed to use a non-user filter setup that provides 1845 far more control than currently available. 1846 1847 It should also be set to GaussianFilter, but it is not being effected 1848 by ScaleResampleFilter() for some reason. 1844 Set up a gaussian cylindrical filter for EWA Bluring. 1845 1846 FUTURE: Currently broken, small sigma blurs 1847 (either goes to zero earily, or blurs on zero blurs) 1848 1849 Also need to prevent user 'expert' filter options overriding the 1850 filter settings I am carfully setting up for image blurring. 1849 1851 */ 1852 resample_filter=AcquireResampleFilter(image,exception); 1853 SetResampleFilter(resample_filter,GaussianFilter,1.0); 1854 1855 /* do the variable blurring of each pixel in image */ 1850 1856 pixel=zero; 1851 exception=(&image->exception);1852 resample_filter=AcquireResampleFilter(image,&image->exception);1853 SetResampleFilter(resample_filter,GaussianFilter,1.0);1854 1857 composite_view=AcquireVirtualCacheView(composite_image,exception); 1855 1858 destination_view=AcquireAuthenticCacheView(destination_image,exception); … … 1876 1879 1,exception); 1877 1880 r=QueueCacheViewAuthenticPixels(destination_view,0,y, 1878 destination_image->columns,1, &image->exception);1881 destination_image->columns,1,exception); 1879 1882 if ((p == (const PixelPacket *) NULL) || (r == (PixelPacket *) NULL)) 1880 1883 break; … … 1960 1963 */ 1961 1964 destination_image=CloneImage(image,image->columns,image->rows,MagickTrue, 1962 &image->exception);1965 exception); 1963 1966 if (destination_image == (Image *) NULL) 1964 1967 return(MagickFalse); … … 2041 2044 */ 2042 2045 pixel=zero; 2043 exception=(&image->exception);2044 2046 image_view=AcquireVirtualCacheView(image,exception); 2045 2047 composite_view=AcquireVirtualCacheView(composite_image,exception); … … 2061 2063 1,exception); 2062 2064 r=QueueCacheViewAuthenticPixels(destination_view,0,y, 2063 destination_image->columns,1, &image->exception);2065 destination_image->columns,1,exception); 2064 2066 if ((p == (const PixelPacket *) NULL) || (r == (PixelPacket *) NULL)) 2065 2067 break; … … 2214 2216 midpoint=((MagickRealType) QuantumRange+1.0)/2; 2215 2217 GetMagickPixelPacket(composite_image,&zero); 2216 exception=(&image->exception);2217 2218 composite_view=AcquireVirtualCacheView(composite_image,exception); 2218 2219 image_view=AcquireAuthenticCacheView(image,exception);
Note: See TracChangeset
for help on using the changeset viewer.
