Page 1 of 1

DRAW ARC Sample

Posted: Sun Oct 10, 2021 3:50 am
by AUGE_OHR
hi,

i found some Sample with DRAW ARC but i can not find out which X,Y Coordinate are used.

Code: Select all

msginfo("Arc")
// Arc
draw arc in window x at 160,300 to 260,400 from radial 180,350 to radial 200,400 pencolor {random(255),random(255),random(255)} penwidth 5
i start with

Code: Select all

draw arc in window Win_1 at 0,0 to Width,Height
but how to get X,Y Coordinate for RADIAL :idea:

i want to start with 0° at "12" and have

Code: Select all

   +90° at "3"
  +180° at "6"
  +270° at "9"
which is like a Clock

---

under Xbase++ i need to use "negative" Value for "Clockwise" rotation

Code: Select all

   nSweepAngle := INT( ( nSS * 360 / 60 ) - 360 )
   nSweepAngle := INT( ( nMM * 360 / 60 ) - 360 )
   nSweepAngle := INT( ( nHH * 360 / 12 ) - 360 )
so how get from "Angle" to X,Y Coordinate for RADIAL in HMG :?:
HB_UHR_3.jpg
HB_UHR_3.jpg (33.82 KiB) Viewed 729 times

Re: DRAW ARC Sample

Posted: Tue Oct 12, 2021 11:55 pm
by AUGE_OHR
hi,

need some more help for "rules of mathematical operations" ...

i got Demo of my "Clock" working using HMG ... so far
HB_UHR_Demo_50.jpg
HB_UHR_Demo_50.jpg (44.82 KiB) Viewed 577 times
but i have 2 Problem which can be show in Demo in right-Menu
KreisUhr01.zip
EXE only
(1.47 MiB) Downloaded 70 times
a.) Size and BT_DrawArc()
b.) SetLayeredWindowAttributes() -> Transparency

ad a.) it work correct at 100% and 200% but other Size show wrong "12" Position (for MM and HH), why :?:
ad b.) Transparency have RED Color :o

---

Question to a.)

to draw "full-fit" Seconds i can use

Code: Select all

   Row1 := 0
   Col1 := 0
   Row2 := Height
   Col2 := Width
but how are Coordinate of "inner-Ring" Minute / Hour when use different Size :idea:

Re: DRAW ARC Sample

Posted: Wed Oct 13, 2021 2:39 am
by AUGE_OHR
more Information :

Code: Select all

   aCenter := {Width/2, Height/2}
   nRing := 3
   nWidthLine    := INT(Width/2/nRing)
   aColorRGBFill := {55,55,55}
nSS as 1st. "Ring" is working at any Size of Form

Code: Select all

   ***************************** nSS *****************************
      OFFSET := Width/2/nRing*1
      nTmp := (nSS-15)*6/60
      Row1 := 0
      Col1 := 0
      Row2 := Height
      Col2 := Width
      ColStartArc := INT(aCenter[1]+COS(nTmp)*OFFSET)
      RowStartArc := INT(aCenter[2]+SIN(nTmp)*OFFSET)
      // not sure why need -120 here ... i know about -90
      ColEndArc   := INT(aCenter[1]+COS(-120))
      RowEndArc   := INT(aCenter[2]+SIN(-120))
      aColorRGBLine := {255,0,0}
     BT_DrawArc(hDC, Row1, Col1, Row2, Col2, RowStartArc, ColStartArc, RowEndArc, ColEndArc, aColorRGBLine, nWidthLine)
now i search for nMM in 2nd. "Ring" which work with "any Size"

Code: Select all

   ***************************** nMM *****************************
      OFFSET := Width/2/nRing*2
      nTmp := (nMM-15)*6/60