PUT #1, , FileType$
PUT #1, , FileSize&
PUT #1, , QB64$
PUT #1, , OffsetBITS&
PUT #1, , InfoHEADER&
PUT #1, , PictureWidth&
PUT #1, , PictureDepth&
PUT #1, , NumPLANES%
PUT #1, , BPP%
PUT #1, , Compression&
PUT #1, , ImageSize&
PUT #1, , WidthPELS&
PUT #1, , DepthPELS&
PUT #1, , NumColors&
PUT #1, , SigColors& '51 offset
IF pixelbytes& = 1 THEN '4 or 8 BPP
u$ = CHR$(0)
FOR c& = 0 TO 255 'PUT as BGR order colors
cv& = _PALETTECOLOR(c&, image&)
Colr$ = CHR$(_BLUE32(cv&))
PUT #1, , Colr$
Colr$ = CHR$(_GREEN32(cv&))
PUT #1, , Colr$
Colr$ = CHR$(_RED32(cv&))
PUT #1, , Colr$
PUT #1, , u$ 'Unused byte
NEXT
END IF
FOR y% = y2% TO y1% STEP -1 'place bottom up
FOR x% = x1% TO x2%
c& = POINT(x%, y%)
IF pixelbytes& = 1 THEN
a$ = CHR$(c&)
Colors8%(ASC(a$)) = 1
ELSE : a$ = LEFT$(MKL$(c&), 3)
END IF
PUT #1, , a$
NEXT
PUT #1, , ZeroPAD$
NEXT
FOR n = 0 TO 255
IF Colors8%(n) = 1 THEN SigColors& = SigColors& + 1
NEXT n
PUT #1, 51, SigColors&
CLOSE #1
END SUB
This message has been edited by burger2227 on Aug 18, 2010 6:35 PM This message has been edited by burger2227 on Aug 18, 2010 6:33 PM This message has been edited by burger2227 on Aug 18, 2010 6:29 PM