Home | Reviews | GUIpedia | Forum | Fun500
| trolly | Semi-Transparent Boxes in Screen 12hey, there is a function to draw a box in a semi transparent color: [code] SUB xFill(x1 as INTEGER,y1 as INTEGER,x2 as INTEGER,y2 as INTEGER,c as INTEGER DIM x as INTEGER DIM y as INTEGER FOR x = x1 TO x2 FOR Y = y1 to y2 if (x MOD 2)(y MOD 2) then PSET(x,y),c NEXT y NEXT x END SUB [/code] [img size=647]http://theguiblog.com/images/fbfiles/images/xfill.jpg[/img] | 2008-09-27 | 9:07 PM |
| Brandon | Re:Semi-Transparent Boxes in Screen 12Know just make a dithering routine and we can have fun with screen 12. | 2008-09-27 | 9:21 PM |
| Todd | Re:Semi-Transparent Boxes in Screen 12Looks like a neat function. Does it run quickly, trolly? The only problem with PSETing half the pixels is that when you have a window about 640x480 and it's trying to repaint it, it will take a while unless it's machine code that's being fed to QB. | 2008-09-27 | 9:41 PM |
| trolly | Re:Semi-Transparent Boxes in Screen 12it's slower than the dither function from ensireMe now, i've update my code thanks it: [code] SUB xFill(x1 as INTEGER,y1 as INTEGER,x2 as integer,y2 as INTEGER,c as INTEGER) DIM x as INTEGER DIM y as INTEGER FOR x=x1 TO x2 -1 STEP 2 FOR y = y1 TO y2 -1 STEP 2 PSET(x,y),c PSET(x+1,y+1),c NEXT y NEXT x END SUB [/code] the FOR ... NEXT rund quicker thank "STEP 2" the image show you a benchmark that compares the two algorythm: [img size=648]http://theguiblog.com/images/fbfiles/images/benchmark.JPG[/img] | 2008-09-27 | 11:07 PM |
| trolly | Re:Semi-Transparent Boxes in Screen 12hey guys, i've finaly readed the help from quickbasic for the "LINE" instruction. it say that i can define a 16 bit bitmask to says witch pixels should be drawed. so i've write the fastest code possible to make a dithered box: [code] REM 'For normal qbasic screen modes' SUB xFill (x1 AS INTEGER, y1 AS INTEGER, x2 AS INTEGER, y2 AS INTEGER,c AS INTEGER) FOR y = y1 TO y2 - 1 STEP 2 LINE (x1, y)-(x2 -1 , y),c, , &HAAAA LINE (x1+1, y+1)-(x2 , y+1),c, , &HAAAA NEXT Y END SUB REM 'For future lib' SUB future.fillTbox (x,y,w,h,r1,g1,b1) y1 as integer FOR y1 = y TO h - 1 STEP 2 future.line x,y1,w-1,y1,rgb2color(r1,g1,b1),&hAAAAAA future.line x+1,y1+1,w,y1+1,rgb2color(r1,g1,b1),&hAAAAAA NEXT Y1 END SUB [/code] the bitmask is &hAAAA , the value in binary mode is: 1010101010101010, so, only 1 byte by 2 is drawed | 2008-09-28 | 8:43 PM |
| Re:Semi-Transparent Boxes in Screen 12If you are looking for speed and its in screen 12 you could use POKE to do this. poke 80&*y+x8, bitmask% (bitmask is an 8bit integer controling 8 pixels on screen). The only problem is that the coordinates will always align to what can be diveded by 8 ( x=x8 ). If you are interested on how to do this, I could post you some of the hardware code. | 2008-09-28 | 10:00 PM |
2021 Brandon Cornell