Español
Fuente/ Codesnippets

Bmp Expediente Farbtiefe Laden

 

Andreas
Gaida
Hi!
Hier una kleines Ejemplo cómo una BMP Expediente con 24Bit y 8Bit Farbtiefe(unkomprimiert)
selber Ladet y Anzeigt sin la Profano eigenen BMP Routinen.
KompilierenMarcaSeparación
Declare 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
14.08.2007  
 



Der Code es muy optimier- y beschleunigbar, aber él scheint trabajo y zeigt muy schön como simplemente BMP aufgebaut ser kann. Bist al OGL-Rumprobieren para BUMP- y AlphaChannel qué? Magst etwa mein .tex-Formato no?
 
14.08.2007  
 




Andreas
Gaida
Um ehrlich a ser kamm Todavía no dazu Su Quellcodes me correcto anzusehen. Como ellos auch algo umfamgreicher son y yo mich mommentan ya seit más Tagen en Nachschicht rumtreibe Yo me primero algo leichtere Kost vorgenommen . Su .tex Formato es ya o.k , para Juegos Programación sowieso así no cada una sin probleme el
Texturen verändern kann .

MfG
Andreas
 
Athlon X2 4800 , 2GB Ram , GeForce 7800GT
Windows XP Pro , XProfan 10 und 11 , Profan2Cpp 1.6b
15.08.2007  
 



Zum Quelltext


Título del Tema, max. 100 Signo.
 

Systemprofile:

Kein Systemprofil creado. [anlegen]

XProfan:

 Contribución  Font  Smilies  ▼ 

Bitte registro en una Contribución a verfassen.
 

Tema opciones

4.149 Views

Untitledvor 0 min.
Sven Bader23.10.2021
Uwe ''Pascal'' Niemeier01.04.2014

Themeninformationen

Dieses Thema ha 2 subscriber:

Andreas Gaida (2x)
iF (1x)


Admins  |  AGB  |  Applications  |  Autores  |  Chat  |  Política de Privacidad  |  Descargar  |  Entrance  |  Ayuda  |  Merchantportal  |  Pie de imprenta  |  Mart  |  Interfaces  |  SDK  |  Services  |  Juegos  |  Búsqueda  |  Support

Ein Projekt aller XProfan, el lo son!


Mi XProfan
Privado Noticias
Eigenes Ablageforum
Temas-Merkliste
Eigene Beiträge
Eigene Temas
Zwischenablage
Cancelar
 Deutsch English Français Español Italia
Traducciones

Política de Privacidad


Wir uso Cookies sólo como Session-Cookies wegen el technischen Notwendigkeit y en uns hay no Cookies de Drittanbietern.

Wenn du hier en unsere Webseite klickst oder navigierst, stimmst du unserer Erfassung de Informationen en unseren Cookies en XProfan.Net a.

Weitere Informationen a unseren Cookies y dazu, como du el Kontrolle darüber behältst, findest du en unserer nachfolgenden Datenschutzerklärung.


einverstandenDatenschutzerklärung
Yo möchte no Cookie