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 / Syncaidius memblock image manipulation library

Author
Message
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 25th Sep 2012 13:18
Ive discovered Syncaidius memblock image library in the snippets section: http://forum.thegamecreators.com/?m=forum_view&t=172059&b=6

I'm trying to make a program that makes a sequence of small images on a trail (64x64 for AGK) from a large image while keeping the png transparencies intact. So I can animate them later.

the function //create a red 512x512 empty texture
memblock = IMG_MAKE(512, 512, IMG_RGBA(255,0,0,255))

Could someone please tell me what the 4th number in IMG_RGBA(255,0,0,255) is doing?
I take it the first three numbers are red, green, blue, but why the last 255?


in his code here is the function:


btw I had to comment out the function IMG_GREYSCALE(mem as byte) because it kicks out an error.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 25th Sep 2012 13:25
Red
Green
Blue
Alpha

A clue there?

hope that helps...

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 25th Sep 2012 13:32 Edited at: 25th Sep 2012 13:33
A = Alpha

Alpha controls the transparency of the final image.

Edit: MrValentine beat me!

What I'd like to know is what this part is doing:

width = (0<<24) + (0<<16) + (0<<8) + width
height = (0<<24) + (0<<16) + (0<<8) + height
depth = (0<<24) + (0<<16) + (0<<8) + 32


Since there's no difference to this:

width = width
height = height
depth = 32


And since we pass the width and height to the function we only need:

depth = 32
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 25th Sep 2012 13:44
hmmm Thanks!

Seems its ignoring my transparent image and changing the alpha setting from 255 is not making a difference.

This might have something to do with the 8 bit png?
I'll mess around some more...
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 25th Sep 2012 14:12 Edited at: 25th Sep 2012 14:14
Is it possible to turn the image directly into a memblock so the original image is not filled with a predefined color?

Maybe it will keep the alpha channel intact

I tried using make memblock from image but the function kicks out an error.


Edit: no I tried changing the image from 8 bit and I also tried changing the screen depth settings in dbpro and its ignoring the transparencies.

-------

Anyone know a plugin or set of functions that can cut out a section from a png image with transparencies then paste it into a new image with transparency intact so it can be saved? (once you start pasting images to the screen and copying them out the png transparencies are ruined.)
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 25th Sep 2012 14:36
Image Kit by Sven B is probably what you're looking for, just search these forums for it... Plus I've just recently written a function that pastes really fast any size image to another using alpha blending without needing memblocks, but so far it's only really the one function and I've not got the time to even consider competing with a fully working and excellent plugin like Image Kit...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 25th Sep 2012 15:07 Edited at: 25th Sep 2012 15:08
Wrote a small function:



Requires Matrix1 Utils. If you don't have that installed, replace this function:


With this:

And add this at the bottom of your code:


But yeah, you should use Image Kit, it's a lot faster.

TheComet

"Why geeks like computers: unzip, strip, touch, finger, grep, mount, fsck, more, yes, fsck, fsck, fsck, umount, sleep." - Unknown
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 25th Sep 2012 15:11
Thanx! WLGfx and Comet!!

Sheesh; looked everywhere, guess its good to ask sometimes.
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 26th Sep 2012 13:33
Works like a sweet charm Comet!

Thanks!

best for what I need right now...

Login to post a reply

Server time is: 2026-07-08 15:54:57
Your offset time is: 2026-07-08 15:54:57