![]() |
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Ouvrir sur le forum | Recherche | Messages du jour | Marquer les forums comme lus |
Aide au développement Aide sur l'utilisation d'OSLib |
Publicité |
![]() |
|
Outils de la discussion | Modes d'affichage |
|
![]() |
#1 |
Membre
Date d'inscription: 02/04/2008
Messages: 16
|
![]() Hi, I have a Problem. I want to know, if it' s possible to read the color of an spezific pixel. I mean, i have the pixel 10*10 and want to know, if he is pink ( only an example ).
Is there a function in OSl, I mean, that I' ve read something like this somewhere, but I could' t find it. If it' s not on OSL, can someone give me a way to do this job with normal SDK?? Floorball92 ps: like last time to, sorry for my bad english xD |
![]() |
![]() |
![]() |
#2 |
Membre
Date d'inscription: 02/04/2008
Messages: 16
|
![]() I read a bit in the documentation and found something. I was very happy and wantet direktly try it, so I' ve made this Code:
Code:
//The main library OSLib #include <oslib/oslib.h> //The callbacks PSP_MODULE_INFO("OSLib Sample", 0, 1, 1); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); OSL_IMAGE *bg; int main() { //Initialization of the library oslInit(0); //Initialization of the graphic mode oslInitGfx(OSL_PF_8888, 0); //Initialization of the text console oslInitConsole(); bg = oslLoadImageFile("bg.png", OSL_IN_RAM, OSL_PF_5551); //Display text on the screen oslPrintf("%s", oslGetImagePixelAdr(bg,10,10)); //Wait a keystroke oslWaitKey(); //Leaving the program oslEndGfx(); oslQuit(); return 0; } What' s wrong with this?? |
![]() |
![]() |
![]() |
#3 |
Membre confirmé
|
![]() Have you tried this?
Code PHP:
If you want to know if that pixel is pink (255,0,255) just see if pixel==RGB(255,0,255) |
![]() |
![]() |
![]() |
#4 |
Membre
Date d'inscription: 02/04/2008
Messages: 16
|
![]() Do I have to insert something for pixelformat and palette ??
|
![]() |
![]() |
![]() |
#5 |
Membre confirmé
|
![]() yes, it's those of your osl_image...
Code PHP:
Again, I haven't tested, but that would be my first try. |
![]() |
![]() |
![]() |
#6 |
Membre
Date d'inscription: 02/04/2008
Messages: 16
|
![]() This works perfect, thank you so much
![]() |
![]() |
![]() |
![]() |
#7 |
Super Modérateur
Date d'inscription: 10/11/2005
Localisation: Un pays avec beaucoup de banques
Messages: 3 229
|
![]() Are you sure you need to do that? The drawbuffer (= the screen) is itself an image, you can get it by oslGetDrawBuffer(). So you could read the pixel that way.
But beware that because the GPU may be drawing at the moment you read the pixel (i.e. the drawing is not finished) you may not get the right color. So, before reading anything on the screen, always ensure that the drawing is finished with a former oslSyncDrawing call ![]() |
![]() |
![]() |
![]() |
#8 | |
Membre
Date d'inscription: 30/11/2007
Messages: 29
|
![]() Citation:
|
|
![]() |
![]() |
![]() |
Liens sociaux |
Publicité |
Utilisateurs regardant la discussion actuelle : 1 (0 membre(s) et 1 invité(s)) | |
Outils de la discussion | |
Modes d'affichage | |
|
|