note
	description: "An image from a custom package file."
	author: "Louis Marchand"
	date: "Thu, 02 Apr 2015 03:46:04 +0000"
	revision: "2.0"

class 
	IMG_IMAGE_CPF

inherit
	IMG_IMAGE_FILE
		rename
			make as make_file
		redefine
			open,
			is_cur,
			is_ico,
			is_bmp,
			is_pnm,
			is_xpm,
			is_xcf,
			is_pcx,
			is_gif,
			is_jpg,
			is_tif,
			is_png,
			is_lbm,
			is_xv
		end

	CPF_RESSOURCE_MANAGER
		undefine
			default_create
		redefine
			make
		end

create 
	make

feature {NONE} -- Initialization

	make (a_cpf: CPF_PACKAGE_FILE; a_cpf_index: INTEGER_32)
			-- make Current from the image in the custom package file a_cpf at a_cpf_index.
		do
			Precursor {CPF_RESSOURCE_MANAGER} (a_cpf, a_cpf_index)
			rwop := {GAME_SDL_EXTERNAL}.sdl_allocrw;
			cpf.lock_mutex;
			cpf.select_sub_file (cpf_index)
			{GAME_SDL_EXTERNAL}.setsdlrwops (rwop, cpf.internal_pointer)
			last_position := cpf.position;
			cpf.unlock_mutex
		end
	
feature -- Access

	is_cur: BOOLEAN
			-- The internal library support BMP format and the file is a valid CUR file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_ico: BOOLEAN
			-- The internal library support BMP format and the file is a valid ICO file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_bmp: BOOLEAN
			-- The internal library support BMP format and the file is a valid BMP file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_pnm: BOOLEAN
			-- The internal library support PNM format and the file is a valid PNM file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_xpm: BOOLEAN
			-- The internal library support XPM format and the file is a valid XPM file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_xcf: BOOLEAN
			-- The internal library support XCF format and the file is a valid XCF file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_pcx: BOOLEAN
			-- The internal library support PCX format and the file is a valid PCX file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_gif: BOOLEAN
			-- The internal library support GIF format and the file is a valid GIF file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_jpg: BOOLEAN
			-- The internal library support JPG format and the file is a valid JPG file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_tif: BOOLEAN
			-- The internal library support TIF format and the file is a valid TIF file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_png: BOOLEAN
			-- The internal library support PNG format and the file is a valid PNG file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_lbm: BOOLEAN
			-- The internal library support LBM format and the file is a valid LBM file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	is_xv: BOOLEAN
			-- The internal library support XV format and the file is a valid XV file.
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Result := Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end

	open
			-- Open Current
		do
			cpf.lock_mutex;
			cpf.go (last_position)
			Precursor {IMG_IMAGE_FILE}
			last_position := cpf.position;
			cpf.unlock_mutex
		end
	
feature {NONE} 

	last_position: INTEGER_32
	
end -- class IMG_IMAGE_CPF

Generated by ISE EiffelStudio