howard@maccs.dcss.mcmaster.ca (Howard Betel) (03/09/90)
Here's the problem. I'm initializing my VGA to 256 (320x200) colors using Borland's bgi. I'm displaying a GIF by shelling out and executing a GIF viewing program. I modified the program slightly so that on completion it doesn't clear the screen. When the program terminates, TP uses a getimage to grab the screen. I then write the memory block out to disk using blockwrite. So far so good. Here's the problem (really this time). When I load the picture back in again using blockread and then display it on the screen using putimage, my palette is obviously not the same as it was after termination of the GIF viewing program (it must set the palette). So how can I save a 256 color palette along with the picture so that I can load it in again at a later time. Excuse the run on sentences but its been a looong day. Thanks for any help that you can give, -- Howard Betel Howard@maccs.dcss.McMaster.CA Dept of Computer Science ...!unet!utai!utgpu!maccs!howard McMaster University
teittinen@cc.helsinki.fi (03/10/90)
In article <25F744E5.8753@maccs.dcss.mcmaster.ca>, howard@maccs.dcss.mcmaster.ca (Howard Betel) writes: > Here's the problem. [Howard's problem was saving the palette information to disk with 320*200*256 VGA-mode picture] I hope you know how to use TP's intr-procedure, this answer requires it. To store the whole palette information (256 colors) you need following definitions in your program: Type ColorType = record R, G, B: Byte; end; Var Palette: array [0..255] of ColorType; Then you get the data in the array by using video interrupt (10 hex): INT $10 (video interrupt) AH = $10, AL = $17 (read block of color registers) BX = 0 (index of the first color to get) CX = 256 (number of colors to get) ES = Seg(Palette)\ DX = Ofs(Palette)-> (ES:DX points to Palette-array) Set these values to registers and then call interrupt $10, and you get the palette information to your array. Then you can save the palette information in the same file with the image before the image, after it or you can use a different file. When you want to display the picture, set palette using the following register values with interrupt $10: INT $10 (video) AH = $10, AL = $12 (set block of color registers) BX = 0 (index of the first color to set) CX = 256 (number of colors to set) ES = Seg(Palette)\ DX = Ofs(Palette)-> (ES:DX points to Palette-array) -- E-Mail: teittinen@finuh.bitnet ! "Studying is the only way teittinen@cc.helsinki.fi ! to do nothing without Marko Teittinen, student of computer science ! anyone blaming you" -me
mpe@shamash.cdc.com (2375) (03/13/90)
The problem of capturing images using turbo pascal is that there is no way to read the palette registers back from the display controller card. Within the run-time environment, an array of previous values is used by the BGI graphics manager to shadow the palette contents. Long before you invoke your getimage program, a TSR that captures the int 10 interupt commands which update the CRT control, must monitor all int 10's for potential palette updates. Also, each shell opened by the user, loads it's own version of the command.com and *.bgi file base and therefore creates a yet another set of palette array registers. Good luck.
zech@leadsv.UUCP (Bill Zech) (03/14/90)
In article <18812@shamash.cdc.com>, mpe@shamash.cdc.com (2375) writes: > The problem of capturing images using turbo pascal is that there is no way > to read the palette registers back from the display controller card. Within > the run-time environment, an array of previous values is used by the BGI > graphics manager to shadow the palette contents. Long before you invoke your > getimage program, a TSR that captures the int 10 interupt commands which update > the CRT control, must monitor all int 10's for potential palette updates. > Also, each shell opened by the user, loads it's own version of the command.com > and *.bgi file base and therefore creates a yet another set of palette array > registers. Good luck. This is not true for a VGA card. All the registers (save one minor one, I believe) are both readable and writable. The EGA and CGA boards were write-only, but the VGA fixes that problem. Also, I believe there is a procedure in the graphics.tpu to read the pallete registers. - Bill
woody@eos.UUCP (Wayne Wood) (03/15/90)
In article <10334@leadsv.UUCP> zech@leadsv.UUCP (Bill Zech) writes: >Also, I believe there is a procedure in the graphics.tpu to read >the pallete registers. Uses graph; Var OldPalette : PaletteType; GetPalette(OldPalette); /*** woody **************************************************************** *** ...tongue tied and twisted, just an earth bound misfit, I... *** *** -- David Gilmour, Pink Floyd *** ****** woody@eos.arc.nasa.gov *** my opinions, like my mind, are my own ******/