/* PictureHelper.java

	Purpose:
		
	Description:
		
	History:
		Oct 28, 2011 8:22:13 AM, Created by henri

Copyright (C) 2011 Potix Corporation. All Rights Reserved.
*/
package org.zkoss.zssex.util;

import org.zkoss.poi.ss.usermodel.Workbook;

/**
 * @author henri
 *
 */
public class PictureHelper {
	/**
	 * Returns the picture format type of the specified file extension.
	 * @param ext file extension
	 * @return the picture format type of the specified file extension.
	 */
	public static int getPictureFormat(String ext) {
		if ("jpg".equals(ext) || "jpeg".equals(ext)) {
			return Workbook.PICTURE_TYPE_JPEG; 
		} else if ("png".equals(ext)) {
			return Workbook.PICTURE_TYPE_PNG;
/*		} else if ("bmp".equals(fmt) || "dib".equals(fmt) || "rle".equals(fmt)) {
			return Workbook.PICTURE_TYPE_DIB;
		} else if ("emf".equals(fmt)) { 
			return Workbook.PICTURE_TYPE_EMF;
		} else if ("pcx".equals(fmt)) {
			return Workbook.PICTURE_TYPE_PICT;
		} else if ("wmf".equals(fmt)) {
			return Workbook.PICTURE_TYPE_WMF;
*/		} else {
			throw new RuntimeException("Unsupport picture format:"+ext);
		}
	}
}
