Feature #880 ยป 0041-sdl3-Update-get_pixel-get_first_pixel-to-sdl3-change.patch
client/gui-sdl3/graphics.c | ||
---|---|---|
Return the pixel value at (x, y)
|
||
NOTE: The surface must be locked before calling this!
|
||
**************************************************************************/
|
||
Uint32 getpixel(SDL_Surface *surf, Sint16 x, Sint16 y)
|
||
Uint32 get_pixel(SDL_Surface *surf, Sint16 x, Sint16 y)
|
||
{
|
||
if (!surf) {
|
||
return 0x0;
|
||
}
|
||
switch (surf->format->bytes_per_pixel) {
|
||
switch (SDL_GetPixelFormatDetails(surf->format)->bytes_per_pixel) {
|
||
case 1:
|
||
return *(Uint8 *) ((Uint8 *) surf->pixels + y * surf->pitch + x);
|
||
... | ... | |
return 0;
|
||
}
|
||
switch (surf->format->bytes_per_pixel) {
|
||
switch (SDL_GetPixelFormatDetails(surf->format)->bytes_per_pixel) {
|
||
case 1:
|
||
return *((Uint8 *)surf->pixels);
|
||
... | ... | |
return *((Uint32 *)surf->pixels);
|
||
default:
|
||
return 0; /* shouldn't happen, but avoids warnings */
|
||
return 0; /* Shouldn't happen, but avoids warnings */
|
||
}
|
||
}
|
||
client/gui-sdl3/graphics.h | ||
---|---|---|
int blit_entire_src(SDL_Surface *psrc,
|
||
SDL_Surface *pdest, Sint16 dest_x, Sint16 dest_y);
|
||
Uint32 getpixel(SDL_Surface *surf, Sint16 x, Sint16 y);
|
||
Uint32 get_pixel(SDL_Surface *surf, Sint16 x, Sint16 y);
|
||
Uint32 get_first_pixel(SDL_Surface *surf);
|
||
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top,
|
client/gui-sdl3/gui_mouse.c | ||
---|---|---|
d = data + y * w;
|
||
m = mask + y * w;
|
||
for (x = 0; x < image->w; x++) {
|
||
color = getpixel(image, x, y);
|
||
color = get_pixel(image, x, y);
|
||
SDL_GetRGBA(color, details, NULL,
|
||
&r, &g, &b, &a);
|
||
if (a != 0) {
|
client/gui-sdl3/widget_label.c | ||
---|---|---|
SDL_FillSurfaceRect(ptheme, &area,
|
||
map_rgba_details(details, bg_color));
|
||
store = pstr->bgcol;
|
||
SDL_GetRGBA(getpixel(ptheme, area.x , area.y),
|
||
SDL_GetRGBA(get_pixel(ptheme, area.x , area.y),
|
||
details, NULL,
|
||
&pstr->bgcol.r, &pstr->bgcol.g,
|
||
&pstr->bgcol.b, &pstr->bgcol.a);
|
||
... | ... | |
SDL_FillSurfaceRect(ptheme, &area,
|
||
map_rgba_details(details, bg_color));
|
||
store = icon_label->string_utf8->bgcol;
|
||
SDL_GetRGBA(getpixel(ptheme, area.x , area.y),
|
||
SDL_GetRGBA(get_pixel(ptheme, area.x , area.y),
|
||
details, NULL,
|
||
&icon_label->string_utf8->bgcol.r,
|
||
&icon_label->string_utf8->bgcol.g,
|