Exemple #1
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);

	}
	
}
Exemple #2
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);
        }
    }
}