Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BMP Screen 12
#1
i want to use a file BMP with screen 12 (256 colors or +)!

help me, please!! Smile
Reply
#2
Hi,

download AK-Lib from http://www.iconsoft.de/download/ak15.zip and extract all the files into your qb folder. Then create a .bat file containing this:
Code:
QB.EXE /L AK14B
Start QB using that batch file, change into full screen mode using ALT+ENTER or configure the batch file like that. Then try this code
Code:
CALL XSCREEN(&H103)
CALL SET.PICTURE(100,100,"MYPICT.BMP")
SLEEP:END
MyPict.bmp must exists... :wink:

Sebastian
[Image: f.jpg]
Reply
#3
Quote:screen 12 (256 colors or +)

may i direct your attention here:
http://forum.qbasicnews.com/viewtopic.php?t=10492

oz
Reply
#4
well, you can load a 256 + color bmp, you jus have to find the closest colors to match to the 16 in scren 12

i think thats what he's going for, some routine to do that.. unfortunately, i have no clue how to do it, sorry
Reply
#5
Oh, I thought he'd like to show SVGA graphics using the VESA interface... I'll try to write such a palette program to display high color BMPs in Screen 12. Big Grin
[Image: f.jpg]
Reply
#6
Now I wrote a 24Bit -> QB standard palette conversion sub but it's quite slow and the result looks ugly...
[Image: rgbtopal.png]


Code:
'********************************************************************
'****                                                            ****
'****  Showing a true color image in screen 12                   ****
'****  (c) 2005 Sebastian Steiner, sebastian@ssteiner.com        ****
'****                                                            ****
'****  ATTENTION: No warranty, use on own risk!                  ****
'****                                                            ****
'********************************************************************


DECLARE FUNCTION RGBtoPAL% (xColor AS LONG)
DECLARE FUNCTION TwoFigures$ (Number AS STRING)
DECLARE SUB BSort (SortField() AS INTEGER, SecondField() AS INTEGER)

'#### QB Palette data
DIM SHARED Pal(15, 2) AS INTEGER
Pal(0, 0) = 0: Pal(0, 1) = 0: Pal(0, 2) = 0
Pal(1, 0) = 0: Pal(1, 1) = 0: Pal(1, 2) = 170
Pal(2, 0) = 0: Pal(2, 1) = 170: Pal(2, 2) = 0
Pal(3, 0) = 0: Pal(3, 1) = 170: Pal(3, 2) = 170
Pal(4, 0) = 170: Pal(4, 1) = 0: Pal(4, 2) = 0
Pal(5, 0) = 170: Pal(5, 1) = 0: Pal(5, 2) = 170
Pal(6, 0) = 170: Pal(6, 1) = 85: Pal(6, 2) = 0
Pal(7, 0) = 170: Pal(7, 1) = 170: Pal(7, 2) = 170
Pal(8, 0) = 85: Pal(8, 1) = 85: Pal(8, 2) = 85
Pal(9, 0) = 85: Pal(9, 1) = 85: Pal(9, 2) = 255
Pal(10, 0) = 85: Pal(10, 1) = 255: Pal(10, 2) = 85
Pal(11, 0) = 85: Pal(11, 1) = 255: Pal(11, 2) = 255
Pal(12, 0) = 255: Pal(12, 1) = 85: Pal(12, 2) = 85
Pal(13, 0) = 255: Pal(13, 1) = 85: Pal(13, 2) = 255
Pal(14, 0) = 255: Pal(14, 1) = 255: Pal(14, 2) = 85
Pal(15, 0) = 255: Pal(15, 1) = 255: Pal(15, 2) = 255

SCREEN 12

'Add your BMP loader here. Just write instead of
'"PSET (x,y), QuiteLongNumber&" "PSET(x,y),RGBtoPAL(QuiteLongNumber&)".

'RGBtoPAL converts a value like &HABCDEF into a palette index (0-15).
'This source doesn't change the palette of SCREEN 12.

SLEEP
END


SUB BSort (SortField() AS INTEGER, SecondField() AS INTEGER)
  DIM i AS LONG
  DIM Flag AS INTEGER
  DIM z AS INTEGER
  DIM y AS INTEGER
  DO
    Flag = 1
    FOR i = 0 TO UBOUND(SortField, 1) - 1
        IF SortField(i) > SortField(i + 1) THEN
          y = SecondField(i)
          z = SortField(i)
          SortField(i) = SortField(i + 1)
          SecondField(i) = SecondField(i + 1)
          SortField(i + 1) = z
          SecondField(i + 1) = y
          Flag = 0
        END IF
    NEXT i
  LOOP UNTIL Flag = 1
END SUB

FUNCTION RGBtoPAL% (xColor AS LONG)
    REDIM Deviation(15, 2) AS INTEGER
    REDIM Dev(15) AS INTEGER
    REDIM Index(15) AS INTEGER
    REDIM Colors(2) AS INTEGER
    Number$ = HEX$(xColor)
    FOR i% = 0 TO 15
        Index(i%) = i%
    NEXT i%
    Colors(0) = VAL("&H" + LEFT$(Number$, 2))
    Colors(1) = VAL("&H" + MID$(Number$, 4, 2))
    Colors(2) = VAL("&H" + RIGHT$(Number$, 2))
    FOR i% = 0 TO 15
        FOR x% = 0 TO 2
            Deviation(i%, x%) = Colors(x%) - Pal(i%, x%)
            IF Deviation(i%, x%) < 0 THEN
               Deviation(i%, x%) = Deviation(i%, x%) * (-1)
            End if
            Dev(i%) = Dev(i%) + Deviation(i%, x%)
        NEXT x%
    NEXT i%
    BSort Dev(), Index()
    RGBtoPAL = Index(0)
END FUNCTION

FUNCTION TwoFigures$ (Number AS STRING)
    IF LEN(Number) = 1 THEN
        TwoFigures$ = "0" + Number
    ELSE
        TwoFigures$ = Number
    END IF
END FUNCTION
[Image: f.jpg]
Reply
#7
and screen 13 640x480?
Reply
#8
Quote:and screen 13 640x480?
You can't without using a library (or creating your own functions, subroutines, etc. that do it).
974277320612072617420666C61696C21 (Hexadecimal for those who don't know)
Reply
#9
Screen 13 is always 320x200 in QBASIC/FBASIC.


There's no such thing as Screen 13 640x480..

What I suspect you mean is: 640x480x8bit
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)