Pen 1 = gelb rgb(255,255,0)
Pen 2 = chain rgb(0,255,255)
Pen 3 = rot rgb(255,0,0)
So sehen wie oben die Farben aus wenn der CPC gestartet wird im Mode 1.
So werden sie jetzt auch unten im Programm abgefragt.
Die Farbstifte im Bmp-Bild(320x200) müssen die Penfarben vom CPC haben.
Das Programm kann jederzeit vom Benutzer beändert werden.
Code
INIT
Do : Sleep : Until Me Is Nothing
Sub INIT
Global Int Block, x, y, z, ByteInhalt, Byte_w, col, blue, green, red
Form F0 = , , , 800, 600 : AutoRedraw = 1 : BackColor = colBtnFace
Ocx Form F1 = , 10 , 10 , 320, 200 : .Appearance = 0 : .AutoRedraw = 1
F1.PaintPicture LoadPicture("cpc320.bmp"), 0, 0
Sub Screen_KeyPreview(hwnd%, umsg%, wparam%, lparam%, cancel?)
$StepOff
Select wparam%
Case "q"
wandle_um
EndSelect
DoEvents
Sub wandle_um
Set Me = F1
Open "TEST.DAT" for Output As # 1
For z = 0 To 127 : Out # 1, 0 : Next
For Block = 0 To 7
For y = 0 To 24
For x = 0 To 319 Step 4
ByteInhalt = 0
For Byte_w = 0 To 3
col = RGBPoint(x + Byte_w, y * 8 + Block)
blue = GetBValue(col)
green = GetGValue(col)
red = GetRValue(col)
If red = 255 And green = 255 And blue = 0 And Byte_w = 0
ByteInhalt = Bset(ByteInhalt, 7)
ByteInhalt = Bclr(ByteInhalt, 3)
EndIf
If green = 255 And blue = 255 And red = 0 And Byte_w = 0
ByteInhalt = Bclr(ByteInhalt, 7)
ByteInhalt = Bset(ByteInhalt, 3)
EndIf
If red = 255 And green = 0 And blue = 0 And Byte_w = 0
ByteInhalt = Bset(ByteInhalt, 7)
ByteInhalt = Bset(ByteInhalt, 3)
EndIf
If red = 255 And green = 255 And blue = 0 And Byte_w = 1
ByteInhalt = Bset(ByteInhalt, 6)
ByteInhalt = Bclr(ByteInhalt, 2)
EndIf
If green = 255 And blue = 255 And red = 0 And Byte_w = 1
ByteInhalt = Bclr(ByteInhalt, 6)
ByteInhalt = Bset(ByteInhalt, 2)
EndIf
If red = 255 And green = 0 And blue = 0 And Byte_w = 1
ByteInhalt = Bset(ByteInhalt, 6)
ByteInhalt = Bset(ByteInhalt, 2)
EndIf
If red = 255 And green = 255 And blue = 0 And Byte_w = 2
ByteInhalt = Bset(ByteInhalt, 5)
ByteInhalt = Bclr(ByteInhalt, 1)
EndIf
If green = 255 And blue = 255 And red = 0 And Byte_w = 2
ByteInhalt = Bclr(ByteInhalt, 5)
ByteInhalt = Bset(ByteInhalt, 1)
EndIf
If red = 255 And green = 0 And blue = 0 And Byte_w = 2
ByteInhalt = Bset(ByteInhalt, 5)
ByteInhalt = Bset(ByteInhalt, 1)
EndIf
If red = 255 And green = 255 And blue = 0 And Byte_w = 3
ByteInhalt = Bset(ByteInhalt, 4)
ByteInhalt = Bclr(ByteInhalt, 0)
EndIf
If green = 255 And blue = 255 And red = 0 And (Byte_w = 3)
ByteInhalt = Bclr(ByteInhalt, 4)
ByteInhalt = Bset(ByteInhalt, 0)
EndIf
If red = 255 And green = 0 And blue = 0 And Byte_w = 3
ByteInhalt = Bset(ByteInhalt, 4)
ByteInhalt = Bset(ByteInhalt, 0)
EndIf
Next
Out # 1, ByteInhalt
Next
Next
For z = 0 To 47 : Out # 1, 0 : Next
Next
Set Me = F0
Pset 10, 300
Print "fertig"
Alles anzeigen