| |
|
|
Andreas Gaida | Hi! here one small example How is a BMP File with 24bit and 8bit Color Depth(unkomprimiert) yourself load and indicating without The Profan own BMP routines. CompileMarkSeparationDeclare datei_load$,bits_per_pixel&,pixels_width&,pixels_height&,compresion_image&,offset_image&,pixels_width_rest&
Declare Temp1&,Temp2&,color_bmp&[257,4],temp_R&,temp_G&,temp_B&
cls
datei_load$ = LoadFile$(ÖFFNE,BMP|*.bmp;*.bmp|Batch|*.bmp)
sleep 50
cls
Assign #1, datei_load$
OpenRW #1
print @GetChar$(#1,2) 2 BM ID
print @GetLong(#1) 6 Länge
print @GetWord(#1) 8 0
print @GetWord(#1) 10 0
offset_image& = @GetLong(#1) 14 Offset off Data
print offset_image&
print @GetLong(#1) 18 Grösse des Headers
pixels_width& = @GetLong(#1) 22 bitmap width in pixels
print pixels_width&
pixels_height& = @GetLong(#1) 26 bitmap height in pixels
print pixels_height&
print @GetWord(#1) 28 number of color planes being used
bits_per_pixel& = @GetWord(#1) 30 number of bits per pixel
print Bit p Pixel : ;bits_per_pixel&
compresion_image& = @GetLong(#1) 34 compression method being used
print compresion_image& 0 BI_RGB none Most common
print @GetLong(#1) 38 This is the size of the raw bitmap data
print @GetLong(#1) 42 horizontal resolution of the image. (pixel per meter)
print @GetLong(#1) 46 vertical resolution of the image. (pixel per meter)
print @GetLong(#1) 50 number of colors used
print @GetLong(#1) 54 number of important colors used
if (@Int((pixels_width&/4))-(pixels_width&/4)) <> 0
pixels_width_rest& = ((@Int(pixels_width&/4)+1)*4) - pixels_width&
endif
if (bits_per_pixel& = 24) and (compresion_image& = 0) and (offset_image& = 54)
WhileLoop pixels_height&
Temp1& = &loop
WhileLoop pixels_width&
temp_R& = @GetByte(#1)
temp_G& = @GetByte(#1)
temp_B& = @GetByte(#1)
SetPixel &loop,((pixels_height&+1) - Temp1&),@RGB(temp_B&,temp_G&,temp_R&)
SetPixel &loop,((pixels_height&+1) - Temp1&),@RGB(@GetByte(#1),@GetByte(#1),@GetByte(#1))
EndWhile
if pixels_width_rest& = 1
@GetByte(#1)
@GetByte(#1)
@GetByte(#1)
elseif pixels_width_rest& = 2
@GetByte(#1)
@GetByte(#1)
elseif pixels_width_rest& = 3
@GetByte(#1)
Endif
EndWhile
elseif (bits_per_pixel& = 8) and (compresion_image& = 0) and (offset_image& = 54)
WhileLoop 256
color_bmp&[&loop,3] = @GetByte(#1)@Ord(GetChar$(#1,1))
color_bmp&[&loop,2] = @GetByte(#1)@Ord(GetChar$(#1,1))
color_bmp&[&loop,1] = @GetByte(#1)@Ord(GetChar$(#1,1))
color_bmp&[&loop,4] = @GetByte(#1)@Ord(GetChar$(#1,1))
EndWhile
WhileLoop pixels_height&
Temp1& = &loop
WhileLoop pixels_width&
Temp2& = (@GetByte(#1)+1)(@Ord(GetChar$(#1,1)) +1)
SetPixel &loop,(pixels_height&+1) - Temp1&,@RGB(color_bmp&[Temp2&,1],color_bmp&[Temp2&,2],color_bmp&[Temp2&,3])
EndWhile
if pixels_width_rest& = 1
@GetByte(#1)
elseif pixels_width_rest& = 2
@GetByte(#1)
@GetByte(#1)
elseif pixels_width_rest& = 3
@GetByte(#1)
@GetByte(#1)
@GetByte(#1)
Endif
EndWhile
else
Print Das Bild ist in einen nicht unterstützten Format
Endif
waitinput
|
|
|
| Athlon X2 4800 , 2GB Ram , GeForce 7800GT Windows XP Pro , XProfan 10 und 11 , Profan2Cpp 1.6b | 08/14/07 ▲ |
|
|
|
|
| The code is very optimier- and beschleunigbar, but it shining functions and shows very beautiful How simply BMP aufgebaut his can. are on the OGL-Rumprobieren for BUMP- and AlphaChannel what? like about my .tex-stature not? |
|
|
| |
|
|
|
Andreas Gaida | to be honest comb I not yet moreover your Source code me correctly. to examine. there tappt im dunkeln something umfamgreicher are what about me me mommentan already since several Meet on Nachschicht rumtreibe have I me first something leichtere Kost undertaken . your .tex stature is already o.k , for Games Programming anyhow lest eachone a without Problems The Textures change can .
MfG Andreas |
|
|
| Athlon X2 4800 , 2GB Ram , GeForce 7800GT Windows XP Pro , XProfan 10 und 11 , Profan2Cpp 1.6b | 08/15/07 ▲ |
|
|
|