|
How to create Bitmaps? |
fatboy2
Member #8,239
January 2007
|
I am trying to make an algorithm that draws lines. I am trying create a bitmap that the line will be written to and then load that bitmap to the screen. The only thing I do not know is how to make the line be written to the bitmap. I know how to create load bitmaps that are pictures but I have trouble with making a bitmap that is created using a drawing function. |
Kitty Cat
Member #2,815
October 2002
|
-- |
fatboy2
Member #8,239
January 2007
|
I meant writing a drawing to a bitmap, I know how to define bitmaps and load pictures into them but I do not know to load products of real-time drawing functions into them. |
Kitty Cat
Member #2,815
October 2002
|
I'm not sure what you're asking. create_bitmap creates a bitmap that you can draw to. BITMAP *bmp = create_bitmap(64, 64); line(bmp, 0, 0, 64, 64, makecol(255, 0, 0)); ...
-- |
axilmar
Member #1,204
April 2001
|
fatboy2 said: I meant writing a drawing to a bitmap, I know how to define bitmaps and load pictures into them but I do not know to load products of real-time drawing functions into them. You actually have to draw onto a bitmap. For example, drawing a line goes like this: BITMAP *bmp = create_bitmap(320, 200); line(bmp, 0, 0, 319, 199, makecol(255, 255, 255)); If by 'real-time' you mean to move a line onto a bitmap, then you have to draw it and erase it in every loop, using xor mode: xor mode draws stuff in such a way that the 2nd time a picture is drawn (in the same position as in the first time), it is erased. |
fatboy2
Member #8,239
January 2007
|
Thanks for the explanation |
Kauhiz
Member #4,798
July 2004
|
cough RTFM cough, but yes, you got it. --- |
ImLeftFooted
Member #3,935
October 2003
|
I think thats a perfectly valid questing that the fcuking manual does not answer. |
LennyLen
Member #5,313
December 2004
|
Quote: I think thats a perfectly valid questing that the fcuking manual does not answer. Yeah, because the documentation for line() only says that the first parameter is the BITMAP that the line will be drawn too.
|
HardTranceFan
Member #7,317
June 2006
|
Sounds like fatboy2 isn't using double buffering, and may not be aware of drawing to a bitmap other than screen. -- |
ImLeftFooted
Member #3,935
October 2003
|
What I'm saying is there is no section that generally describes this sort of concept. If he really wanted to learn from the manual he would have to read tons and tons of functions' documentation (most of which he would not even understand) until he just happened to come across some useful information. The whole process would probably take him a week and he would just give up. Its a conceptual question, not a syntactical one. Therefore I believe it is totally valid and the phrase "RTFM" is out of place. |
LennyLen
Member #5,313
December 2004
|
You mean such as this part? Quote: Once you have selected a graphics mode, you can draw things onto the display via the `screen' bitmap. All the Allegro graphics routines draw onto BITMAP structures, which are areas of memory containing rectangular images, stored as packed byte arrays (in 8-bit modes one byte per pixel, in 15- and 16-bit modes two bytes per pixel, in 24-bit modes 3 bytes per pixel and in 32-bit modes 4 bytes per pixel). You can create and manipulate bitmaps in system RAM, or you can write to the special `screen' bitmap which represents the video memory in your graphics card.
|
Kauhiz
Member #4,798
July 2004
|
Quote: Its a conceptual question, not a syntactical one. Therefore I believe it is totally valid and the phrase "RTFM" is out of place. He asked the question after he was given example code that demonstrated this, though. It would have been quicker for him to confirm this by looking at the manual than it was for him to post that question. Also, I'd consider TFM to include the allegro examples, since in many cases they are as good/better than the manual. Maybe I should have said RTFMOLATFAE. --- |
|