org.jpedal.parser.image.downsample.DownSampler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OpenViewerFX Show documentation
Show all versions of OpenViewerFX Show documentation
Open Source (LGPL) JavaFX PDF Viewer for NetBeans plugin
/*
* ===========================================
* Java Pdf Extraction Decoding Access Library
* ===========================================
*
* Project Info: http://www.idrsolutions.com
* Help section for developers at http://www.idrsolutions.com/support/
*
* (C) Copyright 1997-2017 IDRsolutions and Contributors.
*
* This file is part of JPedal/JPDF2HTML5
*
@LICENSE@
*
* ---------------
* DownSampler.java
* ---------------
*/
package org.jpedal.parser.image.downsample;
import org.jpedal.color.GenericColorSpace;
import org.jpedal.parser.image.data.ImageData;
/**
* @author markee
*/
public class DownSampler {
public static GenericColorSpace downSampleImage(GenericColorSpace decodeColorData,
final ImageData imageData, final byte[] maskCol, final int sampling) {
if (sampling > 1) { //safety check
imageData.setIsDownsampled(true);
switch (imageData.getDepth()) {
case 1:
decodeColorData = OneBitDownSampler.downSample(decodeColorData, maskCol, sampling, imageData);
break;
case 8:
decodeColorData = EightBitDownSampler.downSample(imageData, decodeColorData, sampling);
break;
}
}
return decodeColorData;
}
}