summaryrefslogtreecommitdiffstats
path: root/vcl/inc
diff options
context:
space:
mode:
authorTomaz Vajngerl <quikee@gmail.com>2012-06-02 20:16:36 +0200
committerJan Holesovsky <kendy@suse.cz>2012-06-04 16:12:43 +0200
commit47e0df5cebc05576e55210c5dd408a6f3eb91700 (patch)
tree4c0db048267ba6064b1cea4915e81f6b381927e3 /vcl/inc
parentfdo#50628 fix resource file name (diff)
downloadcore-47e0df5cebc05576e55210c5dd408a6f3eb91700.tar.gz
core-47e0df5cebc05576e55210c5dd408a6f3eb91700.zip
fdo#46378: Lanczos3 resampling of images added to Bitmap.
Current resampling methods for images are FAST and INTERPOLATE. FAST is used where speed of resampling is required, on the other hand INTERPOLATE resampling is used when we need quality. For example INTERPOLATE resampling method is used at PDF export. INTERPOLATE resampling uses bilinear interpolation which is known to be lower quality as other modern (and slower) resampling algorithms such as Lanczos, Mitchell or BiCubic resampling. This change adds Lanczos resampling to the Bitmap class and enables Lanczos resampling in PDF export. Lanczos3 resampling is implmented using separable convolution with which it is also possible to easily add other resampling methods like BiCubic just by changing the kernel function. Change-Id: I8dff5b65753b09dffd5bc34f2343d9818efb3e58
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/vcl/bitmap.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx
index 17041d809e74..14aae27f1b62 100644
--- a/vcl/inc/vcl/bitmap.hxx
+++ b/vcl/inc/vcl/bitmap.hxx
@@ -49,6 +49,7 @@
#define BMP_SCALE_NONE 0x00000000UL
#define BMP_SCALE_FAST 0x00000001UL
#define BMP_SCALE_INTERPOLATE 0x00000002UL
+#define BMP_SCALE_LANCZOS 0x00000003UL
// -----------------------------------------------------------------------------
@@ -276,6 +277,18 @@ public:
SAL_DLLPRIVATE sal_Bool ImplScaleFast( const double& rScaleX, const double& rScaleY );
SAL_DLLPRIVATE sal_Bool ImplScaleInterpolate( const double& rScaleX, const double& rScaleY );
+ SAL_DLLPRIVATE bool ImplScaleLanczos( const double& rScaleX, const double& rScaleY );
+
+ SAL_DLLPRIVATE void ImplCalculateContributions( const int aSourceSize, const int aDestinationSize,
+ const double aSupport, const int aNumberOfContributions,
+ double* pWeights, int* pPixels, int* pCount );
+ SAL_DLLPRIVATE bool ImplHorizontalConvolution( Bitmap& aNewBitmap, BitmapReadAccess* pReadAcc,
+ int aNumberOfContributions, double* pWeights, int* pPixels, int* pCount );
+ SAL_DLLPRIVATE bool ImplVerticalConvolution( Bitmap& aNewBitmap, BitmapReadAccess* pReadAcc,
+ int aNumberOfContributions, double* pWeights, int* pPixels, int* pCount );
+
+ SAL_DLLPRIVATE static double ImplLanczosKernel( const double aValue, const double aSupport );
+
SAL_DLLPRIVATE sal_Bool ImplMakeMono( sal_uInt8 cThreshold );
SAL_DLLPRIVATE sal_Bool ImplMakeMonoDither();
SAL_DLLPRIVATE sal_Bool ImplMakeGreyscales( sal_uInt16 nGreyscales );