~ubuntu-branches/debian/sid/wordpress/sid

« back to all changes in this revision

Viewing changes to debian/missing-sources/plupload-1.5.7/csharp/Plupload/FJCore/Filter/FilterLowpassResize.cs

  • Committer: Package Import Robot
  • Author(s): Craig Small
  • Date: 2014-04-16 22:48:26 UTC
  • mfrom: (1.2.34)
  • Revision ID: package-import@ubuntu.com-20140416224826-087tu71aw8bjhvmd
Tags: 3.8.3+dfsg-1
New upstream release - fixes Quick Draft tool that broke in 3.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/// Copyright (c) 2009 Jeffrey Powers for Occipital Open Source.
2
 
/// Under the MIT License, details: License.txt.
3
 
 
4
 
namespace FluxJpeg.Core.Filtering
5
 
{
6
 
    using System;
7
 
 
8
 
    internal class LowpassResize : Filter
9
 
    {
10
 
        protected override void ApplyFilter()
11
 
        {
12
 
            // get source image size
13
 
            int width = _sourceData[0].GetLength(0),
14
 
                height = _sourceData[0].GetLength(1);
15
 
 
16
 
            int channels = _sourceData.Length;
17
 
 
18
 
            // Estimate a good filter size for the gaussian.
19
 
            // Note that gaussian isn't an ideal bandpass filter
20
 
            //  so this is an experimentally determined quantity
21
 
            double std = (width / _newWidth) * 0.50;
22
 
 
23
 
            for(int i = 0; i < channels; i++)
24
 
            {
25
 
                GrayImage channel = new GrayImage(_sourceData[i]);
26
 
 
27
 
                channel = Convolution.Instance.GaussianConv(channel, std);
28
 
 
29
 
                _sourceData[i] = channel.ToByteArray2D();
30
 
            }
31
 
 
32
 
            // number of pixels to shift in the original image
33
 
            double xStep = (double)width / _newWidth,
34
 
                   yStep = (double)height / _newHeight;
35
 
 
36
 
 
37
 
            NNResize resizer = new NNResize();
38
 
 
39
 
             _destinationData = resizer.Apply(_sourceData, _newWidth, _newHeight);
40
 
 
41
 
 
42
 
        }
43
 
    }
44
 
}