Delphi-PRAXiS
Seite 2 von 6     12 34     Letzte » 

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Bitmap32 auf ZielBitmap32 malen (https://www.delphipraxis.net/117988-bitmap32-auf-zielbitmap32-malen.html)

stOrM 30. Jul 2008 11:19

Re: Bitmap32 auf ZielBitmap32 malen
 
Zitat:

Zitat von DeddyH
Ich weiß jetzt nicht, wie das bei TBitmap32 aussieht, aber es sollte doch im Prinzip so gehen:
- Setze Breite der Zielbitmap auf Gesamtbreite der 3 Quellbitmaps und Höhe auf die der höchsten Quellbitmap
- Zeichne an Position 0,0 die linke Quellbitmap
- Zeichne an Position linke Quellbitmap.Breite, 0 die mittlere
- Zeichne an Position Gesamtbreite(linke und mittlere) die rechte
- Speichere die Zielbitmap

Ja das dachte ich auch, dass was mich durcheinander bringt hier mit Bitmap32 ist,

// Thebar??? also Zielbitmap? und SourceBitmap ist was in welchem Fall? ich hab ja 3!
TheBar.Draw(0,0, SourceBitmap)

DeddyH 30. Jul 2008 11:24

Re: Bitmap32 auf ZielBitmap32 malen
 
Wenn das Ergebnis anschließend in TheBar sein soll, musst Du auch auf TheBar zeichnen.

stOrM 30. Jul 2008 11:50

Re: Bitmap32 auf ZielBitmap32 malen
 
Zitat:

Zitat von DeddyH
Wenn das Ergebnis anschließend in TheBar sein soll, musst Du auch auf TheBar zeichnen.

Ja das dachte ich auch also hab ichs so gemacht:

Delphi-Quellcode:
  TheBar.Draw(0, 0, OutLeft);
  TheBar.Draw(outleft.Width + Outmiddle.Width, 0, OutRight);
  TheBar.Draw(0, 0, OutMiddle);
Geht nich :-(

DeddyH 30. Jul 2008 12:02

Re: Bitmap32 auf ZielBitmap32 malen
 
Was heißt geht nich? Kommt nix oder an der falschen Stelle? Wird bei TBitmap32 Draw direkt aufgerufen oder über Canvas? Anbei mal ein Beispiel mit "normalen" Bitmaps (achte mal auf die Koordinaten beim Zeichnen auf Ziel):
Delphi-Quellcode:
procedure TForm1.FormPaint(Sender: TObject);
var qb1, qb2, qb3, ziel: TBitmap;
begin
  //Erzeugen und Zeichnen der 3 Quellbitmaps
  qb1 := TBitmap.Create;
  try
    qb1.Width := 20;
    qb1.Height := 40;
    qb1.Canvas.Brush.Color := clRed;
    qb1.Canvas.FillRect(Rect(0,0,20,40));

    qb2 := TBitmap.Create;
    try
      qb2.Width := 20;
      qb2.Height := 40;
      qb2.Canvas.Brush.Color := clYellow;
      qb2.Canvas.FillRect(Rect(0,0,20,40));

      qb3 := TBitmap.Create;
      try
        qb3.Width := 20;
        qb3.Height := 40;
        qb3.Canvas.Brush.Color := clBlue;
        qb3.Canvas.FillRect(Rect(0,0,20,40));

        //Erzeugen und Zeichnen der Zielbitmap
        ziel := TBitmap.Create;
        try
          ziel.Width := 60;
          ziel.Height := 40;
          //linke Quellbitmap
          ziel.Canvas.Draw(0,0,qb1);
          //mittlere Quellbitmap
          ziel.Canvas.Draw(qb1.Width,0,qb2);
          //rechte Quellbitmap
          ziel.Canvas.Draw((qb1.Width + qb2.Width),0,qb3);
          self.Canvas.Draw(10,10,ziel);
        finally
          ziel.Free;
        end;
      finally
        qb3.Free;
      end;
    finally
      qb2.Free;
    end;
  finally
    qb1.Free;
  end;
end;

stOrM 30. Jul 2008 12:16

Re: Bitmap32 auf ZielBitmap32 malen
 
Zitat:

Zitat von DeddyH
Was heißt geht nich? Kommt nix oder an der falschen Stelle? Wird bei TBitmap32 Draw direkt aufgerufen oder über Canvas? Anbei mal ein Beispiel mit "normalen" Bitmaps (achte mal auf die Koordinaten beim Zeichnen auf Ziel):
Delphi-Quellcode:
procedure TForm1.FormPaint(Sender: TObject);
var qb1, qb2, qb3, ziel: TBitmap;
begin
  //Erzeugen und Zeichnen der 3 Quellbitmaps
  qb1 := TBitmap.Create;
  try
    qb1.Width := 20;
    qb1.Height := 40;
    qb1.Canvas.Brush.Color := clRed;
    qb1.Canvas.FillRect(Rect(0,0,20,40));

    qb2 := TBitmap.Create;
    try
      qb2.Width := 20;
      qb2.Height := 40;
      qb2.Canvas.Brush.Color := clYellow;
      qb2.Canvas.FillRect(Rect(0,0,20,40));

      qb3 := TBitmap.Create;
      try
        qb3.Width := 20;
        qb3.Height := 40;
        qb3.Canvas.Brush.Color := clBlue;
        qb3.Canvas.FillRect(Rect(0,0,20,40));

        //Erzeugen und Zeichnen der Zielbitmap
        ziel := TBitmap.Create;
        try
          ziel.Width := 60;
          ziel.Height := 40;
          //linke Quellbitmap
          ziel.Canvas.Draw(0,0,qb1);
          //mittlere Quellbitmap
          ziel.Canvas.Draw(qb1.Width,0,qb2);
          //rechte Quellbitmap
          ziel.Canvas.Draw((qb1.Width + qb2.Width),0,qb3);
          self.Canvas.Draw(10,10,ziel);
        finally
          ziel.Free;
        end;
      finally
        qb3.Free;
      end;
    finally
      qb2.Free;
    end;
  finally
    qb1.Free;
  end;
end;

Wird nur der mittlere Teil angezeigt wie gehabt. Wenn ich am Code rumschraub bezüglich der Koordinaten Left sagen wir +2 dann kommt links nen schwarzer Rand ohne Bitmap, rechts kommt nie was an... :-(

taaktaak 30. Jul 2008 12:28

Re: Bitmap32 auf ZielBitmap32 malen
 
Moin, Moin.
Ist vielleicht BitBlt() eine Alternative? Damit können doch die 3 einzelnen Bitmaps ruck-zuck in das Zielbitmap kopiert werden...

DeddyH 30. Jul 2008 12:31

Re: Bitmap32 auf ZielBitmap32 malen
 
Delphi-Quellcode:
TheBar.Width := OutLeft.Width + OutMiddle.Width + OutRight.Width;
TheBar.Draw(0, 0, OutLeft);
TheBar.Draw(OutLeft.Width, 0, OutMiddle);
TheBar.Draw(outleft.Width + Outmiddle.Width, 0, OutRight);
Und so?

stOrM 30. Jul 2008 13:05

Re: Bitmap32 auf ZielBitmap32 malen
 
Zitat:

Zitat von DeddyH
Delphi-Quellcode:
TheBar.Width := OutLeft.Width + OutMiddle.Width + OutRight.Width;
TheBar.Draw(0, 0, OutLeft);
TheBar.Draw(OutLeft.Width, 0, OutMiddle);
TheBar.Draw(outleft.Width + Outmiddle.Width, 0, OutRight);
Und so?

Ne du jetzt kommt nur der rechte und der mittlere Teil der linke iss nich da :-(
Ich würd dir ja gerne das gesamte Project senden zum testen nur du hast kein Graphics32???

DeddyH 30. Jul 2008 13:09

Re: Bitmap32 auf ZielBitmap32 malen
 
Zitat:

Zitat von stOrM
Ich würd dir ja gerne das gesamte Project senden zum testen nur du hast kein Graphics32???

Nee, leider nicht. Was passiert, wenn Du die 3 Bitmaps in eine TBitmap zeichnest und diese dann nach TBitmap32 konvertierst?

stOrM 30. Jul 2008 13:17

Re: Bitmap32 auf ZielBitmap32 malen
 
Zitat:

Zitat von DeddyH
Zitat:

Zitat von stOrM
Ich würd dir ja gerne das gesamte Project senden zum testen nur du hast kein Graphics32???

Nee, leider nicht. Was passiert, wenn Du die 3 Bitmaps in eine TBitmap zeichnest und diese dann nach TBitmap32 konvertierst?

Öhzm das geht in sofern nicht, weil ich dann meine transparenz verlieren würde, sonst hätte ich direkt einfach Bitmaps anstelle von PNG's bzw Bitmap32 genommen...

Kannste dir die Graphics32 nicht bei SourceForge holen? ich mein Einbindung dauert ja grad mal 10 - 15 Sekunden, sind ja nur units:-)


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:21 Uhr.
Seite 2 von 6     12 34     Letzte » 

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz