Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Bitmaps!!!!!!!!!!!

cof123cof123 Posts: 8Member
I have started programming a few years ago and i would like to know how to decode a bitmap image and then display it on the screen. all i have managed to do is convert the bitmap into numbers having the first two chratcers being BM and the next character representing the size of the image in bytes. I have tried to search on the internet but all i found was codes in C which i do not understand. Please can anyone send me an e-mail with some sample codes on : cof123@gmail.com
«1

Comments

  • netgertnetgert Posts: 331Member
    : I have started programming a few years ago and i would like to know how to decode a bitmap image and then display it on the screen. all i have managed to do is convert the bitmap into numbers having the first two chratcers being BM and the next character representing the size of the image in bytes. I have tried to search on the internet but all i found was codes in C which i do not understand. Please can anyone send me an e-mail with some sample codes on : cof123@gmail.com
    :
    Google for bitmap (.bmp) file format. When you find the file format information, write your code that handles such file.
    [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]

  • cof123cof123 Posts: 8Member
    : : I have started programming a few years ago and i would like to know how to decode a bitmap image and then display it on the screen. all i have managed to do is convert the bitmap into numbers having the first two chratcers being BM and the next character representing the size of the image in bytes. I have tried to search on the internet but all i found was codes in C which i do not understand. Please can anyone send me an e-mail with some sample codes on : cof123@gmail.com
    : :
    : Google for bitmap (.bmp) file format. When you find the file format information, write your code that handles such file.
    : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    : :
    But what i need to know is how to decode the bitmap data part of a 16 color bitmap as in one bit there will be 2 pixels represented in one byte??

  • Johnny13Johnny13 Posts: 128Member
    : But what i need to know is how to decode the bitmap data part of a 16 color bitmap as in one bit there will be 2 pixels represented in one byte??
    [code]const x:byte=$DA;
    writeln('1st pixel=',x shr 4);
    writeln('2nd pixel=',x and $F)[/code]
  • cof123cof123 Posts: 8Member
    [b][red]This message was edited by cof123 at 2004-12-28 3:21:56[/red][/b][hr]
    Thanks everyone. Now i'm having problem with the palette i'm using the
    for i:= 0 to 15 do
    begin
    SetRGBPalette(i,ORD(current+2),ORD(Current+1),ORD(Current));
    Current:=Current+4;
    end;
    But the first few colours are almost all black while the black one is being outputted as white. Am i doing something wrong? Or am i using the wrong command?


  • netgertnetgert Posts: 331Member
    : [b][red]This message was edited by cof123 at 2004-12-28 3:21:56[/red][/b][hr]
    : Thanks everyone. Now i'm having problem with the palette i'm using the
    : for i:= 0 to 15 do
    : begin
    : SetRGBPalette(i,ORD(current+2),ORD(Current+1),ORD(Current));
    : Current:=Current+4;
    : end;
    : But the first few colours are almost all black while the black one is being outputted as white. Am i doing something wrong? Or am i using the wrong command?
    :
    :
    :
    if Current is initially 0 then after this code the palette has gradient colors from #020100 to #3E3D3C which is from black to dark grey
    not sure if this is what u want
    [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]

  • cof123cof123 Posts: 8Member
    : : [b][red]This message was edited by cof123 at 2004-12-28 3:21:56[/red][/b][hr]
    : : Thanks everyone. Now i'm having problem with the palette i'm using the
    : : for i:= 0 to 15 do
    : : begin
    : : SetRGBPalette(i,ORD(current+2),ORD(Current+1),ORD(Current));
    : : Current:=Current+4;
    : : end;
    : : But the first few colours are almost all black while the black one is being outputted as white. Am i doing something wrong? Or am i using the wrong command?
    : :
    : :
    : :
    : if Current is initially 0 then after this code the palette has gradient colors from #020100 to #3E3D3C which is from black to dark grey
    : not sure if this is what u want
    : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    :
    :
    No current is the variable which is keeping the pointer of the ascii code in a string that is currently being read
  • netgertnetgert Posts: 331Member
    : : : [b][red]This message was edited by cof123 at 2004-12-28 3:21:56[/red][/b][hr]
    : : : Thanks everyone. Now i'm having problem with the palette i'm using the
    : : : for i:= 0 to 15 do
    : : : begin
    : : : SetRGBPalette(i,ORD(current+2),ORD(Current+1),ORD(Current));
    : : : Current:=Current+4;
    : : : end;
    : : : But the first few colours are almost all black while the black one is being outputted as white. Am i doing something wrong? Or am i using the wrong command?
    : : :
    : : :
    : : :
    : : if Current is initially 0 then after this code the palette has gradient colors from #020100 to #3E3D3C which is from black to dark grey
    : : not sure if this is what u want
    : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    : :
    : :
    : No current is the variable which is keeping the pointer of the ascii code in a string that is currently being read
    :
    that (using strings) seems like an ugly way to do it
    i would blockread() and convert data to Graph memory image (array of bytes containing the color's index in palette).... not sure if Graph's memory image uses 2-colors-to-1-byte encoding, havent worked with it a while
    [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]

  • cof123cof123 Posts: 8Member
    : that (using strings) seems like an ugly way to do it
    : i would blockread() and convert data to Graph memory image (array of bytes containing the color's index in palette).... not sure if Graph's memory image uses 2-colors-to-1-byte encoding, havent worked with it a while
    : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    :
    :
    Well I have been using the graph unit only this month can you tell me what exactly do you mean by Convert data to graph memory image???
  • netgertnetgert Posts: 331Member
    : : that (using strings) seems like an ugly way to do it
    : : i would blockread() and convert data to Graph memory image (array of bytes containing the color's index in palette).... not sure if Graph's memory image uses 2-colors-to-1-byte encoding, havent worked with it a while
    : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    : :
    : :
    : Well I have been using the graph unit only this month can you tell me what exactly do you mean by Convert data to graph memory image???
    :
    use the TP's builtin manual to get more info on functions GetImage and PutImage
    GetImage copies an area of screen into a buffer (thats what i called graph memory image) for use by your program. you can modify that buffer to alter the image, or save it to a file for later usage
    PutImage copies a buffer data to the screen. you can easily read the image data from the .bmp file and construct the image in the buffer and then use PutImage to put it onto the screen
    [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]

  • cof123cof123 Posts: 8Member
    : use the TP's builtin manual to get more info on functions GetImage and PutImage
    : GetImage copies an area of screen into a buffer (thats what i called graph memory image) for use by your program. you can modify that buffer to alter the image, or save it to a file for later usage
    : PutImage copies a buffer data to the screen. you can easily read the image data from the .bmp file and construct the image in the buffer and then use PutImage to put it onto the screen
    : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    :
    :
    But my problem isnt displaying the picture but displaying the correct colours. Is there any web page which shows sample codes in Pascal???
«1
Sign In or Register to comment.