Entry screeshot current window to a file

This forum is for eXpress++ general support.
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:

Entry screeshot current window to a file

#1 Post by Eugene Lutsenko »

How to record, screeshot current window to a file? After use, the operation of the image rotation function: DC_Scrn2ImageFile() saves a black screen

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

Re: Entry screeshot current window to a file

#2 Post by rdonnay »

Show me the code where you are calling DC_Scrn2ImageFile().
I want to see what parameters you are passing.
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: Entry screeshot current window to a file

#3 Post by Eugene Lutsenko »

Hey, Roger!

Code: Select all

   ***** Надписи наименований шкал Y и X

   oFont := XbpFont():new():create("12.Arial Bold")
   GraSetFont(oPS , oFont)                                // установить шрифт
   aAttrF := ARRAY( GRA_AS_COUNT ) 
   aAttrF [ GRA_AS_COLOR      ] := GRA_CLR_BLACK 
   aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_CENTER      // Выравнивание символов по горизонтали по центру относительно точки начала вывода
   aAttrF [ GRA_AS_VERTALIGN  ] := GRA_VALIGN_HALF        // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
   GraSetAttrString( oPS, aAttrF )                        // Установить символьные атрибуты

   AxName = '['+ALLTRIM(STR(mOpSc))+']-'+mNameOpSc
   aTxtPar = DC_GraQueryTextbox(AxName, oFont)    //   {101,16} Определяет длину и высоту текста в пикселях для некоторых шрифтов
   GraStringAt( oPS, { dXcf+(mMaxXcf-dXcf)/2-aTxtPar[1]/2, 10}, AxName )                                 // Надпись оси Х

   AyName = '['+ALLTRIM(STR(mClSc))+']-'+mNameClSc
   aTxtPar = DC_GraQueryTextbox(AyName, oFont)    //   {101,16} Определяет длину и высоту текста в пикселях для некоторых шрифтов
   aMatrix := GraInitMatrix()
   GraRotate( oPS, aMatrix, 90, { 15, dYcf+(mMaxYcf-dYcf)/2-aTxtPar[1]/2 }, GRA_TRANSFORM_ADD )
   oPS:setGraTransform( aMatrix, GRA_TRANSFORM_REPLACE )
   GraStringAt( oPS, { 15, dYcf+(mMaxYcf-dYcf)/2-aTxtPar[1]/2 }, AyName )                                // Надпись оси Y

   *** Наименования значений фактора писать с поворотом на 90 градусов

   oFont := XbpFont():new():create("9.Arial Bold")
   GraSetFont(oPS , oFont)                                // установить шрифт
   aAttrF := ARRAY( GRA_AS_COUNT ) 
   aAttrF [ GRA_AS_COLOR      ] := GRA_CLR_BLACK 
   aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_RIGHT       // Выравнивание символов по горизонтали по правому краю относительно точки начала вывода
   aAttrF [ GRA_AS_VERTALIGN  ] := GRA_VALIGN_HALF        // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
   GraSetAttrString( oPS, aAttrF )                        // Установить символьные атрибуты

   FOR j=1 TO LEN(aAvrGrIntAtr)

       AxName = '['+ALLTRIM(STR(j))+']-'+aNameAtr[j]
       aMatrix := GraInitMatrix()
       GraRotate( oPS, aMatrix, 90, { aAvrGrIntAtr[j], dYcf-20 }, GRA_TRANSFORM_ADD )
       oPS:setGraTransform( aMatrix, GRA_TRANSFORM_REPLACE )
       GraStringAt( oPS, { aAvrGrIntAtr[j], dYcf-20 }, AxName )                                          // Надпись градации по оси X

   NEXT

   ****** Не получается отключить режим вращения изображения
   ****** Вместо отключения можно докрутить до 360 градусов

   X_Max := 1800                                                                                                          
   Y_Max :=  850                                     // Размер графического окна для самого графика в пикселях            

   aMatrix := GraInitMatrix()
   GraRotate( oPS, aMatrix, 360, {900, 425}, GRA_TRANSFORM_ADD )
   oPS:setGraTransform( aMatrix, GRA_TRANSFORM_REPLACE )

   *** Масштабирование: Kx = 1920/1280, Ky = 1080/720: GraScale( oPS, aMatrix, {Kx,Ky}, {X_Max/2, X_Max/2} )
*  GraScale( oPS, aMatrix, {1920/1280,1080/720}, {X_Max/2, X_Max/2} )

   *** 7. Записать файл изображения с именем: "Модель-код опис.шкалы-код клас.шкалы"

   DIRCHANGE(M_PathAppl)                      // Перейти в папку текущего приложения

   IF FILEDATE("Cogn_fun",16) = CTOD("//")
      DIRMAKE("Cogn_fun")
      Mess = 'В папке текущего приложения: "#" не было директории "Cogn_fun" для когнитивных функций и она была создана!'
      Mess = STRTRAN(Mess, "#", UPPER(ALLTRIM(M_PathAppl)))
      LB_Warning(Mess, '4.8. Когнитивные функции.  (C) Система "Эйдос-Х++"' )
   ENDIF

   DIRCHANGE(M_PathAppl+"\Cogn_fun\")      // Перейти в папку Cogn_fun
   cFileName = Ar_Model[mCurrInf]+'-'+STRTRAN(STR(mOpSc,4),' ','0')+'-'+STRTRAN(STR(mClSc,4),' ','0')+'.bmp'
   DO CASE
      CASE mCognFun = 1
           cFileName = Ar_Model[mCurrInf]+'-'+STRTRAN(STR(mOpSc,4),' ','0')+'-'+STRTRAN(STR(mClSc,4),' ','0')+'-Pos.bmp'
      CASE mCognFun = 2
           cFileName = Ar_Model[mCurrInf]+'-'+STRTRAN(STR(mOpSc,4),' ','0')+'-'+STRTRAN(STR(mClSc,4),' ','0')+'-Neg.bmp'
      CASE mCognFun = 3
           cFileName = Ar_Model[mCurrInf]+'-'+STRTRAN(STR(mOpSc,4),' ','0')+'-'+STRTRAN(STR(mClSc,4),' ','0')+'-PosNeg.bmp'
   ENDCASE   
   ERASE(cFileName)
   DC_Scrn2ImageFile( oStatic1, cFileName )
*  DIRCHANGE(M_PathAppl)                      // Перейти в папку текущего приложения
   DIRCHANGE(Disk_dir)                        // Перейти в папку с системой
[/size]

When I'm not using the rotation to image everything works fine. Screenshot image:
Attachments
Без имени-1.jpg
Без имени-1.jpg (534.16 KiB) Viewed 12974 times

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

Re: Entry screeshot current window to a file

#4 Post by rdonnay »

DC_Scrn2ImageFile( oStatic1, cFileName )
What is oStatic1?
I dono't see that in your code.
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: Entry screeshot current window to a file

#5 Post by Eugene Lutsenko »

rdonnay wrote:
DC_Scrn2ImageFile( oStatic1, cFileName )
What is oStatic1?
I dono't see that in your code.
The code is very high, because it's all in the system I develop. Once You told me how you can open a graphical window to make a button and display it in different image, erasing the previous one. It was very convenient. I'm using it. Previously, I have formed the zero output of each of graphic form. Now just erase Board and draw on it something new, and the Board to create every time is not necessary.

Code: Select all

DCREAD GUI FIT TITLE mTitle OPTIONS GetOptions ;
   EVAL {||GraTest(oStatic1)} SETAPPWINDOW

Code: Select all

FUNCTION GraTest( oStatic )

PUBLIC oFont, oPS := oStatic:lockPs()

oFont := XbpFont():new( oPS ):create()
oFont:configure('16.Arial Bold')
GraSetFont( oPS, oFont )

RETURN nil

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

Re: Entry screeshot current window to a file

#6 Post by rdonnay »

It could be that oStatic1 has been destroyed by the time you get to DC_Scrn2ImageFile().

I would have to see much more of your code before I could understand what oStatic1 is.
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: Entry screeshot current window to a file

#7 Post by Eugene Lutsenko »

rdonnay wrote:It could be that oStatic1 has been destroyed by the time you get to DC_Scrn2ImageFile().

I would have to see much more of your code before I could understand what oStatic1 is.
I think variable is fine, because everything works fine if you do not use rotation. Full actual code of the system Eidos is always here:
http://lc.kubagro.ru/_AIDOS-X.doc

But to check this in the system it is better to download the full installation: http://lc.kubagro.ru/aidos/_Aidos-X.htm

Then install some application in the mode of 1.3, to create models in 3.5 mode and then to switch to 4.8 for the formation of this graphic form. In General, several technical and confusing, because we need to understand the use of the system. And she has Russian interface...

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

Re: Entry screeshot current window to a file

#8 Post by rdonnay »

What is the name of the function that contains the DC_Scrn2ImageFile() call?
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: Entry screeshot current window to a file

#9 Post by Eugene Lutsenko »

rdonnay wrote:What is the name of the function that contains the DC_Scrn2ImageFile() call?
LC_CognFun().

This function forms the image. Record it in a file at the end of this function, before the next.

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

Re: Entry screeshot current window to a file

#10 Post by rdonnay »

I think you need to put some debugging in the file to see what is the value of oStatic1 just before calling DC_Scrn2ImageFile(oStatic1,..)

WTF oStatic1 pause

It should return a value of DC_XbpStatic(), an object.

If it does not, then that is the problem.

If it does, then there is something else wrong such as maybe it has been destroyed.
To determine if that is true, use the following debugging:

WTF oStatic1:status()

It should return a value of XBP_STAT_CREATE (1)
If it returns a 0 or -1, then there is another problem.
The eXpress train is coming - and it has more cars.

Post Reply