00001 #ifndef FILETGA_H
00002 #define FILETGA_H
00003
00004 #include "filelist.h"
00005 #include "guicast.h"
00006
00007 class FileTGA : public FileList
00008 {
00009 public:
00010 FileTGA(Asset *asset, File *file);
00011 ~FileTGA();
00012
00013 static int check_sig(Asset *asset);
00014 static void get_parameters(BC_WindowBase *parent_window,
00015 Asset *asset,
00016 BC_WindowBase* &format_window,
00017 int audio_options,
00018 int video_options);
00019 int read_frame_header(char *path);
00020 static char* compression_to_str(char *compression);
00021 static char* str_to_compression(char *string);
00022
00023 int get_memory_usage();
00024
00025 static void read_tga(Asset *asset, VFrame *frame, VFrame *data, VFrame* &temp);
00026 static void write_tga(Asset *asset, VFrame *frame, VFrame *data, VFrame* &temp);
00027
00028 int can_copy_from(Edit *edit, int64_t position);
00029 static int get_best_colormodel(Asset *asset, int driver);
00030 int colormodel_supported(int colormodel);
00031 int read_frame(VFrame *frame, VFrame *data);
00032 int write_frame(VFrame *frame, VFrame *data, FrameWriterUnit *unit);
00033 FrameWriterUnit* new_writer_unit(FrameWriter *writer);
00034
00035
00036 VFrame *temp;
00037
00038 private:
00039 static void write_data(unsigned char *buffer,
00040 VFrame *data,
00041 int64_t &file_offset,
00042 int64_t len);
00043 static void read_line(unsigned char *row,
00044 unsigned char *data,
00045 int64_t &file_offset,
00046 int image_type,
00047 int bpp,
00048 int image_compression,
00049 int bytes,
00050 int width,
00051 int fliphoriz,
00052 int alphabits,
00053 int data_size);
00054 static void flip_line(unsigned char *row, int bytes, int width);
00055 static void rle_read(unsigned char *row,
00056 unsigned char *data,
00057 int64_t &file_offset,
00058 int bytes,
00059 int width);
00060 static void rle_write(unsigned char *buffer,
00061 int width,
00062 int bytes,
00063 VFrame *frame,
00064 int64_t &file_offset);
00065 static void bgr2rgb(unsigned char *dest,
00066 unsigned char *src,
00067 int width,
00068 int bytes,
00069 int alpha);
00070 static void upsample(unsigned char *dest,
00071 unsigned char *src,
00072 int width,
00073 int bytes);
00074 };
00075
00076 class TGAUnit : public FrameWriterUnit
00077 {
00078 public:
00079 TGAUnit(FileTGA *file, FrameWriter *writer);
00080 ~TGAUnit();
00081 VFrame *temp;
00082 FileTGA *file;
00083 };
00084
00085 class TGAConfigVideo : public BC_Window
00086 {
00087 public:
00088 TGAConfigVideo(BC_WindowBase *gui, Asset *asset);
00089 ~TGAConfigVideo();
00090 int create_objects();
00091 int close_event();
00092
00093 ArrayList<BC_ListBoxItem*> compression_items;
00094 BC_WindowBase *gui;
00095 Asset *asset;
00096 };
00097
00098 class TGACompression : public BC_PopupTextBox
00099 {
00100 public:
00101 TGACompression(TGAConfigVideo *gui,
00102 int x,
00103 int y,
00104 Asset *asset,
00105 ArrayList<BC_ListBoxItem*> *compression_items);
00106 int handle_event();
00107 Asset *asset;
00108 };
00109
00110 #endif