68 lines
1.3 KiB
Plaintext
68 lines
1.3 KiB
Plaintext
#11 = 400 // Width of the image
|
|
#12 = 300 // Height of the image
|
|
|
|
// Create an empty RGB image and fill it with black color
|
|
//
|
|
File_Open("|(VEDIT_TEMP)\pixel.data", OVERWRITE+NOEVENT)
|
|
BOF
|
|
Del_Char(ALL)
|
|
#10 = Buf_Num
|
|
Repeat(#11 * #12) {
|
|
Ins_Char(0, COUNT, 3)
|
|
}
|
|
|
|
// Fill the image with dark blue color
|
|
//
|
|
#5 = 0 // Red
|
|
#6 = 0 // Green
|
|
#7 = 64 // Blue
|
|
Call("FILL_IMAGE")
|
|
|
|
// Draw one pixel in orange color
|
|
//
|
|
#1 = 100 // x
|
|
#2 = 50 // y
|
|
#5 = 255 #6 = 128 #7 = 0 // Orange color
|
|
Call("DRAW_PIXEL")
|
|
|
|
// Get the color of a pixel
|
|
//
|
|
#1 = 10
|
|
#2 = 3
|
|
Call("GET_COLOR")
|
|
|
|
Buf_Switch(#10) Buf_Quit(OK)
|
|
Return
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Fill image with given color: #5 = Red, #6 = Green, #7 = Blue
|
|
//
|
|
:FILL_IMAGE:
|
|
BOF
|
|
Repeat (File_Size/3) {
|
|
IC(#5,OVERWRITE) IC(#6,OVERWRITE) IC(#7,OVERWRITE)
|
|
}
|
|
Return
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Daw a pixel. #1 = x, #2 = y
|
|
//
|
|
:DRAW_PIXEL:
|
|
Goto_Pos((#1 + #2*#11)*3)
|
|
IC(#5,OVERWRITE) IC(#6,OVERWRITE) IC(#7,OVERWRITE)
|
|
Return
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Get color of a pixel. #1 = x, #2 = y
|
|
// Return: #5 = Red, #6 = Green, #7 = Blue
|
|
//
|
|
:GET_COLOR:
|
|
Goto_Pos((#1 + #2*#11)*3)
|
|
#5 = Cur_Char
|
|
#6 = Cur_Char(1)
|
|
#7 = Cur_Char(2)
|
|
Return
|