LINE (10, 10)-(230, 170), 0, BF
LINE (60, 60)-(10, 45), 1, B
'nepada pri pokusu ulozit 1 bit screen pro X nedelitelne 32, ale je tam v ose X dole carka a nevim jak se ji zbavit.
Save_BMP imb, "test1clr.bmp", 3
Save_BMP imb, "test16clr.bmp", 2
Save_BMP imb, "test256clr.bmp", 1
'Save_BMP options:
'0 = 32 bit image
'1 = 8 bit image
'2 = 4 bit image
'3 = 1 bit image
SUB Save_BMP
(src
AS LONG, file
AS STRING, typ
AS _UNSIGNED _BYTE) 'typ: 0 = 32 bit, 1 = 256 colors, 2 = 16 colors, 3 = 2 colors PRO KONVERZI NEJPRVE DITHERINGEM UDELEJ 256 clr zdroj a ten uloz. NELZE ulozit primo 32 bit do 8 bit! 'moje save formule
Data_Start
AS LONG ' startovni oblast dat obrazu. U 32 bitu to je hned po hlave, u ostatnich az po 54 + oblast palety - protoze tahle hlava ma 14, nasleduje druha hlava, ktera ma 40 bytu END TYPE ' image data start area. in 32 bit image it is after head, in others it is after byte 54 + palette area. Because this head is 14 bytes long, is next in file next header, 40 bytes long.
Hlava_velikost
AS LONG '40 a Head size Total_Colors
AS LONG 'muze byt 0 (0, 256, 16, 2)
I.BPP = 32: I.Total_Colors = 0: Depth = 4: K = 4 ' 32 bit
I.BPP = 8: I.Total_Colors = 0: Depth = 1: K = 1 ' 256 clrs
I.BPP = 4: I.Total_Colors = 0: Depth = 1: K = .5 ' 16 clrs
I.BPP = 1: I.Total_Colors = 0: Depth = 1: K = 1 / 8 ' 2 clrs
index = 1
DELTA = sire
o = 0
'OSA X MUSI BYT DELITELNA 32, JINAK DOJDE K CHYBAM. X axis MUST be dividible by 32!
INPUT "Compatibility warning: You try save 1 bit image, which width is not dividible by 32. This can do problems in some viewers. Autoconvert? (Y/N) "; conv$
sire = sire + 1
' PRINT sire: SLEEP 'ok
DELTA = DELTA - sire
H.ID = "BM": H.Reserved0 = 0: H.Reserved1 = 0: I.Hlava_velikost = 40: I.planes = 1: I.Compress = 0: I.Image_Size = 0: I.Xpels = 0: I.Ypels = 0: I.Important_Colors = 0
N
= _MEMNEW(I.
width * I.height
* Depth
) 'oblast pameti, kde se bude otacet Y Memory area for Y rotating. index = 0
_MEMPUT N
, N.OFFSET
+ in
(x
, y
, src&
), v
o = o + 4
_MEMPUT N
, N.OFFSET
+ in
(x
, y
, src&
), v2
o = o + 1
_MEMGET M
, M.OFFSET
+ in
(x
, y
, src&
), v2
IM3(index) = 16 * left + right: index = index + 1: left = 0: right = 0
o = o + 1
' IF y >= _HEIGHT(src) - 2 THEN GOTO n
_MEMGET M
, M.OFFSET
+ in
(x
, y
, src&
), v2
IM4(index) = ((P8 * 128) + (P7 * 64) + (P6 * 32) + (P5 * 16) + (P4 * 8) + (P3 * 4) + (P2 * 2) + P1)
P1 = 0: P2 = 0: P3 = 0: P4 = 0: P5 = 0: P6 = 0: P7 = 0: P8 = 0
o = -1
index = index + 1
o = o + 1
O2 = O2 + 1
n:
' _MEMFREE M
' _MEMFREE M
' _MEMFREE M