當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。