Autor Beitrag
Blackbird
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54



BeitragVerfasst: Fr 30.07.04 17:32 
Hallo liebe Delphianer...

Ich bin gerade dabei, ein Programm zur Bildbearbeitung (ums mal ganz kurz zu fassen) zu erstellen und bin dabei auf folgendes Problem gestoßen:

Ich stelle das Pixel Format ein, dann wird Scanline verwendet...Das funktioniert aber nur solange, wie danach nicht irgnedwelche Systemmessages aufgerufen werden. Deshalb habe ich einmal einfach Applicaton.ProcessMessages dazwischen gesetzt und es funktionierte auch net.

Der folgende Code funktioniert:
ausblenden Quelltext
1:
2:
Image1.Picture.Bitmap.Pixelformat := pf32bit;
P := scanline[0];


Dieser Code geht net:
ausblenden Quelltext
1:
2:
3:
Image1.Picture.Bitmap.Pixelformat := pf32bit;
Application.ProcessMessages;
P := scanline[0];


Habe ich das mit dem Pixelformat irgendwie falsch verstanden oder liegt hier irgend ein andere Fehler vor ??? :?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 30.07.04 17:34 
Hmm...anhand dieser Codeschnipsel kann ich keinen Fehler feststellen. Was genau funktioniert denn nicht? Kommen unsinnige Werte raus, kommt ne Fehlermeldung, oder wird erst gar nicht kompiliert?

_________________
We are, we were and will not be.
Blackbird Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54



BeitragVerfasst: Fr 30.07.04 17:56 
Hallo Gausi...

Ich habe mal den ganzen Code drumherum weggenommen. Erstelle mal ein neues Project - knall' ein Image und ein Button drauf und dann paste mal den Code hier rein:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
procedure TForm1.Button1Click(Sender: TObject);
var x,y: integer;
P: PByte;
begin
for y := 0 to Image1.Height-1 do
  for x := 0 to Image1.Width -1 do
    Image1.Canvas.Pixels[x,y] := clwhite;


with Image1.Picture.Bitmap do
  begin
    Pixelformat := pf32bit;
    //hier danach mal "Application.ProcessMessages reinsetzen...
    P := scanline[0];

      for x:=1 to width do
        begin
          p^:=0; inc(p);
          p^:=0; inc(p,3);
        end;
  end;

Die oberste Zeile sollte jetzt rot werden...
Und dann setz' mal den anderen Code ein...
Phantom1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 390



BeitragVerfasst: Fr 30.07.04 20:55 
Also bei mir funktioniert dein Code ohne Probleme auch mit dem Application.ProcessMessages.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 31.07.04 08:43 
bei mir nicht, d.h. die erste Zeile wird nicht rot. Aber mit einem
image1.Refresh; am Ende der Prozedur kommt wieder das gewünscht Ergebnis.

_________________
We are, we were and will not be.
Blackbird Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54



BeitragVerfasst: Do 05.08.04 17:51 
Stimmt - bei mir hats jetzt auch geklappt.

Vielen Dank...