AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

RGB -> Bitmap

Ein Thema von Neutral General · begonnen am 8. Aug 2006 · letzter Beitrag vom 12. Aug 2006
 
Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#13

Re: RGB -> Bitmap

  Alt 11. Aug 2006, 14:38
Delphi-Quellcode:
  
     SetLength(TGAInfo.Picture, TGAInfo.Header.Width, TGAInfo.Header.Height);
  if TGAInfo.Header.PictureFormat in [1..3] then
  begin
   for j:= 0 to TGAInfo.Header.Height-1 do begin
    for i:= 0 to TGAInfo.Header.Width-1 do begin
     AStream.Read(TGAInfo.Picture[i,j].B, SizeOf(Byte));
     AStream.Read(TGAInfo.Picture[i,j].G, SizeOf(Byte));
     AStream.Read(TGAInfo.Picture[i,j].R, SizeOf(Byte));
    end;
   end;

    BmpStream := WriteBmpHeader(TGAInfo.Header.Width,TGAInfo.Header.Height,TGAInfo.Header.Bpp);
    for j:= 0 to TGAInfo.Header.Height-1 do begin
     for i:= 0 to TGAInfo.Header.Width-1 do begin
      with BmpStream do
      begin
       Write(TGAInfo.Picture[i,j].B,SizeOf(Byte));
       Write(TGAInfo.Picture[i,j].G,SizeOf(Byte));
       Write(TGAInfo.Picture[i,j].R,SizeOf(Byte));
      end;
     end;
     for i:= 0 to (4 - (j * 3) mod 4) - 1 do
       BmpStream.Write(NULL,SizeOf(Byte));
    end;
    BmpStream.Read(FBitmap, BmpStream.Size);
// FBitmap.LoadFromStream(BmpStream); geht auch nicht
WriteBmpHeader:

Delphi-Quellcode:
function WriteBmpHeader(Width,Height: Longword; bpp: Word): TMemoryStream;
const Null : Longword = 0;
      Dat1 : Word = $4D42;
      Dat2 : Longword = $EC4;
var lwTemp: Longword;
    wTemp : Word;
begin
 Result := TMemoryStream.Create;
 with Result do
 begin
    Write(Dat1,SizeOf(Word));
    Write(NULL,SizeOf(Longword));
    Write(NULL,SizeOf(Longword));
    lwTemp := 54;
    Write(lwTemp,SizeOf(Longword));
    lwTemp := 40;
    Write(lwTemp,SizeOf(Longword));
    Write(Width,SizeOf(Longword));
    Write(Height,SizeOf(Longword));
    wTemp := 1;
    Write(wTemp, SizeOf(Word));
    Write(Bpp,SizeOf(Word));
    Write(NULL, SizeOf(Longword));
    Write(NULL, SizeOf(Longword));
    Write(Dat2,SizeOf(Longword));
    Write(Dat2, SizeOf(Longword));
    Write(NULL, SizeOf(Longword));
    Write(NULL, SizeOf(Longword));
 end;
end;
Es gibt zwar keine AV aber ich bekomme auch nichts zu sehen

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:31 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz