PDA

View Full Version : Bitmap Icon NO.# to imageTag ?


cyfer
05-02-2010, 11:33 PM
I can't find a way to assign one of the icons in max BitmapFiles to imageTag control .
what i mean here is like the image buttons where you define the image as
images:#(theBitmap, theBitmapMask , etc)
is there any way or workaround to do that without explicit Read\Write pixels from max Bitmap Files ?

JHN
05-04-2010, 01:08 PM
I don't think there's anyway around it, you need get/setpixels to a temporary file an use that in the imagelist. If someone knows how to stream a maxscript bitmap value into a dotnet value, I'd like to hear!

-Johan

denisT
05-04-2010, 04:33 PM
I can't find a way to assign one of the icons in max BitmapFiles to imageTag control .
what i mean here is like the image buttons where you define the image as
images:#(theBitmap, theBitmapMask , etc)
is there any way or workaround to do that without explicit Read\Write pixels from max Bitmap Files ?

Sorry, but I don't understand the problem. What control do you want to assign the icon to? Is it max ImgTag control or anything else? What the icon file is? Is it standard .ICO format file?

cyfer
05-04-2010, 11:30 PM
JHN

I wish there is someway , the imgtag control eventHandlers are great
i'm that close to make a flyout "like those in Align\pivot controls in the main menu"
now making separate imagefile for each Control while those images do exist in max icons directory is a shame .

denisT

hello denis , please excuse my poor description .. i tend to use image/icon/bitmap interchangeably

the problem goes like this

1-in max\icons folder you have Bitmap files (.BMP) and each one contains separate imageFiles
2-you can use these files and assign any (icon\image) they contain to an imageButton for example
3-I can't find a way to do that for imgTag control

the only option i can find is to open the file ... copy the desired pixels and then assign them to the Bitmap parameter of the imgTag control .

i'm looking for a way to avoid that and assign them on the fly .. just like you do with the imageButton control

denisT
05-05-2010, 01:17 AM
the problem goes like this

1-in max\icons folder you have Bitmap files (.BMP) and each one contains separate imageFiles
2-you can use these files and assign any (icon\image) they contain to an imageButton for example
3-I can't find a way to do that for imgTag control

the only option i can find is to open the file ... copy the desired pixels and then assign them to the Bitmap parameter of the imgTag control .

i'm looking for a way to avoid that and assign them on the fly .. just like you do with the imageButton control

That's clear now but I have to disappoint you. There is no way to read bitmap file and directly assign bitmap value to imgTag control by index. So you have to copy pixels to an opened bitmap. But imgTag doesn't need a file, it needs bitmap value. So you can read the bitmap file and make all necessary bitmaps at ones. I do it this way for standard max and my own bmp collections. Don't worry. It's fast enough.

JHN
05-05-2010, 07:11 AM
That's clear now but I have to disappoint you. There is no way to read bitmap file and directly assign bitmap value to imgTag control by index. So you have to copy pixels to an opened bitmap. But imgTag doesn't need a file, it needs bitmap value. So you can read the bitmap file and make all necessary bitmaps at ones. I do it this way for standard max and my own bmp collections. Don't worry. It's fast enough.

Denis, can you directly assign a bitmap value to a dotnet img? I'm using .loadFromBitmap(filename) (don't know the exact syntax right now) and am temporary saving the maxscript bitmap to disk. If I can directly pass on the mxs bitmap value that would be great!

Thanks,
-Johan

denisT
05-05-2010, 03:12 PM
Denis, can you directly assign a bitmap value to a dotnet img? I'm using .loadFromBitmap(filename) (don't know the exact syntax right now) and am temporary saving the maxscript bitmap to disk. If I can directly pass on the mxs bitmap value that would be great!

Thanks,
-Johan

use Clipboard. You can put max bitmap in Window's Clipboard (setclipboardBitmap) and assign .net clipboard as .net image.
c#

IDataObject data = Clipboard.GetDataObject();
Image image = (Image)data.GetData(DataFormats.Bitmap,true);

that's easy to write it in MXS

added:

fn bitmapToDotnet bmp = if iskindof bmp Bitmap do
(
setclipboardBitmap bmp
format = dotnetclass "DataFormats"
data = (dotnetclass "Clipboard").GetDataObject()
if (data.GetDataPresent format.Bitmap) do data.GetData format.Bitmap on
)

JHN
05-05-2010, 03:54 PM
that's easy to write it in MXS

It is, and that's just a great idea! Been wrecking my brain over that one!

Thanks!
-Johan

denisT
05-05-2010, 03:56 PM
i added mxs function. see above.

JHN
05-05-2010, 05:49 PM
Thanks! :thumbsup:

-Johan

CGTalk Moderation
05-05-2010, 05:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.