Author | Message | Time |
---|---|---|
Fr3DBr | Ok, now lets start about building separated files for each icon. How anyone would plan doing that ? We know that each icon has a 28x14 size. We know each string that corresponds to each icon (in the extracted tga file), since the strings are in the same sequence as the icons shown on it ! So now we need to extrapolate then ! :D, how do you guys think it could be done ? :D | September 25, 2006, 3:23 AM |
FrostWraith | Same way you read them. Just instead of stripping off the TGA Header, export it along with the pixel data to a new TGA File. | September 25, 2006, 4:03 AM |
Fr3DBr | can you give more details on that ? | September 25, 2006, 10:10 AM |
JoeTheOdd | Well, you know VB, right? Then it shouldn't be a problem. | September 25, 2006, 12:14 PM |
Fr3DBr | i know C#, but im just copying the tga data directly to a file... now i need to know how to cut each icon from its data buffer. | September 25, 2006, 12:50 PM |
JoeTheOdd | If you know C#, plus what I'm about to tell you, it'll be easy. In VB, to create a new file, you use this code: [tt]Open Filename For Output As FileHandle[/tt] where Filename is the full path of the file you wish to create and FileHandle is a number, usually hardcoded (such as [tt]#1[/tt]). To write to that file, use [tt]Print FileHandle, Data (String)[/tt]. However, this will put a CRLF after it. A nifty but awkward way of fixing this is to use [tt]Print Filehandle, Data (String);[/tt] (notice the semicolon). The data is written immediately, but to release the filehandle, use [tt]Close FileHandle[/tt]. There's a proper way of getting a free file handle but I've long forgotten it. Object Browser should be your friend on that, if you must know. Also, sorry for coming off as a jackass in the above post. :) | September 26, 2006, 2:22 AM |
RealityRipple | [code]Dim nFile as integer nFile = FreeFile Open Filename for Whatever as #nFile Print #nFile, strData; Close #nFile[/code] | September 26, 2006, 2:32 AM |
Fr3DBr | actually duh i know how to write files without crlf as i stated i know C#....what i dont know is how to extrapolate each icon from the tga image.... | September 26, 2006, 9:29 AM |
RealityRipple | split the file up into little 16x28 squares? | September 26, 2006, 9:40 AM |
Fr3DBr | how????? | September 26, 2006, 1:20 PM |
RealityRipple | Read 16 rows of 28 pixels, put it into a file. Read the next 16 rows of 28 pixels, put it into a second file. Repeat until you reach the last pixel. | September 26, 2006, 1:29 PM |
Fr3DBr | hmmm its starting to make sense... how do i know when a row have 28 pixels ? | September 26, 2006, 3:54 PM |
rabbit | Tell your program to read 28 pixels' data? | September 26, 2006, 4:47 PM |
Fr3DBr | its easy saying, if you tell me to read 28 sequential bytes per row assuming that each pixel is byte then fine.... if not it stills like saying to hit a small point on a microscope with a bazooka. | September 26, 2006, 6:22 PM |
rabbit | That's easy... bazookas can hit a lot of points. | September 26, 2006, 8:28 PM |
JoeTheOdd | [quote author=Fr3DBr link=topic=15785.msg159026#msg159026 date=1159262999] actually duh i know how to write files without crlf as i stated i know C#....what i dont know is how to extrapolate each icon from the tga image.... [/quote] Aren't you brilliant? Of course you know how to write a file using VB, subverting a VB feature, because you know the wonderful all-featured C#. Oh! How foolish of me not to have guessed? | September 26, 2006, 8:47 PM |
Quarantine | [quote author=Joe[x86] link=topic=15785.msg159043#msg159043 date=1159303659] [quote author=Fr3DBr link=topic=15785.msg159026#msg159026 date=1159262999] actually duh i know how to write files without crlf as i stated i know C#....what i dont know is how to extrapolate each icon from the tga image.... [/quote] Aren't you brilliant? Of course you know how to write a file using VB, subverting a VB feature, because you know the wonderful all-featured C#. Oh! How foolish of me not to have guessed? [/quote] Considering using C# is a little harder it'd be pretty silly if he didn't know how, or couldn't pick it up right away. | September 26, 2006, 8:50 PM |
Fr3DBr | lets dont forget the scope of this thread... the question still remains on what should be done to properly extrapolate the images. | September 26, 2006, 9:39 PM |
FrostWraith | Dude, seriously. http://bnetdocs.valhallalegends.com/content.php?Section=d&id=3 Also, TGA images are one of the easiest to Read. If I can do it in VB, so can you. | September 26, 2006, 9:49 PM |
Fr3DBr | man actually i know the document, i just dont know how to separate the TGA DATA i got on my tga file... i have all the icons merged together in one vertical line.... i want to have one file to each icon.... | September 26, 2006, 9:51 PM |
FrostWraith | OK, after each looping of reading images, call this sub: sry, its VB [code]Public Sub WriteValues(strData As String, sFilename As String) Dim nFileNum As Integer nFileNum = FreeFile Open sFilename For Binary Lock Read Write As #nFileNum Put #nFileNum, , strData Close #nFileNum End Sub[/code] | September 26, 2006, 10:14 PM |
Fr3DBr | (DWORD) Size of BNI header (WORD) BNI Version (WORD) Alignment Padding (Unused) (DWORD) Number of Icons (DWORD) Data Offset For each icon: (DWORD) Flags (DWORD) X Size (DWORD) Y Size (DWORD[32]) Products for this icon* Image in Targa format Lets discuss about it... First you parse : 16 Bytes that are the (BNI HEADER) no problem... Then since you have : 20 Icons You will have to parse 12Bytes + (8Bytes if the Flags are 0 or 4 Bytes if its != than 0) Sure... Then after all that... you have the TGA Image wich you (SHOULD) separate from all the data you parsed before... No problem with that i already have the Good Working Targa File that i can see the 20 icons on it in a Vertical Line... (now) how can i have EACH of these icons in one independant file ? Thats what im talking about .... because when looping the First data that tells you wich String Reamins to Wich ICON you dont get anything related to targa format... got me now ? Thanks. | September 26, 2006, 10:29 PM |
RealityRipple | wtf is Binary Lock Read Write? that sounds like way too much for just writing data. Try Binary Access Write. In that situation, Lock and Read are useless. | September 26, 2006, 11:07 PM |
FrostWraith | Meh, just from a tuturial I read. I just never got out of the habit of putting it all there. | September 26, 2006, 11:35 PM |
Maddox | I wrote this a couple of years ago. This will take a BNI file, parse it, and let you draw it to a DC. I hope this helps. http://www.yousendit.com/transfer.php?action=download&ufid=E3C3E0486D1B28AB | October 1, 2006, 7:11 PM |
HeRo | http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=56537&lngWId=1 http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=28587&lngWId=1 http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=35713&lngWId=1 | October 1, 2006, 8:17 PM |
Topaz | [quote author=heRo link=topic=15785.msg159290#msg159290 date=1159733833] http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=56537&lngWId=1 http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=28587&lngWId=1 http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=35713&lngWId=1 [/quote] Cool. +1 | October 2, 2006, 2:03 AM |
dRAgoN | [code]'********************************************** '* l)ragon, Dec. 19, 2002 * '* TGA Runlength decodeing * '********************************************** Private Sub RLEDecode(ByVal cRead As FileReader) Dim outBuf As String Dim BytesToRead As Long Dim DecodedSize As Long Dim n As Long Dim pt As Byte Dim bufi As Long Dim tLength As Long Dim l As Long, b As Long, c As Long, iBul As Long BytesToRead = THead.BitsPerPixel / &H8 DecodedSize = THead.Height * THead.Width * BytesToRead While bufi < DecodedSize pt = cRead.GetByteAt(l + 1) c = 0 If pt > 127 Then n = pt - 127 For b = 0 To (n - 1) For iBul = (l + 2) To ((BytesToRead + (l + 2)) - 1) outBuf = outBuf & Chr$(cRead.GetByteAt(iBul)) Next bufi = bufi + BytesToRead Next b l = BytesToRead + 1 + l n = c + (n * BytesToRead) + 1 Else n = pt + 1 tLength = n * BytesToRead For iBul = (l + 2) To ((tLength + (l + 2)) - 1) outBuf = outBuf & Chr$(cRead.GetByteAt(iBul)) Next c = c + tLength bufi = bufi + c l = (n * BytesToRead + 1) + l n = c + n End If Wend Call cRead.SetFileData(outBuf) End Sub[/code] Feel free to use it, I still think it looks like crap though. | October 4, 2006, 1:19 AM |
JoeTheOdd | What VB code doesn't? | October 5, 2006, 12:13 PM |
MyStiCaL | this doesn't look like crap. [code] Debug.Print "vb6 rocks out with the cock out" [/code] | October 5, 2006, 12:24 PM |
JoeTheOdd | Yes it does. It looks horrible. Java is much more ellegent. [code]public static void main(String args[]) { System.out.println("Visual Basic is fugly and nothing you do or say will ever change that."); }[/code] Also, check out this nifty calculator I wrote. Fugly. [code]Private Sub cmdClear_Click() txtEquation = "" End Sub Private Sub cmdEquals_Click() txtEquation = sc.Eval(txtEquation) End Sub Private Sub cmdMul_Click() txtEquation = txtEquation & "*" End Sub Private Sub cmdDiv_Click() txtEquation = txtEquation & "/" End Sub Private Sub cmdAdd_Click() txtEquation = txtEquation & "+" End Sub Private Sub cmdSub_Click() txtEquation = txtEquation & "-" End Sub Private Sub cmdCalculatorKey_Click(Index As Integer) txtEquation = txtEquation & CStr(Index) End Sub[/code] | October 5, 2006, 4:42 PM |
dRAgoN | [quote author=Joe[x86] link=topic=15785.msg159451#msg159451 date=1160066553] Yes it does. It looks horrible. Java is much more ellegent. [code]public static void main(String args[]) { System.out.println("Visual Basic is fugly and nothing you do or say will ever change that."); }[/code][/quote] [code]Sub Main() MsgBox "Messy java code soon to be detected." + vbCrLf + vbCrLf + _ "To format C: please press OK or just close this message box.", vbCritical, "Fatal-Error" End Sub[/code] [quote author=Joe[x86] link=topic=15785.msg159451#msg159451 date=1160066553] Also, check out this nifty calculator I wrote. Fugly. [code]Private Sub cmdClear_Click() txtEquation = "" End Sub Private Sub cmdEquals_Click() txtEquation = sc.Eval(txtEquation) End Sub Private Sub cmdMul_Click() txtEquation = txtEquation & "*" End Sub Private Sub cmdDiv_Click() txtEquation = txtEquation & "/" End Sub Private Sub cmdAdd_Click() txtEquation = txtEquation & "+" End Sub Private Sub cmdSub_Click() txtEquation = txtEquation & "-" End Sub Private Sub cmdCalculatorKey_Click(Index As Integer) txtEquation = txtEquation & CStr(Index) End Sub[/code] [/quote] That is such a waste of memory. | October 5, 2006, 11:21 PM |
UserLoser | [img]http://forums.clubrsx.com/images/smilies/beat-dead-horse.gif[/img] | October 6, 2006, 12:18 AM |
MyStiCaL | HAHA LOVE IT! | October 6, 2006, 12:47 AM |
Quarantine | [quote author=Joe[x86] link=topic=15785.msg159451#msg159451 date=1160066553] Yes it does. It looks horrible. Java is much more ellegent. [code]public static void main(String args[]) { System.out.println("Visual Basic is fugly and nothing you do or say will ever change that."); }[/code] [/quote] By elegant if you mean cross compatible then yes, you're right. Bear in mind that it's only possible advantage. It's not nearly as a great as you make it out to be | October 6, 2006, 6:59 PM |
dRAgoN | Anyways back to the topic wtf would you want to extract them anyways, there's no need for that when you could use them directly with a few tricks. | October 7, 2006, 12:06 AM |
Zakath | [quote author=Joe[x86] link=topic=15785.msg159451#msg159451 date=1160066553] Yes it does. It looks horrible. Java is much more ellegent. [/quote] You misspelled 'elegant.' | October 27, 2006, 6:41 PM |
HeRo | [quote author=Zakath link=topic=15785.msg160217#msg160217 date=1161974464] [quote author=Joe[x86] link=topic=15785.msg159451#msg159451 date=1160066553] Yes it does. It looks horrible. Java is much more ellegent. [/quote] You misspelled 'elegant.' [/quote] Owned, imo. | October 27, 2006, 10:19 PM |