|
Problem with bitmaps |
aethersis
Member #15,605
May 2014
|
Hello, I'm completely new to allegro and I'm writing a program to dither image files. Unfortunatelly it's a task for programming classes and I couldn't choose any other library for that (normally I'd use something that is created specially for this purpose). The problem is as follows: I load the bitmap from file: Until then everything goes fine, however there's a problem later. Whenever I use al_draw_pixel, it draws the pixels successfuly and even displays the image after it's done, however after I try to save the same image I just modified, or alter it using another function, it does not work on the modified image, but on the image that was initially loaded. I.e. when I save it, even though it's modified, I obtain saved copy of the source file. What can be the source of this problem? At every attempt to modify the bitmap, I use al_lock_bitmap(image,al_get_bitmap_format(image), ALLEGRO_LOCK_READWRITE); Please help me, it's a real struggle for me and my time is very limited so that I cannot unfortunately read the whole documentation |
Dizzy Egg
Member #10,824
March 2009
|
Are you setting the bitmap to be the one that's being drawn to? al_set_backbuffer or whatever? Because if not, im guessing it draws the pixel to the screen, on top of you image (not actually in it...) ..I could be wrong!
---------------------------------------------------- |
Slartibartfast
Member #8,789
June 2007
|
You are at the very least wrong in that you probably meant al_set_target_bitmap ---- |
aethersis
Member #15,605
May 2014
|
Unfortunately neither of the suggestions seem to be working. The procedure is as follows: 1.load bitmap and display it 1. works fine and displays EDIT: |
Slartibartfast
Member #8,789
June 2007
|
Show some code. It should be the bare minimum compiling program that exhibits the problem you are having. ---- |
Dizzy Egg
Member #10,824
March 2009
|
It's sort of kind of almost maybe not really almost not quite near impossible to create something in memory, save it to a hard drive, and then open it to find it's not the thing you saved. What I'm trying to say, in the nicest way possible, is you're definitely doing something a) wrong b) miraculous. Show us your code, we will do nothing but point out why whats happening is happening; it'll help!
---------------------------------------------------- |
beoran
Member #12,636
March 2011
|
My wild guess is that the image is converted and drawn to the display, but not to the bitmap that is being saved. That would explain getting a black (or blank) bitmap on saving. |
|