当前位置: 首页>>代码示例>>Java>>正文


Java PsdDescriptor类代码示例

本文整理汇总了Java中psd.parser.object.PsdDescriptor的典型用法代码示例。如果您正苦于以下问题:Java PsdDescriptor类的具体用法?Java PsdDescriptor怎么用?Java PsdDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PsdDescriptor类属于psd.parser.object包,在下文中一共展示了PsdDescriptor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import psd.parser.object.PsdDescriptor; //导入依赖的package包/类
@Override
 public void actionPerformed(ActionEvent e) {
     FileDialog fileDialog = new FileDialog(frame, "Open psd file", FileDialog.LOAD);
     // fileDialog.setDirectory("~/Downloads");
     fileDialog.setFilenameFilter(new FilenameFilter() {
         @Override
         public boolean accept(File dir, String name) {
             return name.toLowerCase().endsWith(".psd");
         }
     });

     fileDialog.setVisible(true);
     if (fileDialog.getFile() != null) {
         File directory = new File(fileDialog.getDirectory());
         File psdFile = new File(directory, fileDialog.getFile());
         try {
             Psd psd = new Psd(psdFile) {
             	@Override
             	protected Layer createLayer(LayerParser parser) {
             		parser.putAdditionalInformationParser(LayerTypeToolParser.TAG, new LayerTypeToolParser(new LayerTypeToolHandler() {
	
	@Override
	public void typeToolTransformParsed(Matrix transform) {
		System.out.println("transform: " + transform);
		
	}
	
	@Override
	public void typeToolDescriptorParsed(int version, PsdDescriptor descriptor) {
		System.out.println("version: " + version + ", " + descriptor);
	}
}));
             		return super.createLayer(parser);
             	}
             };
             treeLayerModel.setPsd(psd);
             psdView.setPsd(psd);
         } catch (IOException ex) {
             throw new RuntimeException(ex);
         }
     }
 }
 
开发者ID:prithivraj,项目名称:java-psd-library,代码行数:43,代码来源:MainFrame.java

示例2: parse

import psd.parser.object.PsdDescriptor; //导入依赖的package包/类
public void parse(PsdInputStream stream) throws IOException {
	int length = stream.readInt();
	int pos = stream.getPos();
	while (length > 0) {
		String tag = stream.readString(4);
		if (!tag.equals(PSD_TAG) && !tag.equals("MeSa")) {
			throw new IOException("Format error: Invalid image resources section.: " + tag);
		}
		length -= 4;
		int id = stream.readShort();
		length -= 2;

		int sizeOfName = stream.readByte() & 0xFF;
		if ((sizeOfName & 0x01) == 0)
			sizeOfName++;
		@SuppressWarnings("unused")
		String name = stream.readString(sizeOfName);
		length -= sizeOfName + 1;

		int sizeOfData = stream.readInt();
		length -= 4;
		if ((sizeOfData & 0x01) == 1)
			sizeOfData++;
		length -= sizeOfData;
		int storePos = stream.getPos();

		// TODO FIXME Is id correct?
		if (sizeOfData > 0 && tag.equals(PSD_TAG) && id >= 4000 && id < 5000) {
			String key = stream.readString(4);
			if (key.equals("mani")) {
				stream.skipBytes(12 + 12); // unknown data
				PsdDescriptor descriptor = new PsdDescriptor(stream);
				if (handler != null) {
					handler.imageResourceManiSectionParsed(descriptor);
				}
			}
		}
		stream.skipBytes(sizeOfData - (stream.getPos() - storePos));
	}
	stream.skipBytes(length - (stream.getPos() - pos));
}
 
开发者ID:prithivraj,项目名称:java-psd-library,代码行数:42,代码来源:ImageResourceSectionParser.java

示例3: parse

import psd.parser.object.PsdDescriptor; //导入依赖的package包/类
public int parse(PsdInputStream stream) throws IOException {
	int length = stream.readInt();
	int pos = stream.getPos();
	int id = 0;
	while (length > 0) {
		String tag = stream.readString(4);
		if (!tag.equals(PSD_TAG) && !tag.equals("MeSa")) {
			throw new IOException("Format error: Invalid image resources section.: " + tag);
		}
		length -= 4;
		// Save ID
		id = stream.readShort();
		length -= 2;

		int sizeOfName = stream.readByte() & 0xFF;
		if ((sizeOfName & 0x01) == 0)
			sizeOfName++;
		@SuppressWarnings("unused")
		String name = stream.readString(sizeOfName);
		length -= sizeOfName + 1;

		int sizeOfData = stream.readInt();
		length -= 4;
		if ((sizeOfData & 0x01) == 1)
			sizeOfData++;
		length -= sizeOfData;
		int storePos = stream.getPos();

		// TODO FIXME Is id correct?
		if (sizeOfData > 0 && tag.equals(PSD_TAG) && id >= 4000 && id < 5000) {
			String key = stream.readString(4);
			if (key.equals("mani")) {
				stream.skipBytes(12 + 12); // unknown data
				PsdDescriptor descriptor = new PsdDescriptor(stream);
				if (handler != null) {
					handler.imageResourceManiSectionParsed(descriptor);
				}
			}
		}
		stream.skipBytes(sizeOfData - (stream.getPos() - storePos));
	}
	stream.skipBytes(length - (stream.getPos() - pos));
	return id;
}
 
开发者ID:ChebyrTech,项目名称:PSD2html,代码行数:45,代码来源:ImageResourceSectionParser.java

示例4: getPsdDescriptor

import psd.parser.object.PsdDescriptor; //导入依赖的package包/类
public PsdDescriptor getPsdDescriptor() {
    return psdDescriptor;
}
 
开发者ID:ChebyrTech,项目名称:PSD2html,代码行数:4,代码来源:Layer.java

示例5: parse

import psd.parser.object.PsdDescriptor; //导入依赖的package包/类
public void parse(PsdInputStream stream) throws IOException {
	int length = stream.readInt();
	int pos = stream.getPos();
	while (length > 0) {
		String tag = stream.readString(4);
		/**
		 * MeSa is not a valid signature anymore
		 * if (!tag.equals(PSD_TAG) && !tag.equals("MeSa")) {
		 */
		if (!tag.equals(PSD_TAG)) {
			throw new IOException("Format error: Invalid image resources section.: " + tag);
		}
		length -= 4;
		int id = stream.readShort();
		length -= 2;

		int sizeOfName = stream.readByte() & 0xFF;
		if ((sizeOfName & 0x01) == 0)
			sizeOfName++;
		@SuppressWarnings("unused")
		String name = stream.readString(sizeOfName);
		length -= sizeOfName + 1;

		int sizeOfData = stream.readInt();
		length -= 4;
		if ((sizeOfData & 0x01) == 1)
			sizeOfData++;
		length -= sizeOfData;
		int storePos = stream.getPos();

		// TODO FIXME Is id correct?
		if (sizeOfData > 0 && tag.equals(PSD_TAG) && id >= 4000 && id < 5000) {
			String key = stream.readString(4);
			if (key.equals("mani")) {
				stream.skipBytes(12 + 12); // unknown data
				PsdDescriptor descriptor = new PsdDescriptor(stream);
				if (handler != null) {
					handler.imageResourceManiSectionParsed(descriptor);
				}
			}
		}
		stream.skipBytes(sizeOfData - (stream.getPos() - storePos));
	}
	stream.skipBytes(length - (stream.getPos() - pos));
}
 
开发者ID:glovas,项目名称:psd-ui-generator,代码行数:46,代码来源:ImageResourceSectionParser.java

示例6: imageResourceManiSectionParsed

import psd.parser.object.PsdDescriptor; //导入依赖的package包/类
public void imageResourceManiSectionParsed(PsdDescriptor descriptor); 
开发者ID:prithivraj,项目名称:java-psd-library,代码行数:2,代码来源:ImageResourceSectionHandler.java

示例7: metaDataMlstSectionParsed

import psd.parser.object.PsdDescriptor; //导入依赖的package包/类
public void metaDataMlstSectionParsed(PsdDescriptor descriptor); 
开发者ID:prithivraj,项目名称:java-psd-library,代码行数:2,代码来源:LayerMetaDataHandler.java

示例8: typeToolDescriptorParsed

import psd.parser.object.PsdDescriptor; //导入依赖的package包/类
public void typeToolDescriptorParsed(int version, PsdDescriptor descriptor); 
开发者ID:prithivraj,项目名称:java-psd-library,代码行数:2,代码来源:LayerTypeToolHandler.java


注:本文中的psd.parser.object.PsdDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。