Hi Matt,

On 26-11-11 03:55, mattschinkel wrote:

I just wanted to mention that the below is not always correct. Some
glcd's may use 0 for black and 1 for white. Seb and I actually
discussed this :)

const byte GLCD_BACKGROUND_COLOR = 0            -- white
const GLCD_PEN_COLOR = 1                        -- black

I didn't follow with much interest the discussions about glcd libraries because at that time I had none (and I didn't look back). What I understand by reading glcd_common library is that these are the defaults, unless the device-dependent glcd_library hasn't declared 'm. These names are declared in the glcd_ks0108 library. And these are decalred as variables such that the application can change them, which I also do in the samples I provided.
I see the same in the libraries for Nokia_3310 and Stm-32qvt.
So I don't see the problem.

Also, your sbyte*3 may not always be needed. Is your glcd>  256 pixels
for both X and Y? See constants GLCD_X_SIZE&  GLCD_Y_SIZE. I think
this was mentioned in the issue as well.

The glcd_ellipse procedure uses formula like

  x_change = yr * yr * (1- 2 * xr)
  stopping_x = two_b_square * xr

When using swords (with 15 significant bits) the maximum radious of a circle that would guaranteed not to cause overflow is only 25! So even on a 64x64 display you cannot draw a circle touching the edges of the display. When using sbyte*3 (23 significant bits) the maximum radious of a circle would be 161.

Note: I think my calculations are correct, but please check (your math may be a little more up to date than mine!).

The limits for ellipses are somewhat more difficult to calculate because of the mix of xr and yr in the intermediate results.

Maybe the variables could be optimized a little more like some sbyte*3, some sword. But is it really so helpful? The variables are local to the procedure, so the RAM can be re-used outside the procedure.

Maybe use a if statement, or even try something like this:

var sbyte*(2+GLCD_X_SIZE) x = 1234

It is not as easy as that! Firstly the minimum for GLCD_X_SIZE is 1, so this formula would result in sbyte*3, which is what we already have now. Better would be (1+GLCD_X_SIZE). Secondly the required size depends on both on the desired x and y radii. Thirdly when you want to draw part of a circle or ellipse the x or y radius could be larger than half of the physical x- or y-dimension of the display.

To be continued.....

Regards, Rob.

--
R. Hamerling, Netherlands --- http://www.robh.nl

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to