About Store Forum Documentation Contact



Post Reply 
EE::Image
Author Message
Rubeus Offline
Member

Post: #1
EE::Image
Hello~

I have a couple questions regarding the Image class. I'm doing some work with some modified images, but I can't figure a couple things out:

1) What is d? The comments mention depth, but I'm not sure what that means for a 2D image. It doesn't look to be the color depth, as that looks like it's set using the IMAGE_TYPE settings.

2) The Image::Crop function asks for x, y, z, w, h, and d. I figured x and y were the location of the top left corner of a rectangle h high and w wide designating the area to copy to dest, but I haven't been able to get anything but a transparent texture from it, unless I'm copying an entire image.

3) I've been attempting to use Image::color or the pixX() methods to modify the color of some of the pixels in the image, but again, it doesn't seem to make any difference. My best guess is that the pix and color functions are specific to certain IMAGE_TYPES or _MODES. Can IMAGE_2D be modified? How does one properly modify an image?

4) I would like to take a dynamically created image- specifically one stitched together from other existing images- and add it to the Images cache. I have not been able to find a way to do this, aside from(the less than optimal) saving to the hard drive then loading-but even this fails:
myImage.ExportTGA( "tex.tga" );
image_ptr = Images.ptrRequire( "tex.tga" );
This gives me an "Unable to load" error. The exported texture is created, though. Possibly because it's trying to load it before it's finished writing to the hard drive? Either way, I would like to be able to add an asset directly to the cache to be used by UID like images in the editor. Is this possible?

Thanks~
02-16-2014 08:52 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: EE::Image
Hello!

1) it's used for 3D volumetric textures (other modes have depth = 1)

2) please set z to 0, and d to 1, let me know if that fixed it smile

3) You need to call the lock() and the modify the pixels, and then call the unlock method.
Please see "graphics/dynamic image" tutorial

4) you could set CACHE_MODE to "always dummy", CACHE_MODE old=Images.mode(..)
then grab the pointer
ImagePtr img="test";
restore cache mode - Images.mode(old);
edit your image "img-> .."
02-17-2014 06:25 AM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #3
RE: EE::Image
Took a little futzing around, but I got it all working. smile

Setting z to 0 and d to 1 fixed the crop method, but I ended up making custom code to do it so I could choose where the cropped image was copied to in the destination image.

Thank you
02-17-2014 10:18 PM
Find all posts by this user Quote this message in a reply
Post Reply