Posted: 3rd Jul 2021 13:03
+ Code Snippet
// Created: 2020-08-27
 
// show all errors
SetErrorMode(2)
 
// set window properties
SetWindowTitle( "generated map" )
a=GetMaxDeviceWidth()
b=GetMaxDeviceHeight()
SetWindowSize( a, b, 1 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
 
// set display properties
SetVirtualResolution( a, b ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
 
 
 SetWindowSize( 1024, 768, 1 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
 
// set display properties
SetVirtualResolution( 1024, 768)
 
`Setvirtualresolution(1000,1000)
ResetTimer()
dim map[551,551]
remstart
//Create a Green Cross Image
swap()
Drawline(0,0,15,15,0,255,0)
Update(0)
Render()
Drawline(0,15,15,0,0,255,0)
Update(0)
Render()
GetImage(1,0,0,15,15)
//Save Image File
SaveImage(1,"temp.png")
SetClearColor(50,50,100)
//Create Sprite
id=LoadSprite("temp.png")
remend
swap()
plato()
 
for r=1 to 200
    holm(Trunc(random(20,531)),Trunc(random(20,531)))
next r
 
for r=1 to 200
    holm1(Trunc(random(20,531)),Trunc(random(20,531)))
next r
 
for x=0 to 551
    for y=0 to 551
        drawbox(x,y,x+1,y+1,map[x,y],map[x,y],map[x,y],map[x,y],1)
    next y
next x
 
GetImage(1,20,20,531,531)
//Save Image File
SaveImage(1,"temp.png")
SetClearColor(50,50,100)
//Create Sprite
id=LoadSprite("temp.png")
Do
    If Timer()>15 Then Exit
    Sync()
Loop
End
function plato()
`----------- plato
for x=0 to 551
    for y=0 to 551
        map[x,y]=50
        drawbox(x,y,x+1,y+1,50,50,50,50,1)
        Update(0)
        Render()
    next y
next x
endfunction
function holm(x,y)
for t=1 to 18
for alfa=0 to 360
     
        h= map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y)]
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y)]=h
        if h<=68-t
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y)]=68-t
        map[Trunc(cos(alfa)*t+x+1),Trunc(sin(alfa)*t+y)]=68-t
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y+1)]=68-t
        map[Trunc(cos(alfa)*t+x+1),Trunc(sin(alfa)*t+y+1)]=68-t
        elseif h>70-t
                 
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y)]=h
        map[Trunc(cos(alfa)*t+x+1),Trunc(sin(alfa)*t+y)]=h
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y+1)]=h
        map[Trunc(cos(alfa)*t+x+1),Trunc(sin(alfa)*t+y+1)]=h
        endif
 
     
next alfa
next t
endfunction
 
function holm1(x,y)
for t=1 to 18
for alfa=0 to 360
     
        h= map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y)]
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y)]=h
        if h>=50-18+t
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y)]=50-18+t
        map[Trunc(cos(alfa)*t+x+1),Trunc(sin(alfa)*t+y)]=50-18+t
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y+1)]=50-18+t
        map[Trunc(cos(alfa)*t+x+1),Trunc(sin(alfa)*t+y+1)]=50-18+t
        elseif h<50-18+t
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y)]=h
        map[Trunc(cos(alfa)*t+x+1),Trunc(sin(alfa)*t+y)]=h
        map[Trunc(cos(alfa)*t+x),Trunc(sin(alfa)*t+y+1)]=h
        map[Trunc(cos(alfa)*t+x+1),Trunc(sin(alfa)*t+y+1)]=h
        endif
 
     
next alfa
next t
endfunction


a full screen is required for my idea.
As indicated in the program.
But here's the problem: it doesn't save the picture.
The point is that the command GetImage(1,0,0,15,15) doesn't work.
Posted: 3rd Jul 2021 19:22
Works fine. Your image is saved in \AppData\Local\AGKApps\[yourappname]
Posted: 4th Jul 2021 4:02
dont work.
file emty!!!

1) you check the command in the code that I indicated and you will see that the command does not work!

2)I made a mistake when I created the topic. The topic is relevant for app game kit classic
Posted: 4th Jul 2021 4:35
thread moved (again - check your PMs).

meanwhile, similar code from ~a year ago worked for you. have you tried that to confirm?

i know Get/SaveImage() works so what might you be doing different now than you did before? (i'm still not willing to wait for generation of 100's of thousands of boxes to test your code ).
Posted: 4th Jul 2021 6:10
The command works if you run the screen scan in normal mode. If you run it in full screen and so that there are no stripes on wide monitors, then it does not work and makes a transparent capture of the picture. How to be? For example, it @#?# me off when I make a full screen and on a wide monitor there are black stripes on the sides. It's not beautiful.

Thank you so much for moving my message.
The program is short and takes a short period of time.
If you are let down by a huge number of drawing boxes, then you can draw only one. This does not change the essence.
The reason for choosing the screen size.

I saw your link and did not change the last post. vsmysle did not change the pictures to empty.
I was going to make a texture generator for the planet from sprites, but nothing comes of it. I do not understand why the picture is not taken from the screen.
Posted: 4th Jul 2021 8:00
this code:
+ Code Snippet
a=GetMaxDeviceWidth()
b=GetMaxDeviceHeight()
SetWindowSize( a, b, 1 )

// set display properties
SetVirtualResolution( a, b )
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) 
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 )

Red = MakeColor(255,0,0)
DrawBox(0,0,31,31,Red,Red,Red,Red,0)
Render()
SaveImage(GetImage(0,0,32,32), "temp.png")
SetSpritePosition(CreateSprite(LoadImage("temp.png")),100,100)

repeat

print(STR(a) + "x" + STR(b))
Sync()
until GetPointerPressed()

OpenBrowser(GetWritePath()+"/media")

produces this image:

when I make a full screen and on a wide monitor
how wide? do you have multiple monitors?

and, why all the Update(), Render(), Update() in your code?
i usually only do Render() once after all Draw()s.

then:
+ Code Snippet
a=GetMaxDeviceWidth()
b=GetMaxDeviceHeight()
SetWindowSize( a, b, 1 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
  
// set display properties
SetVirtualResolution( a, b ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
  
  
 SetWindowSize( 1024, 768, 1 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
  
// set display properties
SetVirtualResolution( 1024, 768)

why? when you offer code like this and ask for help with it, it's not very inviting.
i think its best to provide short, clean code when trying to demonstrate something while asking for help.

good luck with this, otherwise.
Posted: 4th Jul 2021 9:08
+ Code Snippet
// Project: testsystem 
// Created: 2021-07-03

// Project: generated map 
// Created: 2020-08-27
 
// show all errors
SetErrorMode(2)
 
// set window properties
SetWindowTitle( "generated map" )
a=GetMaxDeviceWidth()
b=GetMaxDeviceHeight()
SetWindowSize( a, b, 1 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
 
// set display properties
SetVirtualResolution( a, b ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
 
`Red = MakeColor(255,0,0)
`DrawBox(0,0,640,480,Red,Red,Red,Red,1)
`Render()
t=1
tt=1
for x=0 to 640/64
	for y=0 to 480/64
		Loadimage(t,str(trunc(random(0.6,3.4)))+".png")
		CreateSprite(tt, t ) 
		SetSpritePosition( tt, x*64, y*64 ) 
	t=t+1
	tt=tt+1
	next y
next x
t=t+1
GetImage(t, 0, 0, 640, 480 )
CreateObjectSphere( t,100, 100, 100 )
SetObjectImage( t, t, 0 )   
for y=1 to 500
`	`DrawBox(0,0,640,480,Red,Red,Red,Red,1)
	RotateObjectLocalY( t, 1 ) 
	sync()
next y
SaveImage(t,"temp.png")
end

emty image
Posted: 4th Jul 2021 16:08
After you create the sprite and before you get the image, should you render??
Posted: 4th Jul 2021 16:10
you never Render()
add it just before GetImage(t, 0, 0, 640, 480 ):
Posted: 5th Jul 2021 0:24
well you are right.