AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Wie funktioniert das genau mit den backbuffer?
Thema durchsuchen
Ansicht
Themen-Optionen

Wie funktioniert das genau mit den backbuffer?

Ein Thema von mimi · begonnen am 15. Aug 2004 · letzter Beitrag vom 15. Aug 2004
 
mimi

Registriert seit: 1. Dez 2002
Ort: Oldenburg(Oldenburg)
2.008 Beiträge
 
FreePascal / Lazarus
 
#1

Wie funktioniert das genau mit den backbuffer?

  Alt 15. Aug 2004, 10:36
Hallo,
Wie funktioniert das:
ich zeichne auf meiner PaintBox ein objekt und möchtes es danach verschieben, vergrößeren,eigenschaften ändern und soweiter und sofort....
gut ich habe es auch geschaft in dem ich einfach das alte objekt übermale mit pmNotXor und ein neues erstelle und fertig, problem die farben werde nicht so übernommen wie ich es angeben habe !!!

so nun wollte ich fragen, was die beste möglichkeit ist ein objekt zu löschen, bei meiner forensuche(delphifourm, delphipraxis) ist mir aufgefallen, das öfters gesagt wurde pmNotXor ist out, warum ?
was gibst für weiter möglichkeiten ???

mein ziel ist es: ein paint zu schreiben, wo ich objekte habe die ich nach dem erstellen, verschieben, löschen, bearbeiten kann........


PS:
mein qullcode bist jetzt:
Delphi-Quellcode:
function TForm1.findObj(x,y:Integer):Integer;
var
  i,z:Integer;
begin
  z:=-1;
  for i:=0 to High(Obj) do begin
    if (x >= obj[i].x ) and (y >= obj[i].y ) and
       (x <= obj[i].x + obj[i].h ) and (y <= obj[i].y + obj[i].w) then begin

      z:=i;
      Break;
    end
  end;

  result:=z;
end;

procedure TForm1.AddObj(x,y,x1,y1,typ:Integer);
begin
  SetLength(Obj,High(obj)+2 );
  Obj[High(Obj)].x:=x;
  Obj[High(Obj)].y:=y;
  Obj[High(Obj)].h:=x1-x;
  Obj[High(Obj)].w:=y1-y;

  Obj[High(Obj)].typ:=typ;
  Obj[High(Obj)].PenStyle:=PaintBox1.Canvas.Pen.Style;
  Obj[High(Obj)].BrushStyle:=PaintBox1.Canvas.Brush.Style;

  Obj[High(Obj)].FColor:=PaintBox1.Canvas.Pen.color;
  Obj[High(Obj)].Bcolor:=PaintBox1.Canvas.Brush.color;

  ListBox1.Items.Add('Obj' + IntToStr(Typ));
  
end;

procedure TForm1.DrawObjt(typ,x1,y1,x2,y2:Integer; AMod:TPenMode);
begin
  PaintBox1.Canvas.Pen.Mode:=AMod;
  with PaintBox1.Canvas do begin
    if typ = 0 then PaintBox1.canvas.Rectangle(x1,y1,x2,y2);
    if typ = 1 then PaintBox1.canvas.Ellipse(x1,y1,x2,y2);
    if typ = 2 then PaintBox1.canvas.RoundRect(x1,y1,x2,y2,(x1 - x2) div 2,(y1 - y2) div 2);
    if typ = 3 then begin
      PaintBox1.canvas.MoveTo(x1,y1);
      PaintBox1.canvas.LineTo(x2,y2);
    end;
  end;
end;

procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin

  if Shift = [ssLeft] then MT:=True;
  objIndex:=FindObj(x,y);

  if objIndex > -1 then begin
    PaintBox1.Canvas.Pen.Color:=Obj[objIndex].FColor;
    PaintBox1.Canvas.Pen.Style:=Obj[objIndex].PenStyle;
    
    PaintBox1.Canvas.Brush.Color:=Obj[objIndex].BColor;
    PaintBox1.Canvas.Brush.Style:=Obj[objIndex].BrushStyle;

    Edit1.Color:=PaintBox1.Canvas.Brush.Color;
    Edit1.Font.Color:=PaintBox1.Canvas.Pen.Color;
  end;

  MX:=x;MY:=y;
  ox:=mx; oy:=my;
end;

procedure TForm1.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  StatusBar1.Panels[1].Text:=IntToStr(x) + '\' + intToStr(y);

  if MT = True then begin
    if PenS > -1 then begin
      StatusBar1.Panels[0].Text:=IntToStr(ObjIndex);
      if objIndex = -1 then begin
        DrawObjt(PenS,MX,MY,ox,oy,pmCopy);
        ox:=x; oy:=y;
        DrawObjt(PenS,MX,MY,ox,oy,pmCopy);

      end
      else begin
        MoveObj:=True;
        DrawObjt(PenS,obj[ObjIndex].x,obj[ObjIndex].y,obj[ObjIndex].x+obj[ObjIndex].h,obj[ObjIndex].y+obj[ObjIndex].w,pmNotXor);
        Obj[objIndex].x:=x;
        Obj[objIndex].y:=y;
        DrawObjt(PenS,x,y,Obj[objIndex].x+obj[ObjIndex].h,Obj[objIndex].y+obj[ObjIndex].w,pmNotXor);

      end;

    end;
  end;
 
end;
der ganze qullcode ist bis jetzt 262 zeilen lang....
Michael Springwald
MFG
Michael Springwald,
Bitte nur Deutsche Links angeben Danke (benutzte überwiegend Lazarus)
  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 14:58 Uhr.
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