Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / filetga.h
blob1d6dfc6769c2bfea91458688a5ea3d019cc5d7fd
1 #ifndef FILETGA_H
2 #define FILETGA_H
4 #include "filelist.h"
5 #include "guicast.h"
7 class FileTGA : public FileList
9 public:
10 FileTGA(Asset_GC asset, File *file);
11 ~FileTGA();
13 static int check_sig(Asset_GC asset);
14 static void get_parameters(BC_WindowBase *parent_window,
15 Asset_GC asset,
16 BC_WindowBase* &format_window,
17 int audio_options,
18 int video_options);
19 int read_frame_header(char *path);
20 static char* compression_to_str(char *compression);
21 static char* str_to_compression(char *string);
23 int64_t get_memory_usage();
24 // To be used in single frame FileTGA
25 static void read_tga(Asset_GC asset, VFrame *frame, VFrame *data, VFrame* &temp);
26 static void write_tga(Asset_GC asset, VFrame *frame, VFrame *data, VFrame* &temp);
28 int can_copy_from(Edit *edit, int64_t position);
29 static int get_best_colormodel(Asset_GC asset, int driver);
30 int colormodel_supported(int colormodel);
31 int read_frame(VFrame *frame, VFrame *data);
32 int write_frame(VFrame *frame, VFrame *data, FrameWriterUnit *unit);
33 FrameWriterUnit* new_writer_unit(FrameWriter *writer);
35 // For decoding only
36 VFrame *temp;
38 private:
39 static void write_data(unsigned char *buffer,
40 VFrame *data,
41 int64_t &file_offset,
42 int64_t len);
43 static void read_line(unsigned char *row,
44 unsigned char *data,
45 int64_t &file_offset,
46 int image_type,
47 int bpp,
48 int image_compression,
49 int bytes,
50 int width,
51 int fliphoriz,
52 int alphabits,
53 int data_size);
54 static void flip_line(unsigned char *row, int bytes, int width);
55 static void rle_read(unsigned char *row,
56 unsigned char *data,
57 int64_t &file_offset,
58 int bytes,
59 int width);
60 static void rle_write(unsigned char *buffer,
61 int width,
62 int bytes,
63 VFrame *frame,
64 int64_t &file_offset);
65 static void bgr2rgb(unsigned char *dest,
66 unsigned char *src,
67 int width,
68 int bytes,
69 int alpha);
70 static void upsample(unsigned char *dest,
71 unsigned char *src,
72 int width,
73 int bytes);
76 class TGAUnit : public FrameWriterUnit
78 public:
79 TGAUnit(FileTGA *file, FrameWriter *writer);
80 ~TGAUnit();
81 VFrame *temp;
82 FileTGA *file;
85 class TGAConfigVideo : public BC_Window
87 public:
88 TGAConfigVideo(BC_WindowBase *gui, Asset_GC asset);
89 ~TGAConfigVideo();
90 int create_objects();
91 int close_event();
93 ArrayList<BC_ListBoxItem*> compression_items;
94 BC_WindowBase *gui;
95 Asset_GC asset;
98 class TGACompression : public BC_PopupTextBox
100 public:
101 TGACompression(TGAConfigVideo *gui,
102 int x,
103 int y,
104 Asset_GC asset,
105 ArrayList<BC_ListBoxItem*> *compression_items);
106 int handle_event();
107 Asset_GC asset;
110 #endif
112 // Local Variables:
113 // mode: C++
114 // c-file-style: "linux"
115 // End: