void BitmapImage::Init(void) { bIsAnimatedGif = false; if(lpGifData) { Free(lpGifData); lpGifData = NULL; } animationTimes.Clear(); delete texture; texture = NULL; CTSTR lpBitmap = filePath; if(!lpBitmap || !*lpBitmap) { Log::writeError(LOG_RTSPSERV, 1, "BitmapImage::Init: Empty path"); CreateErrorTexture(); return; } if(!bIsAnimatedGif) { UINT Width, Height; texture = CreateTextureFromFile(lpBitmap, TRUE, Width, Height); if(!texture) { Log::writeError(LOG_RTSPSERV,1,"BitmapImage::Init: could not create texture '%s'", WcharToAnsi(lpBitmap).c_str()); CreateErrorTexture(); return; } fullSize.x = Width; fullSize.y = Height; } }
void UpdateSettings() { for(UINT i=0; i<textures.Num(); i++) delete textures[i]; textures.Clear(); //------------------------------------ bool bFirst = true; StringList bitmapList; data->GetStringList(TEXT("bitmap"), bitmapList); for(UINT i=0; i<bitmapList.Num(); i++) { String &strBitmap = bitmapList[i]; if(strBitmap.IsEmpty()) { AppWarning(TEXT("BitmapTransitionSource::UpdateSettings: Empty path")); continue; } Texture *texture = GS->CreateTextureFromFile(strBitmap, TRUE); if(!texture) { AppWarning(TEXT("BitmapTransitionSource::UpdateSettings: could not create texture '%s'"), strBitmap.Array()); continue; } if(bFirst) { fullSize.x = float(texture->Width()); fullSize.y = float(texture->Height()); baseAspect = double(fullSize.x)/double(fullSize.y); bFirst = false; } textures << texture; } if(textures.Num() == 0) CreateErrorTexture(); //------------------------------------ transitionTime = data->GetFloat(TEXT("transitionTime")); if(transitionTime < MIN_TRANSITION_TIME) transitionTime = MIN_TRANSITION_TIME; else if(transitionTime > MAX_TRANSITION_TIME) transitionTime = MAX_TRANSITION_TIME; //------------------------------------ bFadeInOnly = data->GetInt(TEXT("fadeInOnly")) != 0; bDisableFading = data->GetInt(TEXT("disableFading")) != 0; bRandomize = data->GetInt(TEXT("randomize")) != 0; //------------------------------------ curTransitionTime = 0.0f; curTexture = 0; if(bRandomize) { srand( (unsigned)time( NULL ) ); if(textures.Num() > 1) { curTexture = lrand(textures.Num()); while((nextTexture = lrand(textures.Num())) == curTexture); } } else nextTexture = (curTexture == textures.Num()-1) ? 0 : curTexture+1; bTransitioning = false; curFadeValue = 0.0f; }