Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / ScreenWidth and ScreenHeight

Author
Message
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 18th Mar 2007 19:56
I'm using this code to grab a screenshot



But the picture is 1024 x 1024 when taken. Strange.... But as seen in top left corner it says 1024 x 768, but GetImage takes 1024 x 1024??

Niels Henriksen
Working on a (MMO)RPG right now in DarkEngine
http://yourmmo.wikispaces.com/

Attachments

Login to view attachments
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 18th Mar 2007 22:05
It may be that the image is stored as a texture or at least a texture surface, and these image sizes may comply with the rule where by texture sizes must be of a power of 2. So 512x512, 1024x1024 etc. The image may be resizing to the nearest power from 768. You could prove the rule by creating an image of 640z480 and see if it gets rounded to 512x512.... possibly.

Paul.


Abundance = Choice = Freedom - Scarcity = Dependancy = Control, Truth!
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 18th Mar 2007 23:00
I was trying now to set width x height to 200x100 and 604x480. First it created a picutre on 256x128 and second time it was 1024x512.

I dont understand this... because Im taking the picture and then saving it at once. After that I destroy it. I dont say to it that it has to use it as a texture.

But.... if I convert the sub to DarkEngine



I have in the DarkImage constructor option to set Textureflag. When that is 1 then it saves in the right size....

uhmm... I love DarkEngine

Niels Henriksen
Working on a (MMO)RPG right now in DarkEngine
http://yourmmo.wikispaces.com/
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 19th Mar 2007 13:43
Quote: "GET IMAGE

This command will copy a selected area of the current bitmap. Amongst other things, you can use this
command to store sequences of image data and provide animations for sprites. When images are grabbed,
they are stored in memory and do not require the bitmap from which the image was taken. The parameters
should be specified using integer values. You cannot grab an image while the target pixels are being locked
by the LOCK PIXELS command, as it is not possible to read from a surface that is using the fast write only
lock method on the pixels. Use the following texture flags:

0-use stretching, filter, colorkey
1-no stretching, no filter, colorkey
2-use stretching, no filter, no colorkey (grab from alpha bitmap retain alpha channel)
3-no stretching, no filter, no colorkey (grab from alpha bitmap retain alpha channel)

Syntax

GET IMAGE Image Number, Left, Top, Right, Bottom
GET IMAGE Image Number, Left, Top, Right, Bottom, Texture Flag"


Straight from the help files. Change the texture flag and you should get what you need.

James Bondo
18
Years of Service
User Offline
Joined: 12th Nov 2006
Location: Denmark
Posted: 19th Mar 2007 14:23
Thats the help files from DarkBASIC Pro yes, help files from DGDK.NET:

Quote: "Sub GetImageB(lID As Long, lX1 As Long, lY1 As Long, lX2 As Long, lY2 As Long, lTextureFlag As Long)

Method description

This command will copy a selected area of the current bitmap. Amongst other things, you can use this command to store sequences of image data and provide animations for sprites. When images are grabbed, they are stored in memory and do not require the bitmap from which the image was taken. The parameters should be specified using integer values. A texture flag of one will grab a pure image and not stretch and filter the image for texture usage. If the image is to be used as a texture, a texture flag of zero should be used."


Using Dark GDK.NET
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 19th Mar 2007 17:49
Ahaaa... it was GetImageB I was missing.. but because Im using DarkEngine I dont need to think about GetImage or GetImageB

Niels Henriksen
Working on a (MMO)RPG right now in DarkEngine
http://yourmmo.wikispaces.com/
kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 20th Mar 2007 04:58
Yeah, I'm sorry to say this but having FunctionA, FunctionB,...,FunctionX is a real PAIN! But that was solved on DarkEngine with Method Overloading.

Oh my God! I love OOP!

Login to post a reply

Server time is: 2024-11-19 12:17:30
Your offset time is: 2024-11-19 12:17:30