Hallo, guten Tag.
Ich bekomme es nicht hin.
Ich lade ein BMP-Bild S/W 320x200
Dann lese ich dei Pixel aus und möchte im Byte_inhalt& dementsprechend ein Bit setzen. Es ist egal was ich mache , "Byte_inhalt&" ist immer 0. Ich habe dazwischen auch mal ein Print gesetzt, "Byte_inhalt" ist immer "0". Beim Printen wird mal $ffffff oder "0" angezeigt, so wie das Bild ist, aber die Bits werden überhaupt nicht gesetzt.
Wer weiß hier Rat?
Es ist ein Bild für den C64. 320x200 in S/W, welches in das Format vom C64 umgewandelt wird.
Das Format braucht man nicht zu kennen, weil der "Byte_inhalt&" immer "0" ist und das kann es nicht sein.
Danke.
Gruss
Code
$MAKE CLE
declare b_pic&,bmp_pic&,ende&,b_schreib&,b_bmp&,adr&,datei_s$,datei_l$,s_name&,schrift&
declare x&,y&,yy&,byte_inhalt&,byte_w&,col&
Declare ber#
Dim ber#,8010
Window 20,20-500,300
WindowTitle "Hiresbild-C64"
Cls RGB(220,220,220)
b_bmp& = Create("Button",%hwnd,"lade", 20, 20, 80, 24)
b_schreib& = Create("Button",%hwnd,"schreib", 20, 100, 80, 24)
s_name& = Create("Text", %hwnd, "", 20,70, 80, 20)
b_pic&=create("hNewPic", 320,200,rgb(255,255,255))
drawpic b_pic&,130,20;0
schrift&=Create("Font","ARIAL", 16,0, 0,0,0)
SetFont s_name&,schrift&
ende&=1
While ende&
WaitInput
If Clicked(b_bmp&)
datei_l$ = LoadFile$("Laden", "Dateien (*.*)|*.*")
StartPaint b_pic&
DrawPic datei_l$,0,0;-1
EndPaint
drawpic b_pic&,130,20;0
EndIf
If Clicked(b_schreib&)
schreibe
EndIf
EndWhile
End
Proc schreibe
Datei_s$ = SaveFile$("Speichern", "Dateien (*.*)|*.*")
WhileLoop 0,199,8
y&=&loop
WhileLoop 0,39
x&=&loop
WhileLoop 0,7
yy&=&loop
Byte_inhalt&=0
WhileLoop 0,7
Byte_w&=&loop
StartPaint b_pic&
col&=GetPixel(x&*8+7-byte_w&,y&+yy&)
EndPaint
If col&=0
SetBit(Byte_inhalt&,Byte_w&,1)
EndIf
EndWhile
Byte Ber#,adr&=Byte_inhalt&
adr&=adr&+1
EndWhile
EndWhile
EndWhile
BlockWrite Datei_s$,Ber#,0,8000
SetText s_name&,"fertig"
EndProc
Alles anzeigen