Ooops
February 27, 2021, 03:48:22 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bb] SaveTGA by skidracer [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] SaveTGA by skidracer [ 1+ years ago ] (Read 793 times)
BlitzBot
Jr. Member
Posts: 1
[bb] SaveTGA by skidracer [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:38 AM »
Title :
SaveTGA
Author :
skidracer
Posted :
1+ years ago
Description :
This function saves a Blitz3D texture in TGA format, writing both rgb and alpha components of the texture.
Code :
Code: BlitzBasic
Function
SaveTGA
(
name$,texture
)
Local
f,width,height,tbuffer,x,y
width=
TextureWidth
(
texture
)
height=
TextureHeight
(
texture
)
f=
WriteFile
(
name$
)
WriteByte
(
f,
0
)
;idlength
WriteByte
(
f,
0
)
;colormaptype
WriteByte
(
f,
2
)
;imagetype 2=rgb
WriteShort
(
f,
0
)
;colormapindex
WriteShort
(
f,
0
)
;colormapnumentries
WriteByte
(
f,
0
)
;colormapsize
WriteShort
(
f,
0
)
;xorigin
WriteShort
(
f,
0
)
;yorigin
WriteShort
(
f,width
)
;width
WriteShort
(
f,height
)
;height
WriteByte
(
f,
32
)
;pixsize
WriteByte
(
f,
8
)
;attributes
tbuffer=
TextureBuffer
(
texture
)
For
y=height-
1
To
0
Step
-
1
For
x=
0
To
width-
1
WriteInt
f,
ReadPixel
(
x,y,tbuffer
)
Next
Next
CloseFile
f
End Function
Comments :
simonh(Posted 1+ years ago)
Great work Skid!!
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bb] SaveTGA by skidracer [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal