Roger Graphics

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Roger Graphics

#1 Post by Eugene Lutsenko »

Yet for some reason, this topic is not always displayed on the forum, but the link is launched.

http://bb.donnay-software.com/donnay/vi ... f=9&t=1563

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Roger Graphics

#2 Post by Eugene Lutsenko »

How to display a single window successive images without stopping to go to the next image by pressing key?

As when recording a graphic image file to save it in the minimum window sufficient to fully display?

Is it possible to be written in the form of an image file is not the whole picture, and some of his region, specify a range of pixels on the X, Y?

How to put an end to the image (paint pixel) in the place where the mouse cursor. How to make a reaction in the program on the left and click on the right mouse button in the graphic picture?

Somehow, for larger images incorrectly calculates the position of the right image, and it appears to the left than you need.

What is the structure of the array aPixel, generated function GetPixel. What function returns GetPixel?

Code: Select all

#pragma library( "dclip1.lib" )
#pragma library( "dclip2.lib" )
#pragma library( "dclipx.lib" )

STATIC snHdll

FUNCTION Main()

LOCAL GetList[0], GetOptions, oSay, hDC1, hDC2, oStatic1, oStatic2, ;
      aPixel

@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_BITMAP ;
      CAPTION "colors.jpg" ;
      OBJECT oStatic1 ;
      PREEVAL {|o|o:autoSize := .t.} ;
      EVAL {|o|hDC1 := GetWindowDC(o:getHWnd()), ;
               o:motion := {|a,b,o|ShowColor( hDC1, a, oSay, o )}, ;
               aPixel := Array(o:caption:xSize,o:caption:ySize)}

@ 0,250 DCSTATIC TYPE XBPSTATIC_TYPE_BITMAP;
      CAPTION "colors.jpg" ;
      PREEVAL {|o|o:autoSize := .t.} ;
      OBJECT oStatic2 ;
      EVAL {|o|hDC2 := GetWindowDC(o:getHWnd())}

@ 50,0 DCSAY '' SAYSIZE 350,20 FONT '10.Lucida Console' OBJECT oSay

@ 100,0 DCPUSHBUTTON CAPTION 'Clear Image' SIZE 100,20 ACTION {||ClearImage(hDC2,aPixel)}

@ DCGUI_ROW, DCGUI_COL + 20 DCPUSHBUTTON CAPTION 'Transfer Image' ;
    SIZE 80,20 ACTION {||TransferImage(hDC1,hDC2,aPixel)}

@ DCGUI_ROW, DCGUI_COL + 20 DCPUSHBUTTON CAPTION 'Flip Image' ;
    SIZE 80,20 ACTION {||FlipImage(hDC1,hDC2,aPixel)}

@ DCGUI_ROW, DCGUI_COL + 20 DCPUSHBUTTON CAPTION 'Rotate Image' ;
    SIZE 80,20 ACTION {||RotateImage(hDC1,hDC2,aPixel)}

@ DCGUI_ROW, DCGUI_COL + 20 DCPUSHBUTTON CAPTION 'Load Array' ;
    SIZE 80,20 ACTION {||LoadArray(hDC1,aPixel)}

DCGETOPTIONS PIXEL

DCREAD GUI FIT TITLE 'Pixel Test' OPTIONS GetOptions ;
   EVAL {||ClearImage(hDC2,aPixel)}

RETURN nil

* ---------

FUNCTION LoadArray( hDC1, aPixel )

LOCAL i, j, oScrn, nXSize := Len(aPixel), nYSize := Len(aPixel[1])

IF !aPixel[1,1] == nil
  DCMSGBOX 'Array is already loaded!'
  RETURN nil
ENDIF

oScrn := DC_WaitOn()

FOR i := 1 TO nXSize
  FOR j := 1 TO nYSize
    aPixel[i,j] := GetPixel(hDC1,i-1,j-1)
  NEXT
NEXT

DC_Impl(oScrn)

RETURN nil

* ---------

FUNCTION ClearImage( hDC2, aPixel )

LOCAL i, j, nXSize := Len(aPixel), nYSize := Len(aPixel[1])
LOCAL nColor := AutomationTranslateColor(GraMakeRGBColor({255,255,255}),.f.)

FOR i := 0 TO nXSize
  FOR j := 0 TO nYSize
    SetPixel(hDC2,i,j,nColor)
  NEXT
NEXT

RETURN nil

* ----------

FUNCTION TransferImage( hDC1, hDC2, aPixel )

LOCAL i, j, nColor, lEmptyArray := aPixel[1,1] == nil, ;
      nXSize := Len(aPixel), nYSize := Len(aPixel[1])

FOR i := 0 TO nXSize-1
  FOR j := 0 TO nYSize-1
    IF lEmptyArray
      SetPixel(hDC2,i,j,GetPixel(hDC1,i,j))
    ELSE
      SetPixel(hDC2,i,j,aPixel[i+1,j+1])
    ENDIF
  NEXT
NEXT

RETURN nil

* ----------

FUNCTION FlipImage( hDC1, hDC2, aPixel )

LOCAL i, j, lEmptyArray := aPixel[1,1] == nil, ;
      nXSize := Len(aPixel), nYSize := Len(aPixel[1])

FOR i := 0 TO nXSize-1
  FOR j := 0 TO nYSize-1
    IF lEmptyArray
      SetPixel(hDC2,j,i,GetPixel(hDC1,j,nXSize-i))
    ELSE
      SetPixel(hDC2,j,i,aPixel[i+1,j+1])
    ENDIF
  NEXT
NEXT

RETURN nil

* ----------

FUNCTION RotateImage( hDC1, hDC2, aPixel )

LOCAL i, j, lEmptyArray := aPixel[1,1] == nil, ;
      nXSize := Len(aPixel), nYSize := Len(aPixel[1])

FOR i := 0 TO nXSize-1
  FOR j := 0 TO nYSize-1
    IF lEmptyArray
      SetPixel(hDC2,i,j,GetPixel(hDC1,j,nXSize-i))
    ELSE
      SetPixel(hDC2,i,j,aPixel[j+1,nXSize-i])
    ENDIF
  NEXT
NEXT

RETURN nil

* ---------

PROC appsys ; RETURN

* ---------

STATIC FUNCTION ShowColor( hDC, aCoords, oSay, oStatic )

LOCAL nColor

aCoords[2] := oStatic:currentSize()[2] - aCoords[2]

nColor := GetPixel(hDC,aCoords[1],aCoords[2])

oSay:setCaption('Color: ' + DC_Array2String(GraGetRGBIntensity(AutomationTranslateColor(nColor,.T.))) + ;
   ' Coords: ' + DC_Array2String(aCoords))

RETURN nil

#command  GDIFUNCTION <Func>([<x,...>]) ;
       => ;
FUNCTION <Func>([<x>]);;
STATIC scHCall := nil ;;
IF scHCall == nil ;;
  IF snHdll == nil ;;
    snHDll := DllLoad('GDI32.DLL') ;;
  ENDIF ;;
  scHCall := DllPrepareCall(snHDll,DLL_STDCALL,<(Func)>) ;;
ENDIF ;;
RETURN DllExecuteCall(scHCall,<x>)

GDIFUNCTION GetPixel( nHDC, x, y)
GDIFUNCTION SetPixel( nHDC, x, y, n )
DLLFUNCTION GetWindowDC( hwnd ) USING STDCALL FROM USER32.DLL
[/size]

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Roger Graphics

#3 Post by Eugene Lutsenko »

I published my article in English:

http://ej.kubagro.ru/2015/06/pdf/102.pdf

and an article in which I used the advice and assistance of the forum, for which they are very grateful:

http://ej.kubagro.ru/2015/06/pdf/09.pdf

here is an article in English, which uses my mathematical models and software development:

http://ej.kubagro.ru/2008/03/pdf/07.pdf

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Roger Graphics

#4 Post by rdonnay »

here is an article in English, which uses my mathematical models and software development:
Eugene -

If it were written in Swahili I would have understood it just as well. :lol:

Your work is beyond my understanding. You are a prolific writer, mathematician, programmer and scholar.

If this forum helped you at all in your research, I would not even understand how. :icon-redface:

Roger
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Roger Graphics

#5 Post by Eugene Lutsenko »

Roger!

I am very, very grateful for the tremendous work that you have spent in the past and are now spending. Your personality combined a lot of very good people, very good people in the world. The possibility of communicating with you and participants of the forum is not only very useful for me, but just gives me great pleasure. This is very true, you help me a lot with his advice. You helped me a lot to develop the system, which I do: a system AIDOS. The essence of the system is very simple. The system allows you to calculate the amount of information in anything about anything. This allows us to solve the problem identification, decision-making and research in various subject areas. This is similar to what the Douglas Hubbard: http://www.hubbardresearch.com/. But I did it for decades before him (as he certainly does not know how to do and I exist).

PS
Your humor and I also really like (the account Swahili). I think Google and it will translate.

PS. This Swahili :)
Ucheshi wako na mimi pia kweli kama (Kiswahili akaunti). Nadhani Google na itakuwa kutafsiri.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Roger Graphics

#6 Post by Eugene Lutsenko »

Hi!
I tried (unsuccessfully) to identify and map the boundaries of the total image area of all the characters. I tried (unsuccessfully) to identify and map the boundaries of the image of each character (outline).
http://lc.kubagro.ru/Dima/outline.rar
There is an impression that the function GetPixel() gives an error value of the pixel (always == -1).
The function SetPixel() also failed in the use of my program and instead I used GraMarker().
Although, of course, Roger program it works. Now, if Roger is still made to display not only the coordinates of the mouse cursor, and the pixel value returned by GetPixel().

Added to the program Roger contouring and trimming.
Image
Everything worked out. And in my program generating character images is to do it can not.
We also define the minimum sufficient area for the image. Another would be to save as a graphic image file, circled in blue frame, ie, image area.

Roger!
Is it possible to use standard graphical Alaska together with yours, or vice versa, in conjunction with your standard? If so, how?

Post Reply