Ich habe erwartet, daß die Messages von Windows aber asynchron dazu abgearbeitet werden. -> Ein Trugschluß
Was (fast) funktioniert ist das InvalidateRect_(), um die neu zu zeichenende Rasterline zu markieren und ein darauffolgendes UpdateWindow_(). Das sendet eine WM_PAINT Message direkt an das Fenster, also unter Umgehung der Message-Warteschlange.
Hier der betreffende Code, der die Daten kopiert und das Gadget aktualisiert:
Code: Alles auswählen
For i = 0 To ImageSettings_Destination\dsBitmap\bmHeight - 1
For j = 0 To ImageSettings_Destination\dsBitmap\bmWidth - 1
Pixel = PeekL(ImageSettings_Original\dsBitmap\bmBits + j * (ImageSettings_Original\dsBitmap\bmBitsPixel / 8) + ImageSettings_Original\dsBitmap\bmWidthBytes * i) & $00FFFFFF
; Do some Pixelmanipulations here
[...]
PokeB(ImageSettings_Destination\dsBitmap\bmBits + j * (ImageSettings_Destination\dsBitmap\bmBitsPixel / 8) + 0 + ImageSettings_Destination\dsBitmap\bmWidthBytes * i, (Pixel & $FF) ) ; blau
PokeB(ImageSettings_Destination\dsBitmap\bmBits + j * (ImageSettings_Destination\dsBitmap\bmBitsPixel / 8) + 1 + ImageSettings_Destination\dsBitmap\bmWidthBytes * i, (Pixel & $FF00) >> 8 ) ; grün
PokeB(ImageSettings_Destination\dsBitmap\bmBits + j * (ImageSettings_Destination\dsBitmap\bmBitsPixel / 8) + 2 + ImageSettings_Destination\dsBitmap\bmWidthBytes * i, (Pixel & $FF0000) >> 16) ; rot
Next j
If ProgramSettings\Preview And i % 1 = 0
IvRect\left = 0
IvRect\top = i
IvRect\right = ImageSettings_Destination\dsBitmap\bmWidth
IvRect\bottom = i+1
InvalidateRect_(GadgetID(#ImageGadget_Destination), @IvRect, #True)
UpdateWindow_(GadgetID(#ImageGadget_Destination))
EndIf
Next i
EDIT: Ich raff jetzt gar nichts mehr! Das RECT für InvalidateRect sieht jetzt so aus:
Code: Alles auswählen
rcInvalidate\left = 0
rcInvalidate\top = 0
rcInvalidate\right = ImageSettings_Destination\dsBitmap\bmWidth - 1
rcInvalidate\bottom = i+1
InvalidateRect_(GadgetID(#ImageGadget_Destination), @rcInvalidate, #True)
UpdateWindow_(GadgetID(#ImageGadget_Destination))
Aber: Das Bild wird jetzt von der Mitte(!) ausgehend gleichzeitig nach unten und oben gezeichnet. Das ist völlig unlogisch. Ich erwarte, das das Bild zeilenweise von oben nach unten gezeichnet wird. Evtl. noch von unten nach oben, je nach Speicherorganisation des Bitmaps.
Aber von der Mitte je immer eine Zeile nach unten und(!) nach oben gehend kann doch eigentlich nicht sein?
In etwa so baut sich das dann auf:
Code: Alles auswählen
+----------------+
| |
| |
| |
|----------------|
| |
| |
| |
+----------------+
+----------------+
| |
| |
|----------------|
|----------------|
|----------------|
| |
| |
+----------------+
+----------------+
| |
|----------------|
|----------------|
|----------------|
|----------------|
|----------------|
| |
+----------------+
+----------------+
|----------------|
|----------------|
|----------------|
|----------------|
|----------------|
|----------------|
|----------------|
+----------------+