Oxygen Basic

Programming => Problems & Solutions => Topic started by: Peter on April 03, 2013, 05:24:23 AM

Title: Wrong_Pixel_Color
Post by: Peter on April 03, 2013, 05:24:23 AM
Deleted
Title: Re: Wrong_Pixel_Color
Post by: Charles Pegge on April 03, 2013, 09:04:13 AM
Hi Peter,
A little brain teaser:

I assum the surface.pixels is a pixel array base pointer, and you are mapping pixels to it.

Function GetPixel(int x, y) as sys Export
    dword *pixel
    &pixel = screen.pixels   '&screen is already defined
    Return pixel[y*screen.w+x]
End Function


Function GetPixel(int x, y) as sys Export
    SDL_surface *surface
   &surface= ...  'need to obtain a surface handle from SDL
    dword *pixel
    &pixel = surface.pixels
    Return pixel[y*surface.w+x]
End Function
Title: Re: Wrong_Pixel_Color
Post by: Emil_halim on April 03, 2013, 10:33:27 AM

Hi Peter ,

first of all you have to make check of your screen color format , E.g does it ARGB or RBG or BGRA ,etc.....

so Oxygen has no help here , i had have this problem when i was working with my libraries .

and you have correct the color format by yourself.