added TGA handler (somewhat modified patch 1393912)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9920ad328b
commit
3af706cc31
21
Makefile.in
21
Makefile.in
@ -2965,6 +2965,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
|
||||
wx/imagpcx.h \
|
||||
wx/imagpng.h \
|
||||
wx/imagpnm.h \
|
||||
wx/imagtga.h \
|
||||
wx/imagtiff.h \
|
||||
wx/imagxpm.h \
|
||||
wx/listbase.h \
|
||||
@ -3471,6 +3472,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \
|
||||
monodll_imagpcx.o \
|
||||
monodll_imagpng.o \
|
||||
monodll_imagpnm.o \
|
||||
monodll_imagtga.o \
|
||||
monodll_imagtiff.o \
|
||||
monodll_imagxpm.o \
|
||||
monodll_layout.o \
|
||||
@ -3642,6 +3644,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \
|
||||
monodll_imagpcx.o \
|
||||
monodll_imagpng.o \
|
||||
monodll_imagpnm.o \
|
||||
monodll_imagtga.o \
|
||||
monodll_imagtiff.o \
|
||||
monodll_imagxpm.o \
|
||||
monodll_layout.o \
|
||||
@ -5223,6 +5226,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \
|
||||
monolib_imagpcx.o \
|
||||
monolib_imagpng.o \
|
||||
monolib_imagpnm.o \
|
||||
monolib_imagtga.o \
|
||||
monolib_imagtiff.o \
|
||||
monolib_imagxpm.o \
|
||||
monolib_layout.o \
|
||||
@ -5394,6 +5398,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \
|
||||
monolib_imagpcx.o \
|
||||
monolib_imagpng.o \
|
||||
monolib_imagpnm.o \
|
||||
monolib_imagtga.o \
|
||||
monolib_imagtiff.o \
|
||||
monolib_imagxpm.o \
|
||||
monolib_layout.o \
|
||||
@ -7187,6 +7192,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \
|
||||
coredll_imagpcx.o \
|
||||
coredll_imagpng.o \
|
||||
coredll_imagpnm.o \
|
||||
coredll_imagtga.o \
|
||||
coredll_imagtiff.o \
|
||||
coredll_imagxpm.o \
|
||||
coredll_layout.o \
|
||||
@ -7358,6 +7364,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \
|
||||
coredll_imagpcx.o \
|
||||
coredll_imagpng.o \
|
||||
coredll_imagpnm.o \
|
||||
coredll_imagtga.o \
|
||||
coredll_imagtiff.o \
|
||||
coredll_imagxpm.o \
|
||||
coredll_layout.o \
|
||||
@ -8621,6 +8628,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \
|
||||
corelib_imagpcx.o \
|
||||
corelib_imagpng.o \
|
||||
corelib_imagpnm.o \
|
||||
corelib_imagtga.o \
|
||||
corelib_imagtiff.o \
|
||||
corelib_imagxpm.o \
|
||||
corelib_layout.o \
|
||||
@ -8792,6 +8800,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \
|
||||
corelib_imagpcx.o \
|
||||
corelib_imagpng.o \
|
||||
corelib_imagpnm.o \
|
||||
corelib_imagtga.o \
|
||||
corelib_imagtiff.o \
|
||||
corelib_imagxpm.o \
|
||||
corelib_layout.o \
|
||||
@ -15832,6 +15841,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
|
||||
@COND_USE_GUI_1@monodll_imagpnm.o: $(srcdir)/src/common/imagpnm.cpp $(MONODLL_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/imagpnm.cpp
|
||||
|
||||
@COND_USE_GUI_1@monodll_imagtga.o: $(srcdir)/src/common/imagtga.cpp $(MONODLL_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/imagtga.cpp
|
||||
|
||||
@COND_USE_GUI_1@monodll_imagtiff.o: $(srcdir)/src/common/imagtiff.cpp $(MONODLL_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/imagtiff.cpp
|
||||
|
||||
@ -19927,6 +19939,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
|
||||
@COND_USE_GUI_1@monolib_imagpnm.o: $(srcdir)/src/common/imagpnm.cpp $(MONOLIB_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/imagpnm.cpp
|
||||
|
||||
@COND_USE_GUI_1@monolib_imagtga.o: $(srcdir)/src/common/imagtga.cpp $(MONOLIB_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/imagtga.cpp
|
||||
|
||||
@COND_USE_GUI_1@monolib_imagtiff.o: $(srcdir)/src/common/imagtiff.cpp $(MONOLIB_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/imagtiff.cpp
|
||||
|
||||
@ -24373,6 +24388,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
|
||||
@COND_USE_GUI_1@coredll_imagpnm.o: $(srcdir)/src/common/imagpnm.cpp $(COREDLL_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/imagpnm.cpp
|
||||
|
||||
@COND_USE_GUI_1@coredll_imagtga.o: $(srcdir)/src/common/imagtga.cpp $(COREDLL_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/imagtga.cpp
|
||||
|
||||
@COND_USE_GUI_1@coredll_imagtiff.o: $(srcdir)/src/common/imagtiff.cpp $(COREDLL_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/imagtiff.cpp
|
||||
|
||||
@ -27295,6 +27313,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
|
||||
@COND_USE_GUI_1@corelib_imagpnm.o: $(srcdir)/src/common/imagpnm.cpp $(CORELIB_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/imagpnm.cpp
|
||||
|
||||
@COND_USE_GUI_1@corelib_imagtga.o: $(srcdir)/src/common/imagtga.cpp $(CORELIB_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/imagtga.cpp
|
||||
|
||||
@COND_USE_GUI_1@corelib_imagtiff.o: $(srcdir)/src/common/imagtiff.cpp $(CORELIB_ODEP)
|
||||
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/imagtiff.cpp
|
||||
|
||||
|
@ -619,6 +619,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/common/imagpcx.cpp
|
||||
src/common/imagpng.cpp
|
||||
src/common/imagpnm.cpp
|
||||
src/common/imagtga.cpp
|
||||
src/common/imagtiff.cpp
|
||||
src/common/imagxpm.cpp
|
||||
src/common/layout.cpp
|
||||
@ -825,6 +826,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/imagpcx.h
|
||||
wx/imagpng.h
|
||||
wx/imagpnm.h
|
||||
wx/imagtga.h
|
||||
wx/imagtiff.h
|
||||
wx/imagxpm.h
|
||||
wx/listbase.h
|
||||
|
@ -1469,6 +1469,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
|
||||
$(OBJS)\monodll_imagpcx.obj \
|
||||
$(OBJS)\monodll_imagpng.obj \
|
||||
$(OBJS)\monodll_imagpnm.obj \
|
||||
$(OBJS)\monodll_imagtga.obj \
|
||||
$(OBJS)\monodll_imagtiff.obj \
|
||||
$(OBJS)\monodll_imagxpm.obj \
|
||||
$(OBJS)\monodll_layout.obj \
|
||||
@ -1690,6 +1691,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
|
||||
$(OBJS)\monodll_imagpcx.obj \
|
||||
$(OBJS)\monodll_imagpng.obj \
|
||||
$(OBJS)\monodll_imagpnm.obj \
|
||||
$(OBJS)\monodll_imagtga.obj \
|
||||
$(OBJS)\monodll_imagtiff.obj \
|
||||
$(OBJS)\monodll_imagxpm.obj \
|
||||
$(OBJS)\monodll_layout.obj \
|
||||
@ -2077,6 +2079,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
|
||||
$(OBJS)\monolib_imagpcx.obj \
|
||||
$(OBJS)\monolib_imagpng.obj \
|
||||
$(OBJS)\monolib_imagpnm.obj \
|
||||
$(OBJS)\monolib_imagtga.obj \
|
||||
$(OBJS)\monolib_imagtiff.obj \
|
||||
$(OBJS)\monolib_imagxpm.obj \
|
||||
$(OBJS)\monolib_layout.obj \
|
||||
@ -2298,6 +2301,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
|
||||
$(OBJS)\monolib_imagpcx.obj \
|
||||
$(OBJS)\monolib_imagpng.obj \
|
||||
$(OBJS)\monolib_imagpnm.obj \
|
||||
$(OBJS)\monolib_imagtga.obj \
|
||||
$(OBJS)\monolib_imagtiff.obj \
|
||||
$(OBJS)\monolib_imagxpm.obj \
|
||||
$(OBJS)\monolib_layout.obj \
|
||||
@ -2595,6 +2599,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
|
||||
$(OBJS)\coredll_imagpcx.obj \
|
||||
$(OBJS)\coredll_imagpng.obj \
|
||||
$(OBJS)\coredll_imagpnm.obj \
|
||||
$(OBJS)\coredll_imagtga.obj \
|
||||
$(OBJS)\coredll_imagtiff.obj \
|
||||
$(OBJS)\coredll_imagxpm.obj \
|
||||
$(OBJS)\coredll_layout.obj \
|
||||
@ -2816,6 +2821,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
|
||||
$(OBJS)\coredll_imagpcx.obj \
|
||||
$(OBJS)\coredll_imagpng.obj \
|
||||
$(OBJS)\coredll_imagpnm.obj \
|
||||
$(OBJS)\coredll_imagtga.obj \
|
||||
$(OBJS)\coredll_imagtiff.obj \
|
||||
$(OBJS)\coredll_imagxpm.obj \
|
||||
$(OBJS)\coredll_layout.obj \
|
||||
@ -3038,6 +3044,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
|
||||
$(OBJS)\corelib_imagpcx.obj \
|
||||
$(OBJS)\corelib_imagpng.obj \
|
||||
$(OBJS)\corelib_imagpnm.obj \
|
||||
$(OBJS)\corelib_imagtga.obj \
|
||||
$(OBJS)\corelib_imagtiff.obj \
|
||||
$(OBJS)\corelib_imagxpm.obj \
|
||||
$(OBJS)\corelib_layout.obj \
|
||||
@ -3259,6 +3266,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
|
||||
$(OBJS)\corelib_imagpcx.obj \
|
||||
$(OBJS)\corelib_imagpng.obj \
|
||||
$(OBJS)\corelib_imagpnm.obj \
|
||||
$(OBJS)\corelib_imagtga.obj \
|
||||
$(OBJS)\corelib_imagtiff.obj \
|
||||
$(OBJS)\corelib_imagxpm.obj \
|
||||
$(OBJS)\corelib_layout.obj \
|
||||
@ -6047,6 +6055,11 @@ $(OBJS)\monodll_imagpnm.obj: ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\monodll_imagtga.obj: ..\..\src\common\imagtga.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\monodll_imagtiff.obj: ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
|
||||
@ -8026,6 +8039,11 @@ $(OBJS)\monolib_imagpnm.obj: ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\monolib_imagtga.obj: ..\..\src\common\imagtga.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\monolib_imagtiff.obj: ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
|
||||
@ -10038,6 +10056,11 @@ $(OBJS)\coredll_imagpnm.obj: ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\coredll_imagtga.obj: ..\..\src\common\imagtga.cpp
|
||||
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\coredll_imagtiff.obj: ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
|
||||
@ -11293,6 +11316,11 @@ $(OBJS)\corelib_imagpnm.obj: ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\corelib_imagtga.obj: ..\..\src\common\imagtga.cpp
|
||||
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\corelib_imagtiff.obj: ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
|
||||
|
@ -1479,6 +1479,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
|
||||
$(OBJS)\monodll_imagpcx.o \
|
||||
$(OBJS)\monodll_imagpng.o \
|
||||
$(OBJS)\monodll_imagpnm.o \
|
||||
$(OBJS)\monodll_imagtga.o \
|
||||
$(OBJS)\monodll_imagtiff.o \
|
||||
$(OBJS)\monodll_imagxpm.o \
|
||||
$(OBJS)\monodll_layout.o \
|
||||
@ -1702,6 +1703,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
|
||||
$(OBJS)\monodll_imagpcx.o \
|
||||
$(OBJS)\monodll_imagpng.o \
|
||||
$(OBJS)\monodll_imagpnm.o \
|
||||
$(OBJS)\monodll_imagtga.o \
|
||||
$(OBJS)\monodll_imagtiff.o \
|
||||
$(OBJS)\monodll_imagxpm.o \
|
||||
$(OBJS)\monodll_layout.o \
|
||||
@ -2093,6 +2095,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
|
||||
$(OBJS)\monolib_imagpcx.o \
|
||||
$(OBJS)\monolib_imagpng.o \
|
||||
$(OBJS)\monolib_imagpnm.o \
|
||||
$(OBJS)\monolib_imagtga.o \
|
||||
$(OBJS)\monolib_imagtiff.o \
|
||||
$(OBJS)\monolib_imagxpm.o \
|
||||
$(OBJS)\monolib_layout.o \
|
||||
@ -2316,6 +2319,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
|
||||
$(OBJS)\monolib_imagpcx.o \
|
||||
$(OBJS)\monolib_imagpng.o \
|
||||
$(OBJS)\monolib_imagpnm.o \
|
||||
$(OBJS)\monolib_imagtga.o \
|
||||
$(OBJS)\monolib_imagtiff.o \
|
||||
$(OBJS)\monolib_imagxpm.o \
|
||||
$(OBJS)\monolib_layout.o \
|
||||
@ -2627,6 +2631,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
|
||||
$(OBJS)\coredll_imagpcx.o \
|
||||
$(OBJS)\coredll_imagpng.o \
|
||||
$(OBJS)\coredll_imagpnm.o \
|
||||
$(OBJS)\coredll_imagtga.o \
|
||||
$(OBJS)\coredll_imagtiff.o \
|
||||
$(OBJS)\coredll_imagxpm.o \
|
||||
$(OBJS)\coredll_layout.o \
|
||||
@ -2850,6 +2855,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
|
||||
$(OBJS)\coredll_imagpcx.o \
|
||||
$(OBJS)\coredll_imagpng.o \
|
||||
$(OBJS)\coredll_imagpnm.o \
|
||||
$(OBJS)\coredll_imagtga.o \
|
||||
$(OBJS)\coredll_imagtiff.o \
|
||||
$(OBJS)\coredll_imagxpm.o \
|
||||
$(OBJS)\coredll_layout.o \
|
||||
@ -3078,6 +3084,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
|
||||
$(OBJS)\corelib_imagpcx.o \
|
||||
$(OBJS)\corelib_imagpng.o \
|
||||
$(OBJS)\corelib_imagpnm.o \
|
||||
$(OBJS)\corelib_imagtga.o \
|
||||
$(OBJS)\corelib_imagtiff.o \
|
||||
$(OBJS)\corelib_imagxpm.o \
|
||||
$(OBJS)\corelib_layout.o \
|
||||
@ -3301,6 +3308,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
|
||||
$(OBJS)\corelib_imagpcx.o \
|
||||
$(OBJS)\corelib_imagpng.o \
|
||||
$(OBJS)\corelib_imagpnm.o \
|
||||
$(OBJS)\corelib_imagtga.o \
|
||||
$(OBJS)\corelib_imagtiff.o \
|
||||
$(OBJS)\corelib_imagxpm.o \
|
||||
$(OBJS)\corelib_layout.o \
|
||||
@ -6264,6 +6272,11 @@ $(OBJS)\monodll_imagpnm.o: ../../src/common/imagpnm.cpp
|
||||
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_GUI),1)
|
||||
$(OBJS)\monodll_imagtga.o: ../../src/common/imagtga.cpp
|
||||
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_GUI),1)
|
||||
$(OBJS)\monodll_imagtiff.o: ../../src/common/imagtiff.cpp
|
||||
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
@ -8343,6 +8356,11 @@ $(OBJS)\monolib_imagpnm.o: ../../src/common/imagpnm.cpp
|
||||
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_GUI),1)
|
||||
$(OBJS)\monolib_imagtga.o: ../../src/common/imagtga.cpp
|
||||
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_GUI),1)
|
||||
$(OBJS)\monolib_imagtiff.o: ../../src/common/imagtiff.cpp
|
||||
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
@ -10455,6 +10473,11 @@ $(OBJS)\coredll_imagpnm.o: ../../src/common/imagpnm.cpp
|
||||
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_GUI),1)
|
||||
$(OBJS)\coredll_imagtga.o: ../../src/common/imagtga.cpp
|
||||
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_GUI),1)
|
||||
$(OBJS)\coredll_imagtiff.o: ../../src/common/imagtiff.cpp
|
||||
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
@ -11810,6 +11833,11 @@ $(OBJS)\corelib_imagpnm.o: ../../src/common/imagpnm.cpp
|
||||
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_GUI),1)
|
||||
$(OBJS)\corelib_imagtga.o: ../../src/common/imagtga.cpp
|
||||
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_GUI),1)
|
||||
$(OBJS)\corelib_imagtiff.o: ../../src/common/imagtiff.cpp
|
||||
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
@ -1636,6 +1636,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
|
||||
$(OBJS)\monodll_imagpcx.obj \
|
||||
$(OBJS)\monodll_imagpng.obj \
|
||||
$(OBJS)\monodll_imagpnm.obj \
|
||||
$(OBJS)\monodll_imagtga.obj \
|
||||
$(OBJS)\monodll_imagtiff.obj \
|
||||
$(OBJS)\monodll_imagxpm.obj \
|
||||
$(OBJS)\monodll_layout.obj \
|
||||
@ -1857,6 +1858,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
|
||||
$(OBJS)\monodll_imagpcx.obj \
|
||||
$(OBJS)\monodll_imagpng.obj \
|
||||
$(OBJS)\monodll_imagpnm.obj \
|
||||
$(OBJS)\monodll_imagtga.obj \
|
||||
$(OBJS)\monodll_imagtiff.obj \
|
||||
$(OBJS)\monodll_imagxpm.obj \
|
||||
$(OBJS)\monodll_layout.obj \
|
||||
@ -2250,6 +2252,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
|
||||
$(OBJS)\monolib_imagpcx.obj \
|
||||
$(OBJS)\monolib_imagpng.obj \
|
||||
$(OBJS)\monolib_imagpnm.obj \
|
||||
$(OBJS)\monolib_imagtga.obj \
|
||||
$(OBJS)\monolib_imagtiff.obj \
|
||||
$(OBJS)\monolib_imagxpm.obj \
|
||||
$(OBJS)\monolib_layout.obj \
|
||||
@ -2471,6 +2474,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
|
||||
$(OBJS)\monolib_imagpcx.obj \
|
||||
$(OBJS)\monolib_imagpng.obj \
|
||||
$(OBJS)\monolib_imagpnm.obj \
|
||||
$(OBJS)\monolib_imagtga.obj \
|
||||
$(OBJS)\monolib_imagtiff.obj \
|
||||
$(OBJS)\monolib_imagxpm.obj \
|
||||
$(OBJS)\monolib_layout.obj \
|
||||
@ -2798,6 +2802,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
|
||||
$(OBJS)\coredll_imagpcx.obj \
|
||||
$(OBJS)\coredll_imagpng.obj \
|
||||
$(OBJS)\coredll_imagpnm.obj \
|
||||
$(OBJS)\coredll_imagtga.obj \
|
||||
$(OBJS)\coredll_imagtiff.obj \
|
||||
$(OBJS)\coredll_imagxpm.obj \
|
||||
$(OBJS)\coredll_layout.obj \
|
||||
@ -3019,6 +3024,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
|
||||
$(OBJS)\coredll_imagpcx.obj \
|
||||
$(OBJS)\coredll_imagpng.obj \
|
||||
$(OBJS)\coredll_imagpnm.obj \
|
||||
$(OBJS)\coredll_imagtga.obj \
|
||||
$(OBJS)\coredll_imagtiff.obj \
|
||||
$(OBJS)\coredll_imagxpm.obj \
|
||||
$(OBJS)\coredll_layout.obj \
|
||||
@ -3247,6 +3253,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
|
||||
$(OBJS)\corelib_imagpcx.obj \
|
||||
$(OBJS)\corelib_imagpng.obj \
|
||||
$(OBJS)\corelib_imagpnm.obj \
|
||||
$(OBJS)\corelib_imagtga.obj \
|
||||
$(OBJS)\corelib_imagtiff.obj \
|
||||
$(OBJS)\corelib_imagxpm.obj \
|
||||
$(OBJS)\corelib_layout.obj \
|
||||
@ -3468,6 +3475,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
|
||||
$(OBJS)\corelib_imagpcx.obj \
|
||||
$(OBJS)\corelib_imagpng.obj \
|
||||
$(OBJS)\corelib_imagpnm.obj \
|
||||
$(OBJS)\corelib_imagtga.obj \
|
||||
$(OBJS)\corelib_imagtiff.obj \
|
||||
$(OBJS)\corelib_imagxpm.obj \
|
||||
$(OBJS)\corelib_layout.obj \
|
||||
@ -6380,6 +6388,11 @@ $(OBJS)\monodll_imagpnm.obj: ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\monodll_imagtga.obj: ..\..\src\common\imagtga.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\monodll_imagtiff.obj: ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
|
||||
@ -8359,6 +8372,11 @@ $(OBJS)\monolib_imagpnm.obj: ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\monolib_imagtga.obj: ..\..\src\common\imagtga.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\monolib_imagtiff.obj: ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
|
||||
@ -10371,6 +10389,11 @@ $(OBJS)\coredll_imagpnm.obj: ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\coredll_imagtga.obj: ..\..\src\common\imagtga.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\coredll_imagtiff.obj: ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
|
||||
@ -11626,6 +11649,11 @@ $(OBJS)\corelib_imagpnm.obj: ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\corelib_imagtga.obj: ..\..\src\common\imagtga.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
|
||||
!endif
|
||||
|
||||
!if "$(USE_GUI)" == "1"
|
||||
$(OBJS)\corelib_imagtiff.obj: ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
|
||||
|
@ -361,6 +361,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = &
|
||||
$(OBJS)\monodll_imagpcx.obj &
|
||||
$(OBJS)\monodll_imagpng.obj &
|
||||
$(OBJS)\monodll_imagpnm.obj &
|
||||
$(OBJS)\monodll_imagtga.obj &
|
||||
$(OBJS)\monodll_imagtiff.obj &
|
||||
$(OBJS)\monodll_imagxpm.obj &
|
||||
$(OBJS)\monodll_layout.obj &
|
||||
@ -584,6 +585,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = &
|
||||
$(OBJS)\monodll_imagpcx.obj &
|
||||
$(OBJS)\monodll_imagpng.obj &
|
||||
$(OBJS)\monodll_imagpnm.obj &
|
||||
$(OBJS)\monodll_imagtga.obj &
|
||||
$(OBJS)\monodll_imagtiff.obj &
|
||||
$(OBJS)\monodll_imagxpm.obj &
|
||||
$(OBJS)\monodll_layout.obj &
|
||||
@ -979,6 +981,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = &
|
||||
$(OBJS)\monolib_imagpcx.obj &
|
||||
$(OBJS)\monolib_imagpng.obj &
|
||||
$(OBJS)\monolib_imagpnm.obj &
|
||||
$(OBJS)\monolib_imagtga.obj &
|
||||
$(OBJS)\monolib_imagtiff.obj &
|
||||
$(OBJS)\monolib_imagxpm.obj &
|
||||
$(OBJS)\monolib_layout.obj &
|
||||
@ -1202,6 +1205,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = &
|
||||
$(OBJS)\monolib_imagpcx.obj &
|
||||
$(OBJS)\monolib_imagpng.obj &
|
||||
$(OBJS)\monolib_imagpnm.obj &
|
||||
$(OBJS)\monolib_imagtga.obj &
|
||||
$(OBJS)\monolib_imagtiff.obj &
|
||||
$(OBJS)\monolib_imagxpm.obj &
|
||||
$(OBJS)\monolib_layout.obj &
|
||||
@ -1520,6 +1524,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = &
|
||||
$(OBJS)\coredll_imagpcx.obj &
|
||||
$(OBJS)\coredll_imagpng.obj &
|
||||
$(OBJS)\coredll_imagpnm.obj &
|
||||
$(OBJS)\coredll_imagtga.obj &
|
||||
$(OBJS)\coredll_imagtiff.obj &
|
||||
$(OBJS)\coredll_imagxpm.obj &
|
||||
$(OBJS)\coredll_layout.obj &
|
||||
@ -1743,6 +1748,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = &
|
||||
$(OBJS)\coredll_imagpcx.obj &
|
||||
$(OBJS)\coredll_imagpng.obj &
|
||||
$(OBJS)\coredll_imagpnm.obj &
|
||||
$(OBJS)\coredll_imagtga.obj &
|
||||
$(OBJS)\coredll_imagtiff.obj &
|
||||
$(OBJS)\coredll_imagxpm.obj &
|
||||
$(OBJS)\coredll_layout.obj &
|
||||
@ -1973,6 +1979,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = &
|
||||
$(OBJS)\corelib_imagpcx.obj &
|
||||
$(OBJS)\corelib_imagpng.obj &
|
||||
$(OBJS)\corelib_imagpnm.obj &
|
||||
$(OBJS)\corelib_imagtga.obj &
|
||||
$(OBJS)\corelib_imagtiff.obj &
|
||||
$(OBJS)\corelib_imagxpm.obj &
|
||||
$(OBJS)\corelib_layout.obj &
|
||||
@ -2196,6 +2203,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = &
|
||||
$(OBJS)\corelib_imagpcx.obj &
|
||||
$(OBJS)\corelib_imagpng.obj &
|
||||
$(OBJS)\corelib_imagpnm.obj &
|
||||
$(OBJS)\corelib_imagtga.obj &
|
||||
$(OBJS)\corelib_imagtiff.obj &
|
||||
$(OBJS)\corelib_imagxpm.obj &
|
||||
$(OBJS)\corelib_layout.obj &
|
||||
@ -6492,6 +6500,11 @@ $(OBJS)\monodll_imagpnm.obj : .AUTODEPEND ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
|
||||
!endif
|
||||
|
||||
!ifeq USE_GUI 1
|
||||
$(OBJS)\monodll_imagtga.obj : .AUTODEPEND ..\..\src\common\imagtga.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
|
||||
!endif
|
||||
|
||||
!ifeq USE_GUI 1
|
||||
$(OBJS)\monodll_imagtiff.obj : .AUTODEPEND ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
|
||||
@ -8571,6 +8584,11 @@ $(OBJS)\monolib_imagpnm.obj : .AUTODEPEND ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
|
||||
!endif
|
||||
|
||||
!ifeq USE_GUI 1
|
||||
$(OBJS)\monolib_imagtga.obj : .AUTODEPEND ..\..\src\common\imagtga.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
|
||||
!endif
|
||||
|
||||
!ifeq USE_GUI 1
|
||||
$(OBJS)\monolib_imagtiff.obj : .AUTODEPEND ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
|
||||
@ -10683,6 +10701,11 @@ $(OBJS)\coredll_imagpnm.obj : .AUTODEPEND ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
|
||||
!endif
|
||||
|
||||
!ifeq USE_GUI 1
|
||||
$(OBJS)\coredll_imagtga.obj : .AUTODEPEND ..\..\src\common\imagtga.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
|
||||
!endif
|
||||
|
||||
!ifeq USE_GUI 1
|
||||
$(OBJS)\coredll_imagtiff.obj : .AUTODEPEND ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
|
||||
@ -12038,6 +12061,11 @@ $(OBJS)\corelib_imagpnm.obj : .AUTODEPEND ..\..\src\common\imagpnm.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
|
||||
!endif
|
||||
|
||||
!ifeq USE_GUI 1
|
||||
$(OBJS)\corelib_imagtga.obj : .AUTODEPEND ..\..\src\common\imagtga.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
|
||||
!endif
|
||||
|
||||
!ifeq USE_GUI 1
|
||||
$(OBJS)\corelib_imagtiff.obj : .AUTODEPEND ..\..\src\common\imagtiff.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
|
||||
|
@ -694,6 +694,10 @@ SOURCE=..\..\src\common\imagpnm.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\common\imagtga.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\common\imagtiff.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -9009,6 +9013,10 @@ SOURCE=..\..\include\wx\imagpnm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\wx\imagtga.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\wx\imagtiff.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -93,6 +93,7 @@ All (GUI):
|
||||
- Many enhancements to wxRichTextCtrl including URL support,
|
||||
formatting and symbol dialogs, print/preview, and better list
|
||||
formatting.
|
||||
- Support for loading TGA files added (Seth Jackson)
|
||||
|
||||
Unix Ports:
|
||||
|
||||
|
@ -45,7 +45,7 @@ as support for saving images with alpha channel which also isn't implemented).
|
||||
|
||||
The following image handlers are available. {\bf wxBMPHandler} is always
|
||||
installed by default. To use other image formats, install the appropriate
|
||||
handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or
|
||||
handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or call
|
||||
\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}.
|
||||
|
||||
\twocolwidtha{5cm}%
|
||||
@ -57,6 +57,7 @@ handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or
|
||||
\twocolitem{\indexit{wxPCXHandler}}{For loading and saving (see below).}
|
||||
\twocolitem{\indexit{wxPNMHandler}}{For loading and saving (see below).}
|
||||
\twocolitem{\indexit{wxTIFFHandler}}{For loading and saving.}
|
||||
\twocolitem{\indexit{wxTGAHandler}}{For loading only.}
|
||||
\twocolitem{\indexit{wxIFFHandler}}{For loading only.}
|
||||
\twocolitem{\indexit{wxXPMHandler}}{For loading and saving.}
|
||||
\twocolitem{\indexit{wxICOHandler}}{For loading and saving.}
|
||||
@ -153,6 +154,7 @@ Creates an image from XPM data.
|
||||
\twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.}
|
||||
\twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.}
|
||||
\twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.}
|
||||
\twocolitem{\indexit{wxBITMAP\_TYPE\_TGA}}{Load a TGA bitmap file.}
|
||||
\twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
|
||||
\twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
|
||||
\twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
|
||||
|
@ -75,6 +75,7 @@ enum wxBitmapType
|
||||
wxBITMAP_TYPE_ICON_RESOURCE,
|
||||
wxBITMAP_TYPE_ANI,
|
||||
wxBITMAP_TYPE_IFF,
|
||||
wxBITMAP_TYPE_TGA,
|
||||
wxBITMAP_TYPE_MACCURSOR,
|
||||
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
|
||||
wxBITMAP_TYPE_ANY = 50
|
||||
|
@ -442,6 +442,7 @@ extern WXDLLEXPORT_DATA(wxImage) wxNullImage;
|
||||
#include "wx/imaggif.h"
|
||||
#include "wx/imagpcx.h"
|
||||
#include "wx/imagjpeg.h"
|
||||
#include "wx/imagtga.h"
|
||||
#include "wx/imagtiff.h"
|
||||
#include "wx/imagpnm.h"
|
||||
#include "wx/imagxpm.h"
|
||||
|
46
include/wx/imagtga.h
Normal file
46
include/wx/imagtga.h
Normal file
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagtga.h
|
||||
// Purpose: wxImage TGA handler
|
||||
// Author: Seth Jackson
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2005 Seth Jackson
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGTGA_H_
|
||||
#define _WX_IMAGTGA_H_
|
||||
|
||||
#include "wx/image.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTGAHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_TGA
|
||||
|
||||
class WXDLLEXPORT wxTGAHandler : public wxImageHandler
|
||||
{
|
||||
public:
|
||||
wxTGAHandler()
|
||||
{
|
||||
m_name = wxT("TGA file");
|
||||
m_extension = wxT("tga");
|
||||
m_type = wxBITMAP_TYPE_TGA;
|
||||
m_mime = wxT("image/tga");
|
||||
}
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile(wxImage* image, wxInputStream& stream,
|
||||
bool verbose = true, int index = -1);
|
||||
virtual bool SaveFile(wxImage* image, wxOutputStream& stream,
|
||||
bool verbose = true);
|
||||
virtual bool DoCanRead(wxInputStream& stream);
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxTGAHandler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_TGA
|
||||
|
||||
#endif // _WX_IMAGTGA_H_
|
@ -1152,6 +1152,9 @@
|
||||
// Set to 1 for TIFF format support (requires libtiff)
|
||||
#define wxUSE_LIBTIFF 1
|
||||
|
||||
// Set to 1 for TGA format support (loading only)
|
||||
#define wxUSE_TGA 1
|
||||
|
||||
// Set to 1 for GIF format support
|
||||
#define wxUSE_GIF 1
|
||||
|
||||
|
@ -1151,6 +1151,9 @@
|
||||
// Set to 1 for TIFF format support (requires libtiff)
|
||||
#define wxUSE_LIBTIFF 1
|
||||
|
||||
// Set to 1 for TGA format support (loading only)
|
||||
#define wxUSE_TGA 1
|
||||
|
||||
// Set to 1 for GIF format support
|
||||
#define wxUSE_GIF 1
|
||||
|
||||
|
@ -1151,6 +1151,9 @@
|
||||
// Set to 1 for TIFF format support (requires libtiff)
|
||||
#define wxUSE_LIBTIFF 1
|
||||
|
||||
// Set to 1 for TGA format support (loading only)
|
||||
#define wxUSE_TGA 1
|
||||
|
||||
// Set to 1 for GIF format support
|
||||
#define wxUSE_GIF 1
|
||||
|
||||
|
@ -1151,6 +1151,9 @@
|
||||
// Set to 1 for TIFF format support (requires libtiff)
|
||||
#define wxUSE_LIBTIFF 1
|
||||
|
||||
// Set to 1 for TGA format support (loading only)
|
||||
#define wxUSE_TGA 1
|
||||
|
||||
// Set to 1 for GIF format support
|
||||
#define wxUSE_GIF 1
|
||||
|
||||
|
@ -1151,6 +1151,9 @@
|
||||
// Set to 1 for TIFF format support (requires libtiff)
|
||||
#define wxUSE_LIBTIFF 1
|
||||
|
||||
// Set to 1 for TGA format support (loading only)
|
||||
#define wxUSE_TGA 1
|
||||
|
||||
// Set to 1 for GIF format support
|
||||
#define wxUSE_GIF 1
|
||||
|
||||
|
@ -1151,6 +1151,9 @@
|
||||
// Set to 1 for TIFF format support (requires libtiff)
|
||||
#define wxUSE_LIBTIFF 1
|
||||
|
||||
// Set to 1 for TGA format support (loading only)
|
||||
#define wxUSE_TGA 1
|
||||
|
||||
// Set to 1 for GIF format support
|
||||
#define wxUSE_GIF 1
|
||||
|
||||
|
@ -1147,6 +1147,9 @@
|
||||
// Set to 1 for TIFF format support (requires libtiff)
|
||||
#define wxUSE_LIBTIFF 1
|
||||
|
||||
// Set to 1 for TGA format support (loading only)
|
||||
#define wxUSE_TGA 1
|
||||
|
||||
// Set to 1 for GIF format support
|
||||
#define wxUSE_GIF 1
|
||||
|
||||
|
BIN
samples/image/horse.tga
Normal file
BIN
samples/image/horse.tga
Normal file
Binary file not shown.
@ -69,6 +69,7 @@ public:
|
||||
wxBitmap my_horse_pcx;
|
||||
wxBitmap my_horse_pnm;
|
||||
wxBitmap my_horse_tiff;
|
||||
wxBitmap my_horse_tga;
|
||||
wxBitmap my_horse_xpm;
|
||||
wxBitmap my_horse_ico32;
|
||||
wxBitmap my_horse_ico16;
|
||||
@ -618,6 +619,15 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
my_horse_tiff = wxBitmap( image );
|
||||
#endif
|
||||
|
||||
#if wxUSE_LIBTIFF
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + _T("horse.tga"), wxBITMAP_TYPE_TGA ) )
|
||||
wxLogError(wxT("Can't load TGA image"));
|
||||
else
|
||||
my_horse_tga = wxBitmap( image );
|
||||
#endif
|
||||
|
||||
CreateAntiAliasedBitmap();
|
||||
|
||||
my_smile_xbm = wxBitmap( (const char*)smile_bits, smile_width,
|
||||
@ -782,9 +792,13 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
if (my_horse_tiff.Ok())
|
||||
dc.DrawBitmap( my_horse_tiff, 30, 1530 );
|
||||
|
||||
dc.DrawText( _T("XPM handler"), 30, 1745 );
|
||||
dc.DrawText( _T("TGA handler"), 30, 1745 );
|
||||
if (my_horse_tga.Ok())
|
||||
dc.DrawBitmap( my_horse_tga, 30, 1760 );
|
||||
|
||||
dc.DrawText( _T("XPM handler"), 30, 1975 );
|
||||
if (my_horse_xpm.Ok())
|
||||
dc.DrawBitmap( my_horse_xpm, 30, 1760 );
|
||||
dc.DrawBitmap( my_horse_xpm, 30, 2000 );
|
||||
|
||||
// toucans
|
||||
{
|
||||
@ -825,15 +839,17 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
|
||||
if (my_smile_xbm.Ok())
|
||||
{
|
||||
dc.DrawText( _T("XBM bitmap"), 30, 1975 );
|
||||
dc.DrawText( _T("(green on red)"), 30, 1990 );
|
||||
int x = 300, y = 1800;
|
||||
|
||||
dc.DrawText( _T("XBM bitmap"), x, y );
|
||||
dc.DrawText( _T("(green on red)"), x, y + 15 );
|
||||
dc.SetTextForeground( _T("GREEN") );
|
||||
dc.SetTextBackground( _T("RED") );
|
||||
dc.DrawBitmap( my_smile_xbm, 30, 2010 );
|
||||
dc.DrawBitmap( my_smile_xbm, x, y + 30 );
|
||||
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
dc.DrawText( _T("After wxImage conversion"), 150, 1975 );
|
||||
dc.DrawText( _T("(red on white)"), 150, 1990 );
|
||||
dc.DrawText( _T("After wxImage conversion"), x + 120, y );
|
||||
dc.DrawText( _T("(red on white)"), x + 120, y + 15 );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
wxImage i = my_smile_xbm.ConvertToImage();
|
||||
i.SetMaskColour( 255, 255, 255 );
|
||||
@ -841,7 +857,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
wxRED_PEN->GetColour().Red(),
|
||||
wxRED_PEN->GetColour().Green(),
|
||||
wxRED_PEN->GetColour().Blue() );
|
||||
dc.DrawBitmap( wxBitmap(i), 150, 2010, true );
|
||||
dc.DrawBitmap( wxBitmap(i), x + 120, y + 30, true );
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
}
|
||||
|
||||
@ -865,15 +881,17 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
|
||||
if (mono.Ok())
|
||||
{
|
||||
dc.DrawText( _T("Mono bitmap"), 30, 2095 );
|
||||
dc.DrawText( _T("(red on green)"), 30, 2110 );
|
||||
int x = 300, y = 1900;
|
||||
|
||||
dc.DrawText( _T("Mono bitmap"), x, y );
|
||||
dc.DrawText( _T("(red on green)"), x, y + 15 );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.SetTextBackground( wxT("GREEN") );
|
||||
dc.DrawBitmap( mono, 30, 2130 );
|
||||
dc.DrawBitmap( mono, x, y + 30 );
|
||||
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
dc.DrawText( _T("After wxImage conversion"), 150, 2095 );
|
||||
dc.DrawText( _T("(red on white)"), 150, 2110 );
|
||||
dc.DrawText( _T("After wxImage conversion"), x + 120, y );
|
||||
dc.DrawText( _T("(red on white)"), x + 120, y + 15 );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
wxImage i = mono.ConvertToImage();
|
||||
i.SetMaskColour( 255,255,255 );
|
||||
@ -881,7 +899,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
wxRED_PEN->GetColour().Red(),
|
||||
wxRED_PEN->GetColour().Green(),
|
||||
wxRED_PEN->GetColour().Blue() );
|
||||
dc.DrawBitmap( wxBitmap(i), 150, 2130, true );
|
||||
dc.DrawBitmap( wxBitmap(i), x + 120, y + 30, true );
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
}
|
||||
|
||||
@ -1150,42 +1168,10 @@ void MyFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
#if wxUSE_LIBPNG
|
||||
wxImage::AddHandler( new wxPNGHandler );
|
||||
#endif
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
#if wxUSE_LIBJPEG
|
||||
wxImage::AddHandler( new wxJPEGHandler );
|
||||
#endif
|
||||
wxFrame *frame = new MyFrame();
|
||||
frame->Show( true );
|
||||
|
||||
#if wxUSE_LIBTIFF
|
||||
wxImage::AddHandler( new wxTIFFHandler );
|
||||
#endif
|
||||
|
||||
#if wxUSE_GIF
|
||||
wxImage::AddHandler( new wxGIFHandler );
|
||||
#endif
|
||||
|
||||
#if wxUSE_PCX
|
||||
wxImage::AddHandler( new wxPCXHandler );
|
||||
#endif
|
||||
|
||||
#if wxUSE_PNM
|
||||
wxImage::AddHandler( new wxPNMHandler );
|
||||
#endif
|
||||
|
||||
#if wxUSE_XPM
|
||||
wxImage::AddHandler( new wxXPMHandler );
|
||||
#endif
|
||||
|
||||
#if wxUSE_ICO_CUR
|
||||
wxImage::AddHandler( new wxICOHandler );
|
||||
wxImage::AddHandler( new wxCURHandler );
|
||||
wxImage::AddHandler( new wxANIHandler );
|
||||
#endif
|
||||
|
||||
wxFrame *frame = new MyFrame();
|
||||
frame->Show( true );
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
@ -511,6 +511,8 @@
|
||||
|
||||
#define wxUSE_LIBTIFF 0
|
||||
|
||||
#define wxUSE_TGA 0
|
||||
|
||||
#define wxUSE_GIF 0
|
||||
|
||||
#define wxUSE_PNM 0
|
||||
|
@ -53,6 +53,9 @@ void wxInitAllImageHandlers()
|
||||
wxImage::AddHandler( new wxCURHandler );
|
||||
wxImage::AddHandler( new wxANIHandler );
|
||||
#endif
|
||||
#if wxUSE_TGA
|
||||
wxImage::AddHandler( new wxTGAHandler );
|
||||
#endif
|
||||
#if wxUSE_XPM
|
||||
wxImage::AddHandler( new wxXPMHandler );
|
||||
#endif
|
||||
|
748
src/common/imagtga.cpp
Normal file
748
src/common/imagtga.cpp
Normal file
@ -0,0 +1,748 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagtga.cpp
|
||||
// Purpose: wxImage TGA handler
|
||||
// Author: Seth Jackson
|
||||
// CVS-ID: $Id$
|
||||
// Copyright: (c) 2005 Seth Jackson
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_IMAGE && wxUSE_TGA
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/palette.h"
|
||||
#endif
|
||||
|
||||
#include "wx/imagtga.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// TGA error codes.
|
||||
enum
|
||||
{
|
||||
wxTGA_OK = 0,
|
||||
wxTGA_INVFORMAT = 1,
|
||||
wxTGA_MEMERR = 2
|
||||
};
|
||||
|
||||
// TGA header bytes.
|
||||
enum
|
||||
{
|
||||
HDR_OFFSET = 0,
|
||||
HDR_COLORTYPE = 1,
|
||||
HDR_IMAGETYPE = 2,
|
||||
HDR_PALETTESTART = 3,
|
||||
HDR_PALETTELENGTH = 5,
|
||||
HDR_PALETTEBITS = 7,
|
||||
HDR_XORIGIN = 8,
|
||||
HDR_YORIGIN = 10,
|
||||
HDR_WIDTH = 12,
|
||||
HDR_HEIGHT = 14,
|
||||
HDR_BPP = 16,
|
||||
HDR_ORIENTATION = 17,
|
||||
HDR_SIZE
|
||||
};
|
||||
|
||||
// TGA color types.
|
||||
enum
|
||||
{
|
||||
wxTGA_UNMAPPED = 0,
|
||||
wxTGA_MAPPED = 1
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxTGAHandler, wxImageHandler)
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// worker functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static
|
||||
void FlipTGA(unsigned char* imageData, int width, int height, short pixelSize)
|
||||
{
|
||||
int lineLength = width * pixelSize;
|
||||
unsigned char *line1 = imageData;
|
||||
unsigned char *line2 = &imageData[lineLength * (height - 1)];
|
||||
|
||||
unsigned char temp;
|
||||
for ( ; line1 < line2; line2 -= (lineLength * 2))
|
||||
{
|
||||
for (int index = 0; index < lineLength; line1++, line2++, index++)
|
||||
{
|
||||
temp = *line1;
|
||||
*line1 = *line2;
|
||||
*line2 = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void DecodeRLE(unsigned char* imageData, unsigned long imageSize,
|
||||
short pixelSize, wxInputStream& stream)
|
||||
{
|
||||
unsigned long index = 0;
|
||||
unsigned char current;
|
||||
unsigned int length;
|
||||
unsigned char buf[4];
|
||||
|
||||
while (index < imageSize)
|
||||
{
|
||||
current = stream.GetC();
|
||||
|
||||
// RLE packet.
|
||||
if ( current & 0x80 )
|
||||
{
|
||||
// Get the run length of the packet.
|
||||
current &= 0x7f;
|
||||
|
||||
current++;
|
||||
|
||||
length = current;
|
||||
|
||||
index += current * pixelSize;
|
||||
|
||||
// Repeat the pixel length times.
|
||||
stream.Read(buf, pixelSize);
|
||||
|
||||
for (unsigned int i = 0; i < length; i++)
|
||||
{
|
||||
memcpy(imageData, buf, pixelSize);
|
||||
|
||||
imageData += pixelSize;
|
||||
}
|
||||
}
|
||||
else // Raw packet.
|
||||
{
|
||||
// Get the run length of the packet.
|
||||
current++;
|
||||
|
||||
length = current * pixelSize;
|
||||
|
||||
index += length;
|
||||
|
||||
// Write the next length pixels directly to the image data.
|
||||
stream.Read(imageData, length);
|
||||
|
||||
imageData += length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
int ReadTGA(wxImage* image, wxInputStream& stream)
|
||||
{
|
||||
// Read in the TGA header
|
||||
unsigned char hdr[HDR_SIZE];
|
||||
stream.Read(hdr, HDR_SIZE);
|
||||
|
||||
short offset = hdr[HDR_OFFSET] + HDR_SIZE;
|
||||
short colorType = hdr[HDR_COLORTYPE];
|
||||
short imageType = hdr[HDR_IMAGETYPE];
|
||||
int paletteLength = hdr[HDR_PALETTELENGTH] + 256 * hdr[HDR_PALETTELENGTH + 1];
|
||||
int width = (hdr[HDR_WIDTH] + 256 * hdr[HDR_WIDTH + 1]) -
|
||||
(hdr[HDR_XORIGIN] + 256 * hdr[HDR_XORIGIN + 1]);
|
||||
int height = (hdr[HDR_HEIGHT] + 256 * hdr[HDR_HEIGHT + 1]) -
|
||||
(hdr[HDR_YORIGIN] + 256 * hdr[HDR_YORIGIN + 1]);
|
||||
short bpp = hdr[HDR_BPP];
|
||||
short orientation = hdr[HDR_ORIENTATION] & 0x20;
|
||||
|
||||
image->Create(width, height);
|
||||
|
||||
if (!image->Ok())
|
||||
{
|
||||
return wxTGA_MEMERR;
|
||||
}
|
||||
|
||||
const short pixelSize = bpp / 8;
|
||||
|
||||
const unsigned long imageSize = width * height * pixelSize;
|
||||
|
||||
unsigned char *imageData = (unsigned char* )malloc(imageSize);
|
||||
|
||||
if (!imageData)
|
||||
{
|
||||
return wxTGA_MEMERR;
|
||||
}
|
||||
|
||||
unsigned char *dst = image->GetData();
|
||||
|
||||
unsigned char* alpha = NULL;
|
||||
if (bpp == 16 || bpp == 32)
|
||||
{
|
||||
image->SetAlpha();
|
||||
|
||||
alpha = image->GetAlpha();
|
||||
}
|
||||
|
||||
// Seek from the offset we got from the TGA header.
|
||||
stream.SeekI(offset, wxFromStart);
|
||||
|
||||
// Load a palette if we have one.
|
||||
if (colorType == wxTGA_MAPPED)
|
||||
{
|
||||
unsigned char buf[3];
|
||||
|
||||
unsigned char* r = new unsigned char[paletteLength];
|
||||
unsigned char* g = new unsigned char[paletteLength];
|
||||
unsigned char* b = new unsigned char[paletteLength];
|
||||
|
||||
for (int i = 0; i < paletteLength; i++)
|
||||
{
|
||||
stream.Read(buf, 3);
|
||||
|
||||
r[i] = buf[2];
|
||||
g[i] = buf[1];
|
||||
b[i] = buf[0];
|
||||
}
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
|
||||
// Set the palette of the image.
|
||||
|
||||
image->SetPalette(wxPalette(paletteLength, r, g, b));
|
||||
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
delete[] r;
|
||||
delete[] g;
|
||||
delete[] b;
|
||||
}
|
||||
|
||||
// Handle the various TGA formats we support.
|
||||
|
||||
switch (imageType)
|
||||
{
|
||||
// Raw indexed.
|
||||
|
||||
case 1:
|
||||
{
|
||||
const wxPalette& palette = image->GetPalette();
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
|
||||
// No compression read the data directly to imageData.
|
||||
|
||||
stream.Read(imageData, imageSize);
|
||||
|
||||
// If orientation == 0, then the image is stored upside down.
|
||||
// We need to store it right side up.
|
||||
|
||||
if (orientation == 0)
|
||||
{
|
||||
FlipTGA(imageData, width, height, pixelSize);
|
||||
}
|
||||
|
||||
// Handle the different pixel depths.
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
// 8 bpp.
|
||||
|
||||
case 8:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
palette.GetRGB(imageData[index], &r, &g, &b);
|
||||
|
||||
*(dst++) = r;
|
||||
*(dst++) = g;
|
||||
*(dst++) = b;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 16 bpp.
|
||||
|
||||
case 16:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
palette.GetRGB(imageData[index], &r, &g, &b);
|
||||
|
||||
*(dst++) = r;
|
||||
*(dst++) = g;
|
||||
*(dst++) = b;
|
||||
*(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return wxTGA_INVFORMAT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Raw RGB.
|
||||
|
||||
case 2:
|
||||
{
|
||||
// No compression read the data directly to imageData.
|
||||
|
||||
stream.Read(imageData, imageSize);
|
||||
|
||||
// If orientation == 0, then the image is stored upside down.
|
||||
// We need to store it right side up.
|
||||
|
||||
if (orientation == 0)
|
||||
{
|
||||
FlipTGA(imageData, width, height, pixelSize);
|
||||
}
|
||||
|
||||
// Handle the different pixel depths.
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
//16 bpp.
|
||||
|
||||
case 16:
|
||||
{
|
||||
unsigned char temp;
|
||||
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
temp = (imageData[index + 1] & 0x7c) << 1;
|
||||
temp |= temp >> 5;
|
||||
*(dst++) = temp;
|
||||
|
||||
temp = ((imageData[index + 1] & 0x03) << 6) | ((imageData[index] & 0xe0) >> 2);
|
||||
temp |= temp >> 5;
|
||||
*(dst++) = temp;
|
||||
|
||||
temp = (imageData[index] & 0x1f) << 3;
|
||||
temp |= temp >> 5;
|
||||
*(dst++) = temp;
|
||||
|
||||
*(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 24 bpp.
|
||||
|
||||
case 24:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
*(dst++) = imageData[index + 2];
|
||||
*(dst++) = imageData[index + 1];
|
||||
*(dst++) = imageData[index];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 32 bpp.
|
||||
|
||||
case 32:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
*(dst++) = imageData[index + 2];
|
||||
*(dst++) = imageData[index + 1];
|
||||
*(dst++) = imageData[index];
|
||||
*(alpha++) = imageData[index + 3];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return wxTGA_INVFORMAT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Raw grayscale.
|
||||
|
||||
case 3:
|
||||
{
|
||||
// No compression read the data directly to imageData.
|
||||
|
||||
stream.Read(imageData, imageSize);
|
||||
|
||||
// If orientation == 0, then the image is stored upside down.
|
||||
// We need to store it right side up.
|
||||
|
||||
if (orientation == 0)
|
||||
{
|
||||
FlipTGA(imageData, width, height, pixelSize);
|
||||
}
|
||||
|
||||
// Handle the different pixel depths.
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
// 8 bpp.
|
||||
|
||||
case 8:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
*(dst++) = imageData[index];
|
||||
*(dst++) = imageData[index];
|
||||
*(dst++) = imageData[index];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 16 bpp.
|
||||
|
||||
case 16:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
*(dst++) = imageData[index];
|
||||
*(dst++) = imageData[index];
|
||||
*(dst++) = imageData[index];
|
||||
*(alpha++) = imageData[index + 1];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return wxTGA_INVFORMAT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// RLE indexed.
|
||||
|
||||
case 9:
|
||||
{
|
||||
const wxPalette& palette = image->GetPalette();
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
|
||||
// Decode the RLE data.
|
||||
|
||||
DecodeRLE(imageData, imageSize, pixelSize, stream);
|
||||
|
||||
// If orientation == 0, then the image is stored upside down.
|
||||
// We need to store it right side up.
|
||||
|
||||
if (orientation == 0)
|
||||
{
|
||||
FlipTGA(imageData, width, height, pixelSize);
|
||||
}
|
||||
|
||||
// Handle the different pixel depths.
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
// 8 bpp.
|
||||
|
||||
case 8:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
palette.GetRGB(imageData[index], &r, &g, &b);
|
||||
|
||||
*(dst++) = r;
|
||||
*(dst++) = g;
|
||||
*(dst++) = b;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 16 bpp.
|
||||
|
||||
case 16:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
palette.GetRGB(imageData[index], &r, &g, &b);
|
||||
|
||||
*(dst++) = r;
|
||||
*(dst++) = g;
|
||||
*(dst++) = b;
|
||||
*(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return wxTGA_INVFORMAT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// RLE RGB.
|
||||
|
||||
case 10:
|
||||
{
|
||||
// Decode the RLE data.
|
||||
|
||||
DecodeRLE(imageData, imageSize, pixelSize, stream);
|
||||
|
||||
// If orientation == 0, then the image is stored upside down.
|
||||
// We need to store it right side up.
|
||||
|
||||
if (orientation == 0)
|
||||
{
|
||||
FlipTGA(imageData, width, height, pixelSize);
|
||||
}
|
||||
|
||||
// Handle the different pixel depths.
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
//16 bpp.
|
||||
|
||||
case 16:
|
||||
{
|
||||
unsigned char temp;
|
||||
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
temp = (imageData[index + 1] & 0x7c) << 1;
|
||||
temp |= temp >> 5;
|
||||
*(dst++) = temp;
|
||||
|
||||
temp = ((imageData[index + 1] & 0x03) << 6) | ((imageData[index] & 0xe0) >> 2);
|
||||
temp |= temp >> 5;
|
||||
*(dst++) = temp;
|
||||
|
||||
temp = (imageData[index] & 0x1f) << 3;
|
||||
temp |= temp >> 5;
|
||||
*(dst++) = temp;
|
||||
|
||||
*(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 24 bpp.
|
||||
|
||||
case 24:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
*(dst++) = imageData[index + 2];
|
||||
*(dst++) = imageData[index + 1];
|
||||
*(dst++) = imageData[index];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 32 bpp.
|
||||
|
||||
case 32:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
*(dst++) = imageData[index + 2];
|
||||
*(dst++) = imageData[index + 1];
|
||||
*(dst++) = imageData[index];
|
||||
*(alpha++) = imageData[index + 3];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return wxTGA_INVFORMAT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// RLE grayscale.
|
||||
|
||||
case 11:
|
||||
{
|
||||
// Decode the RLE data.
|
||||
|
||||
DecodeRLE(imageData, imageSize, pixelSize, stream);
|
||||
|
||||
// If orientation == 0, then the image is stored upside down.
|
||||
// We need to store it right side up.
|
||||
|
||||
if (orientation == 0)
|
||||
{
|
||||
FlipTGA(imageData, width, height, pixelSize);
|
||||
}
|
||||
|
||||
// Handle the different pixel depths.
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
// 8 bpp.
|
||||
|
||||
case 8:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
*(dst++) = imageData[index];
|
||||
*(dst++) = imageData[index];
|
||||
*(dst++) = imageData[index];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 16 bpp.
|
||||
|
||||
case 16:
|
||||
{
|
||||
for (unsigned long index = 0; index < imageSize; index += pixelSize)
|
||||
{
|
||||
*(dst++) = imageData[index];
|
||||
*(dst++) = imageData[index];
|
||||
*(dst++) = imageData[index];
|
||||
*(alpha++) = imageData[index + 1];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return wxTGA_INVFORMAT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return wxTGA_INVFORMAT;
|
||||
}
|
||||
|
||||
free(imageData);
|
||||
|
||||
return wxTGA_OK;
|
||||
}
|
||||
|
||||
static
|
||||
int SaveTGA(wxImage* WXUNUSED(image), wxOutputStream& WXUNUSED(stream))
|
||||
{
|
||||
wxLogError(wxT("Saving in TGA format is not implemented."));
|
||||
|
||||
return wxTGA_OK;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTGAHandler
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxTGAHandler::LoadFile(wxImage* image,
|
||||
wxInputStream& stream,
|
||||
bool verbose,
|
||||
int WXUNUSED(index))
|
||||
{
|
||||
if ( !CanRead(stream) )
|
||||
{
|
||||
if ( verbose )
|
||||
wxLogError(wxT("TGA: this is not a TGA file."));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
image->Destroy();
|
||||
|
||||
int error = ReadTGA(image, stream);
|
||||
if ( error != wxTGA_OK )
|
||||
{
|
||||
if ( verbose )
|
||||
{
|
||||
switch ( error )
|
||||
{
|
||||
case wxTGA_INVFORMAT:
|
||||
wxLogError(wxT("TGA: image format unsupported."));
|
||||
break;
|
||||
|
||||
case wxTGA_MEMERR:
|
||||
wxLogError(wxT("TGA: couldn't allocate memory."));
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLogError(wxT("TGA: unknown error!"));
|
||||
}
|
||||
}
|
||||
|
||||
image->Destroy();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxTGAHandler::SaveFile(wxImage* image, wxOutputStream& stream, bool verbose)
|
||||
{
|
||||
int error = SaveTGA(image, stream);
|
||||
|
||||
if ( error != wxTGA_OK )
|
||||
{
|
||||
if ( verbose )
|
||||
{
|
||||
switch ( error )
|
||||
{
|
||||
case wxTGA_INVFORMAT:
|
||||
wxLogError(wxT("TGA: invalid image."));
|
||||
break;
|
||||
|
||||
case wxTGA_MEMERR:
|
||||
wxLogError(wxT("TGA: couldn't allocate memory."));
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLogError(wxT("TGA: unknown error!"));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxTGAHandler::DoCanRead(wxInputStream& stream)
|
||||
{
|
||||
// read the fixed-size TGA headers
|
||||
unsigned char hdr[HDR_SIZE];
|
||||
stream.Read(hdr, HDR_SIZE);
|
||||
|
||||
// Check wether we can read the file or not.
|
||||
|
||||
short colorType = hdr[HDR_COLORTYPE];
|
||||
if ( colorType != wxTGA_UNMAPPED && colorType != wxTGA_MAPPED )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
short imageType = hdr[HDR_IMAGETYPE];
|
||||
if ( imageType == 0 || imageType == 32 || imageType == 33 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
short bpp = hdr[HDR_BPP];
|
||||
if ( bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
#endif // wxUSE_IMAGE && wxUSE_TGA
|
@ -699,6 +699,10 @@ SOURCE=.\common\imagpnm.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\imagtga.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\imagtiff.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -2843,6 +2847,10 @@ SOURCE=..\include\wx\imagpnm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\imagtga.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\imagtiff.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
Loading…
Reference in New Issue
Block a user