BMP Grafikentschlüssel
Übersicht

morszeckBetreff: BMP Grafikentschlüssel |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hier ein Beispielprogramm wie man ein BMP-Bild dekodieren kann. Zur Zeit werden 1-bit (monochrom) 8-bit (256 Graustufen) und 24-bit (Truecolor) unterstützt.
Quelltext sowie die Variabeln sind selbsterklärend. Das ganze soll zu Lehrzwecken dienen. BlitzBasic: [AUSKLAPPEN] ; BMP Grafikentschlüssel V1.2 |
||
WinXpProf&SP2, B3D V1.88, B+ V1.40, BMax101Beta, AMD TB1.4GHz, DDR266/768MB, GeForce3@64MB |
![]() |
Vertex |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ist das nicht von morszeck geklaut? | ||
vertex.dreamfall.at | GitHub |
hot-bitGast |
![]() Antworten mit Zitat |
|
---|---|---|
Hoi,
nein, glaube nicht ! ![]() Toni |
||
![]() |
MVB |
![]() Antworten mit Zitat ![]() |
---|---|---|
morszeck=ping=husky | ||
aquamonit.de|BlitzMax|MaxGUI |
morszeck |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
genau ![]() |
||
WinXpProf&SP2, B3D V1.88, B+ V1.40, BMax101Beta, AMD TB1.4GHz, DDR266/768MB, GeForce3@64MB |
David |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hi!
Gut, aber muss noch bisschen erweitert werden, z.B. werden noch keine Komprimierten Bilder unterstützt oder?? ![]() grüße |
||
http://bl4ckd0g.funpic.de |
![]() |
D2006Administrator |
![]() Antworten mit Zitat ![]() |
---|---|---|
jetzt hör ich das schon das zweite mal dieses Wochenende:
seit wann gibt es komprimierte BMP's ??? In Bitmaps ist doch jeder Pixel eingespeichert, weswegen die auch so verdammt groß sind, oder irre ich mich da ? MfG |
||
![]() |
Vertex |
![]() Antworten mit Zitat ![]() |
---|---|---|
Axo, gut dann hatte ich ja insofern mit morszeck recht ![]() D2006: Also ich kenn mich mit BMP auch nicht so genau aus, aber es hat glaube ich eine extra Option für Run length encoding. mfg olli |
||
vertex.dreamfall.at | GitHub |
morszeck |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Es gibt sowas wie eine komprimierung von BMP, also wen man dies so sagen darf. Wen jemanden dies schon aufgefallen ist, so kann man in einer bmp eine Farbtabelle abspeichern. So ist jedes Byte keine Farbinformation sondern ein Wert in der Farbtabelle... So ähnlich wie es in GIF's gehandhabt wird... | ||
WinXpProf&SP2, B3D V1.88, B+ V1.40, BMax101Beta, AMD TB1.4GHz, DDR266/768MB, GeForce3@64MB |
![]() |
Vertex |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich habe mal von Wotsit das ganze herausgefischt:
Zitat: Bitmap Compression
Windows versions 3.0 and later support run-length encoded (RLE) formats for compressing bitmaps that use 4 bits per pixel and 8 bits per pixel. Compression reduces the disk and memory storage required for a bitmap. Compression of 8-Bits-per-Pixel Bitmaps When the biCompression member of the BITMAPINFOHEADER structure is set to BI_RLE8, the DIB is compressed using a run-length encoded format for a 256-color bitmap. This format uses two modes: encoded mode and absolute mode. Both modes can occur anywhere throughout a single bitmap. Encoded Mode A unit of information in encoded mode consists of two bytes. The first byte specifies the number of consecutive pixels to be drawn using the color index contained in the second byte. The first byte of the pair can be set to zero to indicate an escape that denotes the end of a line, the end of the bitmap, or a delta. The interpretation of the escape depends on the value of the second byte of the pair, which must be in the range 0x00 through 0x02. Following are the meanings of the escape values that can be used in the second byte: Second byte Meaning 0 End of line. 1 End of bitmap. 2 Delta. The two bytes following the escape contain unsigned values indicating the horizontal and vertical offsets of the next pixel from the current position. husky: Sind die GIF Dateien NUR auf diese Tabelle beschränkt als Kompression, oder wird noch eine weitere durchgeführt? |
||
vertex.dreamfall.at | GitHub |
morszeck |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Bei gif bin ich mir nicht sicher. Soweit ich aber weiss, kann man mit gif's nur max 256 Farben darstellen, die aber in einer Farbtabelle mitteln Truecolor definiert werden können. Aber gif finde ich ausser wegen der Animationskontrolle uninteressant. Da ist png interessanter...
Von GalieleoPress gibts ein Buch über verschiedenste Datenformate wie auch BitMap sowie andere zbsp Word etc... Das kann ich nur empfehlen... |
||
WinXpProf&SP2, B3D V1.88, B+ V1.40, BMax101Beta, AMD TB1.4GHz, DDR266/768MB, GeForce3@64MB |
![]() |
Xenon |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi,
ich hab mir für meine OpenGL Engine auch einen BMP Loader gebaut, der nicht auf deinen Code hier aufbaut, aber ziemlich Ähnlich abläuft. Dein Code husky hat allerdings ein paar Macken: du ließt zuerst in eine Bank und speicherst das ganze dann umständlich in Variablen mit so nem for-Schleifen-Kack um anscheinend Little Endian zu lesen. Allerdings wird immer Little Endian gelesen, dh. du kannst ruhig ReadInt, ReadShort und ReadByte nehmen, wie ich! Ebenso sind der 1 Bit und 8 Bit Code falsch, da es nicht wirklich Monochrom oder Graustufen ist. In Wirklichkeit sind die Werte die Indizes für die Palette die du ja auch ließt! Zusätzlich kann mein Code auch 4 Bit Bitmaps lesen. Das einzige was noch fehlt ist die Komprimierung. Darum habe ich meinen Code nach BB übersetzt und stelle ihn euch hier zu Verfügung: BlitzBasic: [AUSKLAPPEN] ; Bitmap laden |
||
David |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hi!
Genau, das Bmp Format unterstützt das RLE Kompressionsverfahren, was tatsächlich eine Kompression ist, weshalb man es auch so nennen darf. Das ganze ist recht simpel, die Farbwerte werden in Blöcken gespeichert, wobei alle gleichen Werte zu einem Block zusammen gefasst werden. Hier mal ein Codeschnippsel aus meinem aktuellen Projekt. BlitzBasic: [AUSKLAPPEN]
Am Rande: mit einer Farbpalette hat das allerdings nichts zu tuen, aber es ist natürlich möglich BMP Dateien mit Palette zu speichern. grüße |
||
http://bl4ckd0g.funpic.de |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group