예제 #1
0
// ****************************************************************************
//
//  Function Name:	RGraphicInterfaceImp::Load( )
//
//  Description:		Read in the data into the associated Graphic.from
//							old Print Shop collection format
//
//  Returns:			Nothing
//
//  Exceptions:		kMemory, Disk Errors
//
// ****************************************************************************
//
void RGraphicInterfaceImp::Load( RStorage& storage, EGraphicType graphicType )
{
	RPsd3Graphic* pGraphic = RPsd3Graphic::CreateNewGraphic( graphicType );

	uBYTE*  pGraphicData ;
	uLONG   uGraphicDataSize ;	
	BOOLEAN fMonochrome ;

	const int kMonochromeOffset = 16 ;

	storage.SeekRelative( kMonochromeOffset ) ;
	storage >> fMonochrome ;

	storage.SeekRelative( 3 ) ;   // Gets us to graphic size
	storage >> uGraphicDataSize ;

	uLONG uThumbnailSize ;			// Skip past the thumbnail
	storage >> uThumbnailSize ;
	storage.SeekRelative( uThumbnailSize ) ;

	pGraphicData = storage.GetStorageStream()->GetBuffer( uGraphicDataSize ) ;
	pGraphic->Load( pGraphicData, uGraphicDataSize, fMonochrome ) ;

	m_pGraphicDocument->SetGraphic( dynamic_cast<RGraphic*>( pGraphic ) );
}
예제 #2
0
// ****************************************************************************
//
//  Function Name:	RGraphicInterfaceImp::Load( )
//
//  Description:		Read in the data into the associated Graphic from
//							a raw data stream.
//
//  Returns:			Nothing
//
//  Exceptions:		kMemory, Disk Errors
//
// ****************************************************************************
//
void RGraphicInterfaceImp::Load( RStorage& storage, uLONG uLength, EGraphicType graphicType )
{
	RPsd3Graphic* pGraphic = RPsd3Graphic::CreateNewGraphic( graphicType );
	
	uBYTE*  pGraphicData = storage.GetStorageStream()->GetBuffer( uLength );
	pGraphic->Load( pGraphicData, uLength, FALSE );

	m_pGraphicDocument->SetGraphic( dynamic_cast<RGraphic*>( pGraphic ) );
}
예제 #3
0
// ****************************************************************************
//
//  Function Name:	RGraphicInterfaceImp::LoadFromPretzelCollection( )
//
//  Description:		Read in the data into the associated Graphic.from
//							Print Shop library-of-one format
//
//  Returns:			Nothing
//
//  Exceptions:		kMemory, Disk Errors
//
// ****************************************************************************
//
void RGraphicInterfaceImp::LoadFromPretzelCollection( RStorage& storage, EGraphicType graphicType )
{
// save current compiler struct packing setting, set to 1 (each member on byte boundary)
#pragma pack( push, 1 )
	struct DS_LIBHEAD
	{
		char		FileIdentifier[16];	// file verification---NOT NULL TERMINATED!
		char		LibraryName[32];		// Name of library---NOT NULL TERMINATED!
		short		FileID;					// unique file identifier
		short		Machine;					// machine signature
		char		Type;						// type of file---this is often inaccurate so do not use
		char		Subtype;					// type of graphics in file (we no longer use)
		short		Count;					// number of graphics in file
		short		LayoutClassSize;		// size of class info array (layout only)
		short		LayoutCount;			// number of layouts in file (layout only)
		char		DriverName[8];			// driver on which bitmaps were made (DOS platform only)
		char		CreatedByBB;			// library was created by Broderbund
		char		unused;
		long		magicNumber;			// new for version 3.0---confirms library is 3.x
		char		versionLo;				// new for version 3.0
		char		versionHi;				// new for version 3.0
		long		keywordOffset;			// new for version 3.0---reads in keywords until end of file
		char		reserved[48];			// remainder of 128 bytes
	};
	struct DS_GRAPHICINFO
	{
		char	Name[32];			// name of graphic---NOT NULL TERMINATED!
		long	GraphiclD;			// unique graphic identifier
		long	GraphicSize;		// graphic size
		long	BitmapSize;			// bitmap size
		char	GraphicCompress;	// compression scheme for graphics
		char	BitmapCompress;	// compression scheme for bitmaps
		char	MonoFlag;			// True if monochrome graphic
		char	Screening;			// default screening value, 0-100
		char	BackdropType;		// backdrop subtypes
		char	reserved;
		short	ProjectCode;		// project use code
	};
// restore compiler struct packing setting
#pragma pack( pop )

	uLONG uGraphicSize;
	const int kGraphicSizeOffset = sizeof(DS_LIBHEAD) + 36;
	storage.SeekRelative( kGraphicSizeOffset );
	storage >> uGraphicSize;

	BOOLEAN fMonochrome;
	const int kMonochromeOffset = 6;
	storage.SeekRelative( kMonochromeOffset );
	storage >> fMonochrome;

	const int kSkipRemainder = 5;
	storage.SeekRelative( kSkipRemainder );

	uBYTE* pGraphicData = storage.GetStorageStream()->GetBuffer( uGraphicSize );

	RPsd3Graphic* pGraphic = RPsd3Graphic::CreateNewGraphic( graphicType );
	pGraphic->Load( pGraphicData, uGraphicSize, fMonochrome );

	m_pGraphicDocument->SetGraphic( dynamic_cast<RGraphic*>( pGraphic ) );
}