
org.jpedal.parser.image.ThreeComponentImage Maven / Gradle / Ivy
/*
* ===========================================
* 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-2015 IDRsolutions and Contributors.
*
* This file is part of JPedal/JPDF2HTML5
*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* ---------------
* ThreeComponentImage.java
* ---------------
*/
package org.jpedal.parser.image;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.Raster;
import java.util.Arrays;
import org.jpedal.images.ImageOps;
import org.jpedal.io.ColorSpaceConvertor;
import org.jpedal.utils.LogWriter;
/**
*
* @author markee
*/
class ThreeComponentImage {
public static BufferedImage make(int d, byte[] data, byte[] index, int w, int h) {
BufferedImage image;
//some odd files with 16 bit need to be down-sampled to work with 8 bit (fogbugz 15839)
// baseline_screens/14jan/fatt18SKYspeseOND13.pdf
if(d==16){
final int origSize=data.length;
final int newSize=origSize/2;
final byte[] newData=new byte[newSize];
for(int ptr=0;ptr© 2015 - 2025 Weber Informatics LLC | Privacy Policy