示例#1
0
VisualImage* VisualImage::createWithFramebuffer(const BottomLeftPositionedPixelRect& clipRect) {
	VisualImage* anImage = new VisualImage;
	bool success = anImage->initWithFramebuffer(clipRect);
	if (!success) {
		delete anImage;
		anImage = NULL;
	}
	return anImage;
}
示例#2
0
VisualImage* VisualImage::createWithStyledString(VisualStyledString& styledString) {
	VisualImage* anImage = new VisualImage;
	bool success = anImage->initWithStyledString(styledString);
	if (!success) {
		delete anImage;
		anImage = NULL;
	}
	return anImage;
}
示例#3
0
VisualImage* VisualImage::createWithURL(VisualString& anURL, VisualItemIdentifier& anId) {
	VisualImage* anImage = new VisualImage;
	bool success = anImage->initWithURL(anURL, anId);
	if (!success) {
		delete anImage;
		anImage = NULL;
	}
	return anImage;
}
示例#4
0
VisualImage* VisualImage::createWithEncodedData(const char* const bufferData, uint32 size) {
	VisualImage* anImage = new VisualImage;
	bool success = anImage->initWithEncodedData(bufferData, size);
	if (!success) {
		delete anImage;
		anImage = NULL;
	}
	return anImage;
}
示例#5
0
VisualImage* VisualImage::createWithARGBPixelData(PixelColor* argbPixels, uint32 width, uint32 height) {
	VisualImage* anImage = new VisualImage;
	bool success = anImage->initWithARGBPixelData(argbPixels, width, height);
	if (!success) {
		delete anImage;
		anImage = NULL;
	}
	return anImage;
}
示例#6
0
VisualImage* VisualImage::createWithFile(VisualFile& aFile) {
	VisualImage* anImage = new VisualImage;
	bool success = anImage->initWithFile(aFile);
	if (!success) {
		delete anImage;
		anImage = NULL;
	}
	return anImage;
}
示例#7
0
void Beatlight::addSpotlightImage() {

	VisualImage spotlightImage;
	spotlightImage.initWithResource(SPOTPNG);

/*
	VisualFile* inputFile = VisualFile::createWithUserDesktopDirectory();
	VisualString inputFileName = VisualString("spot.png");
	inputFile->appendFileName(inputFileName);
	//spotlightImage.initWithFile(*inputFile);
	spotlightImage.initWithContentsOfFile(*inputFile);
	delete(inputFile);
*/

	//VisualString url("http://www.imagomat.de/images/coverversion/screen_mac.png");
	//VisualImage* spotlightImage = VisualImage::createWithURL(url);
	
	if (!spotlightImage.isEmpty()) {
		
		this->beatlightAsset.setImage(spotlightImage);

		VisualStageBox* beatlightAssetBox = this->beatlightAsset.getBox();
		beatlightAssetBox->setContentPixelWidth(spotlightImage.getWidth());
		beatlightAssetBox->setContentPixelHeight(spotlightImage.getHeight());

/*
		VisualFile outputFile;
		outputFile.initWithUserDesktopDirectory();
		VisualString aFileName = VisualString("vizKitBeatlightImage.png");
		outputFile.appendFileName(aFileName);

		OSStatus status = spotlightImage.writeToFile(outputFile);
		if (status != noErr) {
			printf("err %ld in Beatlight::addSpotlightImage()\n", status);
		}
*/

		this->calcPositionOnScreen();

		VisualAnimation pulsateAnimation(kAnimatedOpacity);
		UInt32 durationInMilliseconds = 550;
		pulsateAnimation.setDurationInMilliseconds(durationInMilliseconds);
		pulsateAnimation.setLoopMode(kMirroredLoop, kInfiniteRepetition);
		this->beatlightAsset.addAnimation(pulsateAnimation);

	}
	
}
示例#8
0
void CoverArt::makeImageOfCover()
{
    if (VisualDataStore::getNumberOfCoverArtworksOfCurrentTrack() > 0) {

        VisualImage* coverArtImage = VisualActorGraphics::createCoverArtImage();

        /*
        		VisualImage* coverArtImage = new VisualImage;
        		VisualFile* inputFile = VisualFile::createWithUserDesktopDirectory();
        		VisualString inputFileName = VisualString("spot.png");
        		inputFile->appendFileName(inputFileName);
        		coverArtImage->initWithFile(*inputFile);
        		delete(inputFile);
        */

        //VisualString url("http://www.imagomat.de/images/coverversion/screen_mac.png");
        //VisualImage* coverArtImage = VisualImage::createWithURL(url);

        if (coverArtImage != NULL) {

            //VisualConvolutionFilter aConvolutionFilter(VisualConvolutionFilter::kEmboss);
            //coverArtImage->applyConvolutionFilter(aConvolutionFilter);

            /*
            			VisualFile outputFile;
            			outputFile.initWithUserDesktopDirectory();
            			VisualString aFileName = VisualString("vizKitCoverArtImage.png");
            			outputFile.appendFileName(aFileName);

            			OSStatus status = coverArtImage->writeToFile(outputFile);
            			if (status != noErr) {
            				printf("err %ld in CoverArt::makeImageOfCover()\n", status);
            			}
            */

            this->coverArtAsset.setImage(*coverArtImage);

            VisualStageBox* coverArtAssetBox = this->coverArtAsset.getBox();
            coverArtAssetBox->setContentPixelWidth(coverArtImage->getWidth());
            coverArtAssetBox->setContentPixelHeight(coverArtImage->getHeight());
            VisualActorGraphics::releaseCoverArtImage(&coverArtImage);
        }
    }
}
示例#9
0
void VisualImage::getRGBHistogramInputPixels(std::vector<PixelColor>& inputValues) const {
	
	VisualImage* histogramImage = this->cloneIndependently();
	
	uint32 maxEdgeLength = 32;
	PixelRect pixelRect;
	if (this->getWidth() > this->getHeight()) {
		pixelRect.height = maxEdgeLength;
		pixelRect.width = (uint32)((double)pixelRect.height * ((double)this->getWidth() / (double)this->getHeight()));
	} else if (this->getWidth() < this->getHeight()) {
		pixelRect.width = maxEdgeLength;
		pixelRect.height = (uint32)((double)pixelRect.width * ((double)this->getHeight() / (double)this->getWidth()));
	} else {
		pixelRect.width = maxEdgeLength;
		pixelRect.height = maxEdgeLength;
	}
	
	histogramImage->resample(pixelRect);
	
	VisualTextureContainer* histogramTextureContainer = histogramImage->getTextureContainer();
	
	PixelColor* pixels = histogramTextureContainer->createARGBImagePixels();
	
	uint32 numberOfValues = histogramTextureContainer->getImageWidth() * histogramTextureContainer->getImageHeight();
	
	uint8 r, g, b, a;
	PixelColor posterizedPixelColor;
	for (uint32 i = 0; i < numberOfValues; i++) {
		VisualColorTools::convertARGBPixelToRGB(pixels[i]);
		VisualColorTools::getColorComponentValues(pixels[i], a, r, g, b);
		r = r & 0xfc;
		g = g & 0xfc;
		b = b & 0xfc;
		posterizedPixelColor = VisualColorTools::getPixelColor(a, r, g, b);
		inputValues.push_back(posterizedPixelColor);
	}
	free(pixels);
	
	delete histogramImage;
	
}
示例#10
0
void TrackTitle::setTrackInfoImage(VisualImage& styledTrackInfoStringImage) {
	this->clear();
	VisualConvolutionFilter aConvolutionFilter(VisualConvolutionFilter::kBlur);
	styledTrackInfoStringImage.applyConvolutionFilter(aConvolutionFilter);
	//styledTrackInfoStringImage.setBlendMode(kReplace);
	this->trackInfoAsset.setImage(styledTrackInfoStringImage);
/*
	VisualFile aFile;
	aFile.initWithUserDesktopDirectory();
	VisualString fileName("testTrackInfo.png");
	bool success = false;
	success = aFile.appendFileName(fileName);
	styledTrackInfoStringImage.writeToPNGFile(aFile);
*/
}