Color extraction on windows screen

Discussions related to graphics (2D and 3D), animation and games programming
mikeg
Posts: 101
Joined: Sat 23 Jun 2018, 19:52

Color extraction on windows screen

Post by mikeg »

Hello
I have found a way to translate the LB code I found using LBB Pane in the editor, and I passed the data into BBC4W.
Unfortunately, I am unable to get access to the library "LBLIB.BBC" in the groups forum
I would ask if Richard would be willing to give me a new link to the library. (or maybe share a copy?)
Getting to this point took plenty of searching, and the Introduction to APIs does not cover this level of inside information:
Your help would be appreciated. Thankyou.
(Note: The original LB code was found on the Rosetta Code site and I looked at every example posted)
(it has been translated to the BBC Basic code snippet bellow)

Code: Select all

      HIMEM=PAGE+&1F400000:INSTALL @lib$+"LBLIB.BBCC":PROC_LBinit
      Version$="4.04 (LBB 3.07):Err$ = ""erl%=0:lc%=0:io&=&F
      DIM point{x%,y%}:PROC_clearstruct(point{})
      hDC = FNGETDC(0)
      result = FNGetCursorPos
      PRINT FN str$(FNGetPixel(hDC,point.x%,point.y%))
      PROCReleaseDC(0, hDC)
      PROC_end
      DEF PROCReleaseDC(hWnd, hDC)
      LOCAL ret
      ret = FN_releasedc(FN_32(hWnd), FN_32(hDC))
      ENDPROC
      DEF FNGetDC(hWnd)
      LOCAL GetDC
      GetDC = FN_getdc(FN_32(hWnd))
      = GetDC
      DEF FNgetCursorPos
      LOCAL GetCursorPos,point
      SYS "GetCursorPos", point{} TO GetCursorPos : GetCursorPos = FN_ulong(GetCursorPos)
      =GetCursorPos
      DEF FNGetPixel(hDC, x,y)
      LOCAL GETpixel
      SYS "Getpixel", FN_32(hDC), FN_32(x), FN_32(y), @memhdc% TO GetPixel
      = GetPixel
Focus is on code subject. Feel free to judge the quality of my work.