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.

DarkBASIC Professional Discussion / Paste only part of an image

Author
Message
SJPro
23
Years of Service
User Offline
Joined: 3rd Jul 2003
Location:
Posted: 26th Jun 2011 03:21
I have an image held in memory and I would like to only paste part of it to screen.

I see there is a get image command, but unfortunately this only works from bitmaps. The only way I have figured to do it to open a new bitmap, paste the image, capture the part I want and then close the bitmap.

I was just wondering if anyone knew a more efficient way of doing this. Also it has to be done dynamically due to the number of possible combinations so the images cannot be pre-rendered.

Thanks

www.freewarehub.net
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 26th Jun 2011 03:56
You can load bitmap , get image and delete bitmap without render to screen...is that what you want ?


Cheers.

I'm not a grumpy grandpa
SJPro
23
Years of Service
User Offline
Joined: 3rd Jul 2003
Location:
Posted: 26th Jun 2011 04:18
Well apart I would paste the image from memory not load the bitmap from disk it's the method I've described above. I'm sure with what I am doing speed wise this should be fine. Just it seems a really inefficient way of doing it.

www.freewarehub.net
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th Jun 2011 04:25
You can use Sven B's Image Kit. The command IK COPY IMAGE will allow you to use a box to copy only the area you want from the image. His commands have a lot of cool image effects and useful things like IK RESIZE IMAGE.

http://forum.thegamecreators.com/?m=forum_view&t=158832&b=8

GIDustin
18
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 26th Jun 2011 04:36
Is the part of the image that you are pasting going to remain the same for a somewhat extended period of time? If so, use IK to create a new image from the old one and paste that.

If the part that you are pasting is constantly changing, like almost every loop, the IK method may not be your best option and I would use my modified D3D_func with viewports. If that is the way you want to go I can provide help on how to use it.

SJPro
23
Years of Service
User Offline
Joined: 3rd Jul 2003
Location:
Posted: 26th Jun 2011 04:49
Thanks for the replies. I'll see how IK performs and if it is not quite fast enough I may take you on your kind offer GIDustin.

Thanks for the help everyone.

www.freewarehub.net
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 26th Jun 2011 20:22
I always put the image into a memblock, and depending on the dimensions, have code that cut out the section you want, put them into a separate memblock, and load that into an image, and paste it to the screen.

With the right math, I've cut out stars, circles, ellipses, and even irregular shapes!

Login to post a reply

Server time is: 2026-07-10 13:44:38
Your offset time is: 2026-07-10 13:44:38