Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Richard Russell

On Tue, Feb 5, 2019 at 12:05 PM, Jon Welch wrote:
Unfortunately, I am not familiar enough with the code in the library to debug this further.
The demo works fine on my Samsung Galaxy Tab S2, but I have seen this effect myself on other devices.  It probably arises from your phone using a restricted colour palette (whereas desktop PCs and iOS devices tend to use full 24-bit RGB colour, Android devices often use 16-bit e.g. RGB565).  The result of this is that the 'flood fill to foreground' (PLOT 143) can fail because the colour it is looking for doesn't exist, because it cannot be represented in 16-bits!

You can experiment with changing the colour it 'flood fills' to, but there is no guarantee of success and it could just as easily stop it working on a different device! That colour is set in the fifth line from the bottom of the library:

      SYS "SDL_SetRenderDrawColor",@memhdc%,0,0,20,&FF

Try changing the 20 to something larger (say 30 or 40) to see if it makes any difference.  As you will appreciate the 'filled ellipses' are a kludge anyway because using a flood fill is not a very satisfactory method, not least because it is so slow.  But I'm stuck with the SDL2_gfx library as the means of drawing 2D graphics and that has no filled ellipse capability at all.

It is unfortunate that the SDL2_gfx library is so limited (and what it does do it does poorly).  It's why BBCSDL has no support for drawing segments, or circles/ellipses/arcs with a specified line thickness, or polylines etc.  Only a week or so ago I was in email correspondence with its author; I think he recognises some of its limitations but he confirmed that he has no intentions of improving it.  In an ideal world I'd like to ditch SDL2_gfx entirely in favour of a better 2D graphics library, bit I don't know of one.

Join to automatically receive all group messages.