Valhalla Legends Forums Archive | C/C++ Programming | TGA and other image handling.

AuthorMessageTime
TheNewOne
Alright Ive been asked to write some software for a companys os platform to support tga and other such images. Ive been researching tga to begin with and I was wondering how to exclude certain bytes or to include new ones to change the format. This way I can handle different parts of this image on my own how i want to handle them. Any insight would be greatly appreciated.
August 23, 2005, 7:05 AM
R.a.B.B.i.T
If you want to exclude them...ignore them :|
If you want to include them...add them!
A linked-list sounds good for easy manipulation of what you are asking (at least by the sounds of it), though if it's C, you're out of luck on the linked list part...
[code]struct tga_byte
{
    void *next;
    void *first;
    unsigned char data;
    // other stuff
}[/code]
August 23, 2005, 7:44 AM
LoRd
You'll have to decompress the entire Targa file before you can change it's format.
August 23, 2005, 6:51 PM
Adron
Really, your question makes no sense. You want to change the format, add and remove a few bytes here and there? Just read the original file and write a new file with your bytes added / removed. Does it matter that it's a tga file? Not at all. It probably won't be a tga file after you change the format of it though.
August 24, 2005, 2:21 PM
Arta
[quote author=rabbit link=topic=12594.msg125032#msg125032 date=1124783081]
though if it's C, you're out of luck on the linked list part...
[/quote]

Youwhatnow?
August 24, 2005, 3:17 PM
R.a.B.B.i.T
Last time I tried to use a struct in any of my C I got errors about undefined type, and I haven't learned a way to make linked lists to easy in C thus far.  AFAIK structs are C++?
August 24, 2005, 8:25 PM
KkBlazekK
Structs are C.
August 24, 2005, 8:38 PM
Myndfyr
It depends on how you define it.  Semantically, AFAIK, the following are differently-named (besides capitalization):
[code]
typedef struct tagByteNode {
  unsigned char data;
  struct tagByteNode* next;
} BYTE_NODE, *PBYTE_NODE;

struct byteNode {
  unsigned char data;
  byteNode* next;
}
[/code]

AFAIK, you can't reference the first as "tagByteNode", only as BYTE_NODE, or via a pointer as PBYTE_NODE.  The latter you reference by the name you give the structure.
August 24, 2005, 10:09 PM
R.a.B.B.i.T
Nevermind about being out of luck then.
August 24, 2005, 11:45 PM

Search