The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
A simple graphics rectangle? My coordinates are wrong
06-01-2016, 11:16 PM
Post: #1
A simple graphics rectangle? My coordinates are wrong
This should be a simple rectangle inside a rectangle - but I am not seeing the border I expect.
It seems almost like the inner x,y coordinates are being seen as lengths rather than absolute coordinates.
Where am I going wrong?
(Android version)
Code:


 LOCAL BWIDTH:=8; //FRAME OR BORDER
 LOCAL YLEN:=192; //OR 175 MAIN AREA
 //INNER RECT IS 255*YLEN

 DRAW_IT()
 BEGIN
  LOCAL COLY:=#0F0F0FFFh;
  //WHERE IS 255,YLEN;
  RECT_P(255,YLEN,255,YLEN,#04040404h);
  WAIT;
  TEXTOUT_P("*",255,YLEN);
  WAIT;
  //DRAW FRAME
  //RECT_P(0,0,255+2*BWIDTH,YLEN+2*BWIDTH,#0F0F0FFFh,#7F7F7FFFh);
  ///THE OUTER X IS 255+2B
  ///THE OUTER Y IS YLEN+2B
  RECT_P(0,0,255+2*BWIDTH,BWIDTH,COLY);
  WAIT;
  RECT_P(0,BWIDTH,BWIDTH,YLEN+BWIDTH,COLY);
  WAIT;
  RECT_P(255+BWIDTH,BWIDTH,255+2*BWIDTH,YLEN+BWIDTH,COLY);
  WAIT;
  RECT_P(0,YLEN+BWIDTH,255+2*BWIDTH,YLEN+2*BWIDTH,COLY);
  TEXTOUT_P("255+2B=",255+2*BWIDTH,20);
  TEXTOUT_P(255+2*BWIDTH,255+2*BWIDTH,40);
  WAIT;
  //DRAW MAIN-THIS LOOKS RIGHT
  //A FRAME ALL AROUND
  //WHY IS TEXT TO LEFT OF EDGE? BOTH 255
  //THE RECT AND TEXTOUT COORDINATES ARE NOT ALIGNED?
  RECT_P(BWIDTH,BWIDTH,255,YLEN,#FF0101FFh,#07FF07FFh);
  TEXTOUT_P("255",255,80);
  WAIT;
  //BUT SHOULD IT NOT BE
  RECT_P(BWIDTH,BWIDTH,255+BWIDTH,YLEN+BWIDTH,#FF0101FFh,#07FF07FFh);
  TEXTOUT_P("255+",255+BWIDTH,YLEN+BWIDTH);
  //BECAUSE OF THE TOP/LEFT FRAME
  //BUT THAT LOOKS WRONG
  WAIT;
 END;
 
 EXPORT TRYFRAMEONE()
 BEGIN
  //DIMGROB_P(G0,320,240);
  RECT_P();
  DRAW_IT();
  FREEZE; 
 END;

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
A simple graphics rectangle? My coordinates are wrong - StephenG1CMZ - 06-01-2016 11:16 PM



User(s) browsing this thread: 2 Guest(s)