コード例 #1
0
//
// DESCRIPTION:
// Load the contents of this image file into an MImage. A real
// file format plugin would extract the pixel data from the image
// file here.
//
///////////////////////////////////////////////////////
MStatus SimpleImageFile::load( MImage& image, unsigned int)
{
	unsigned int w = 512;
	unsigned int h = 512;

	// Create a floating point image and fill it with
	// a pretty rainbow test image.
	//
	image.create( w, h, 3, MImage::kFloat);
	populateTestImage( image.floatPixels(), w, h);
	return MS::kSuccess;
}
コード例 #2
0
ファイル: ImageFile.cpp プロジェクト: AtomicFiction/cortex
MStatus ImageFile::load( MImage& image, unsigned int idx )
{
	MStatus s;

	assert( idx == 0 );
	assert( m_rData	);
	assert( m_gData	);
	assert( m_bData	);

	s = image.create( m_width, m_height, m_numChannels, MImage::kFloat );
	assert(s);

	image.setRGBA( true );

	populateImage( image.floatPixels() );

	return MS::kSuccess;
}
コード例 #3
0
void mtap_SwatchRendererInterface::fillDummySwatch(MImage& image)
{
	const int res(swatchWidth);
	float rndR = rnd();
	float rndG = rnd();
	float rndB = rnd();

	float *pixels = image.floatPixels();
	int index = 0;
	for (int y = 0; y < res; y++)
	{
		for (int x = 0; x < res; x++)
		{
			float fac = float(y) / res;
			pixels[index++] = fac * rndR;
			pixels[index++] = fac * rndG;
			pixels[index++] = fac * rndB;
			pixels[index++] = 1.0f;
		}
	}
}
コード例 #4
0
ファイル: tiffFloatReader.cpp プロジェクト: DimondTheCat/xray
//
// DESCRIPTION:
//		Load the image into system memory (MImage)
///////////////////////////////////////////////////////
MStatus tiffFloatReader::load( MImage& image, unsigned int imageNumber)
{
	MStatus rval = MS::kFailure;
#if defined(_TIFF_LIBRARY_AVAILABLE_)
	if (!fInputFile)
		return rval;

	// Configure our Maya image to hold the result
	image.create( fWidth, fHeight, fChannels, MImage::kFloat);
	float* outputBuffer = image.floatPixels();
	if (outputBuffer == NULL)
		return rval;
	
	// Maya expects images upside down
	unsigned int row = 0;
	bool flipVertically = true;
	if (flipVertically)
	{
		outputBuffer += (fHeight-1) * (fWidth * fChannels);
		for (row = 0; row < fHeight; row++)
		{
			TIFFReadScanline (fInputFile, outputBuffer, row);
			outputBuffer -= (fWidth * fChannels);
		}
	}
	else
	{
		for (row = 0; row < fHeight; row++)
		{
			TIFFReadScanline (fInputFile, outputBuffer, row);
			outputBuffer += (fWidth * fChannels);
		}
	}
	rval = MS::kSuccess;
#endif
	return rval;
}