LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, LLHost request_from_host) { // Return the image with ID image_id // If the image is not found, creates new image and // enqueues a request for transmission if ((&image_id == NULL) || image_id.isNull()) { return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLViewerTexture::BOOST_UI)); } LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id); if (imagep.isNull()) { imagep = createImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; } imagep->setGLTextureCreated(true); return imagep; }
/* Loads a texture from the provided .png or .bmp file @param texturePath Path to the texture to be loaded @param printErr True if errors should be printed when an error is detected @note the SDL_Surface must be freed using SDL_FreeSurface() */ SDL_Surface *Texture::readImage(const char *texturePath, bool printErr){ SDL_Surface *image = findImage(texturePath); if (!image) { if (printErr) fprintf(stderr, "%s\n", IMG_GetError()); } else if (image->format->BytesPerPixel != 3 && image->format->BytesPerPixel != 4) { if (printErr) fprintf(stderr, "'%s': Textures must be RGB or RGBA with 8 bits per colour.\n", texturePath); SDL_FreeSurface(image); return 0; } else if (image->format->Rshift>image->format->Bshift) { //If the teture is BGR order rathern than RGB order, switch bytes SDL_PixelFormat desiredFormat; memcpy(&desiredFormat, image->format, sizeof(SDL_PixelFormat)); desiredFormat.Bloss = image->format->Rloss; desiredFormat.Bmask = image->format->Rmask; desiredFormat.Bshift = image->format->Rshift; desiredFormat.Rloss = image->format->Bloss; desiredFormat.Rmask = image->format->Bmask; desiredFormat.Rshift = image->format->Bshift; if (image->format->BytesPerPixel == 3) desiredFormat.format = SDL_PIXELFORMAT_RGB888; else desiredFormat.format = SDL_PIXELFORMAT_RGBA8888; SDL_Surface* old = image; image = SDL_ConvertSurface(old, &desiredFormat, 0); SDL_FreeSurface(old); } return image; }
void LBGraphics::copyOffsetAnimImageToScreen(uint16 image, int left, int top) { MohawkSurface *mhkSurface = findImage(image); left -= mhkSurface->getOffsetX(); top -= mhkSurface->getOffsetY(); GraphicsManager::copyAnimImageToScreen(image, left, top); }
void ImageManager::render(std::string key, HDC hdc, float destX, float destY, int sourX, int sourY, int width, int height, BYTE alpha) { Image *image = findImage(key); if (image) { image->render(hdc, destX, destY, sourX, sourY, width, height, alpha); } }
void ImageManager::render(std::string key, HDC hdc, float destX, float destY, BYTE alpha) { Image *image = findImage(key); if (image) { image->render(hdc, destX, destY, alpha); } }
boost::intrusive_ptr<DefinitionImage> DefinitionShape::findImage(int Id) { if (getDataInfo()) { auto info = fla::ptr_case<FlaDataInfoWithImages>(getDataInfo()); return info->findImage(Id); } return boost::intrusive_ptr<DefinitionImage>(); }
LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& url, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, const LLUUID& force_id) { // generate UUID based on hash of filename LLUUID new_id; if (force_id.notNull()) { new_id = force_id; } else { new_id.generate(url); } LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id); if (imagep.isNull()) { switch(texture_type) { case LLViewerTexture::FETCHED_TEXTURE: imagep = new LLViewerFetchedTexture(url, new_id, usemipmaps); break ; case LLViewerTexture::LOD_TEXTURE: imagep = new LLViewerLODTexture(url, new_id, usemipmaps); break ; default: llerrs << "Invalid texture type " << texture_type << llendl ; } if (internal_format && primary_format) { imagep->setExplicitFormat(internal_format, primary_format); } addImage(imagep); if (boost_priority != 0) { if (boost_priority == LLViewerFetchedTexture::BOOST_UI || boost_priority == LLViewerFetchedTexture::BOOST_ICON) { imagep->dontDiscard(); } imagep->setBoostLevel(boost_priority); } } imagep->setGLTextureCreated(true); return imagep; }
void RivenGraphics::drawImageRect(uint16 id, Common::Rect srcRect, Common::Rect dstRect) { // Draw tBMP id from srcRect to dstRect Graphics::Surface *surface = findImage(id)->getSurface(); assert(srcRect.width() == dstRect.width() && srcRect.height() == dstRect.height()); for (uint16 i = 0; i < srcRect.height(); i++) memcpy(_mainScreen->getBasePtr(dstRect.left, i + dstRect.top), surface->getBasePtr(srcRect.left, i + srcRect.top), srcRect.width() * surface->format.bytesPerPixel); _dirtyScreen = true; }
void RivenGraphics::copyImageToScreen(uint16 image, uint32 left, uint32 top, uint32 right, uint32 bottom) { Graphics::Surface *surface = findImage(image)->getSurface(); // Clip the width to fit on the screen. Fixes some images. if (left + surface->w > 608) surface->w = 608 - left; for (uint16 i = 0; i < surface->h; i++) memcpy(_mainScreen->getBasePtr(left, i + top), surface->getBasePtr(0, i), surface->w * surface->format.bytesPerPixel); _dirtyScreen = true; }
void RivenGraphics::updateCredits() { if ((_creditsImage == 303 || _creditsImage == 304) && _creditsPos == 0) fadeToBlack(); if (_creditsImage < 304) { // For the first two credit images, they are faded from black to the image and then out again scheduleTransition(16); Graphics::Surface *frame = findImage(_creditsImage++)->getSurface(); for (int y = 0; y < frame->h; y++) memcpy(_mainScreen->getBasePtr(124, y), frame->getBasePtr(0, y), frame->pitch); runScheduledTransition(); } else { // Otheriwse, we're scrolling // Move the screen up one row memmove(_mainScreen->pixels, _mainScreen->getBasePtr(0, 1), _mainScreen->pitch * (_mainScreen->h - 1)); // Only update as long as we're not before the last frame // Otherwise, we're just moving up a row (which we already did) if (_creditsImage <= 320) { // Copy the next row to the bottom of the screen Graphics::Surface *frame = findImage(_creditsImage)->getSurface(); memcpy(_mainScreen->getBasePtr(124, _mainScreen->h - 1), frame->getBasePtr(0, _creditsPos), frame->pitch); _creditsPos++; if (_creditsPos == _mainScreen->h) { _creditsImage++; _creditsPos = 0; } } // Now flush the new screen _vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); _vm->_system->updateScreen(); } }
bool LBGraphics::imageIsTransparentAt(uint16 image, bool useOffsets, int x, int y) { MohawkSurface *mhkSurface = findImage(image); if (useOffsets) { x += mhkSurface->getOffsetX(); y += mhkSurface->getOffsetY(); } if (x < 0 || y < 0) return true; Graphics::Surface *surface = mhkSurface->getSurface(); if (x >= surface->w || y >= surface->h) return true; return *(byte *)surface->getBasePtr(x, y) == 0; }
inline POIImageIdentificationTable::ImageToCodeTable::const_iterator POIImageIdentificationTable:: decomposeFind( uint32 poiType, MC2String& filename ) const { ImageToCodeTable::const_iterator it = findImage( poiType, filename ); if ( it == m_images.end() ) { // strip the icon sub type if ( ! ::stripAfterLastDash( filename ) ) { // no dash to strip, we are all done, but not succesfully done. return m_images.end(); } // Lets see if the new stripped image exist return decomposeFind( poiType, filename ); } return it; }
static void do_font_stuff(SkPaint* paint) { for (SkScalar i = 8; i < 64; i++) { paint->setTextSize(i); auto cache = SkGlyphCache::FindOrCreateStrikeExclusive( *paint, nullptr, SkScalerContextFlags::kNone, nullptr); uint16_t glyphs['z']; for (int c = ' '; c < 'z'; c++) { glyphs[c] = cache->unicharToGlyph(c); } for (int lookups = 0; lookups < 10; lookups++) { for (int c = ' '; c < 'z'; c++) { const SkGlyph& g = cache->getGlyphIDMetrics(glyphs[c]); cache->findImage(g); } } } }
void plot_logo( Float_t v_scale = 1.0, Float_t skew = 1.0 ) { TImage *img = findImage("tmva_logo.gif"); if (!img) { cout << "+++ Could not open image tmva_logo.gif" << endl; return; } img->SetConstRatio(kFALSE); UInt_t h_ = img->GetHeight(); UInt_t w_ = img->GetWidth(); Float_t r = w_/h_; gPad->Update(); Float_t rpad = Double_t(gPad->VtoAbsPixel(0) - gPad->VtoAbsPixel(1))/(gPad->UtoAbsPixel(1) - gPad->UtoAbsPixel(0)); r *= rpad; Float_t d = 0.055; // absolute coordinates Float_t x1R = 1 - gStyle->GetPadRightMargin(); Float_t y1B = 1 - gStyle->GetPadTopMargin()+.01; // we like the logo to sit a bit above the histo Float_t x1L = x1R - d*r/skew; Float_t y1T = y1B + d*v_scale*skew; if (y1T>0.99) y1T = 0.99; TPad *p1 = new TPad("imgpad", "imgpad", x1L, y1B, x1R, y1T ); p1->SetRightMargin(0); p1->SetBottomMargin(0); p1->SetLeftMargin(0); p1->SetTopMargin(0); p1->Draw(); Int_t xSizeInPixel = p1->UtoAbsPixel(1) - p1->UtoAbsPixel(0); Int_t ySizeInPixel = p1->VtoAbsPixel(0) - p1->VtoAbsPixel(1); if (xSizeInPixel<=25 || ySizeInPixel<=25) { delete p1; return; // ROOT doesn't draw smaller than this } p1->cd(); img->Draw(); }
void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image) { if (!new_image) { llwarning("No image to add to image list", 0); return; } LLUUID image_id = new_image->getID(); LLViewerFetchedTexture *image = findImage(image_id); if (image) { llwarns << "Image with ID " << image_id << " already in list" << llendl; } sNumImages++; addImageToList(new_image); mUUIDMap[image_id] = new_image; }
Image* ImageManager::addImage(std::string key, int width, int height) { Image *image = findImage(key); if (image != NULL) { return image; } image = new Image(); if (FAILED(image->initialize(width, height))) { SAFE_DELETE(image); return NULL; } _imageMap.insert(std::make_pair(key, image)); return image; }
Image* ImageManager::addImage(std::string key, const char* fileName, float centerX, float centerY, int width, int height, BOOL trans, COLORREF transColor) { Image *image = findImage(key); if (image != NULL) { return image; } image = new Image(); if (FAILED(image->initialize(fileName, centerX, centerY, width, height, trans, transColor))) { SAFE_DELETE(image); return NULL; } _imageMap.insert(std::make_pair(key, image)); return image; }
FsmlImage* FsmlZoo::getImage( const string &name ) { /* Check if it's already in the zoo first. */ FsmlImage* img = findImage( name ); if (!img) { /* Nah, load it and add it. */ for (vector<string>::const_iterator i = m_paths.begin( ); i != m_paths.end( ); ++i) { DirStack cwd; cwd.push( *i ); if (img = FsmlImage::load_from_file( name )) { addImage( name, img ); break; } } } return img; }
//키 값으로 설정해서 초기화 image* imageManager::addImage(string strKey, int width, int height) { //동일한 이미지가 있는지 찾아보자 image* img = findImage(strKey); //키 값과 같은 이미지가 있으면 추가 하지 않고 기존의 이미지를 불러오자 if (img) return img; //이미지 생성 img = new image; //이미지가 제대로 초기화 되지 않았으면 if (FAILED(img->init(width, height))) { SAFE_DELETE(img); return NULL; } //생성된 이미지를 맵리스트에 추가하자 _mImageList.insert(make_pair(strKey, img)); return img; }
inline POIImageIdentificationTable::ImageToCodeTable::const_iterator POIImageIdentificationTable:: decomposeFindFirst( uint32 poiType, const MC2String& inFilename ) const { MC2String filename = inFilename; // lets see first if we have a unique image MC2String imageName; size_t pos = filename.find( "/" ); if ( pos != MC2String::npos ) { ImageToCodeTable::const_iterator it = findImage( poiType, filename.substr( 0, pos ) ); if ( it == m_images.end() ) { // remove unique icon name from string and try the other // side of the "/" as the icon name filename = filename.substr( pos + 1, filename.size() ); } else { return it; } } // See if the other side of the "/" has a valid image code return decomposeFind( poiType, filename ); }
image* imageManager::addImage(string strKey, const char* fileName, float x, float y, int width, int height, bool trans, COLORREF transColor) { //동일한 이미지가 있는지 찾아보자 image* img = findImage(strKey); //키 값과 같은 이미지가 있으면 추가 하지 않고 기존의 이미지를 불러오자 if (img) return img; //이미지 생성 img = new image; //이미지가 제대로 초기화 되지 않았으면 if (FAILED(img->init(fileName, x, y, width, height, trans, transColor))) { SAFE_DELETE(img); return NULL; } //생성된 이미지를 맵리스트에 추가하자 _mImageList.insert(make_pair(strKey, img)); return img; }
void imageManager::loopRender(string strKey, HDC hdc, const LPRECT drawArea, int offsetX, int offsetY) { image* img = findImage(strKey); if (img) img->loopRender(hdc, drawArea, offsetX, offsetY); }
void ThumbnailItem::setWId(qulonglong wId) { m_wId = wId; emit wIdChanged(wId); findImage(); }
void imageManager::alphaRender(string strKey, HDC hdc, int destX, int destY, int sourX, int sourY, int sourWidth, int sourHeight, BYTE alpha) { image* img = findImage(strKey); if (img) img->alphaRender(hdc, destX, destY, sourX, sourY, sourWidth, sourHeight, alpha); }
void imageManager::frameRender(string strKey, HDC hdc, int destX, int destY, int currentFrameX, int currentFrameY) { image* img = findImage(strKey); if (img) img->frameRender(hdc, destX, destY, currentFrameX, currentFrameY); }
//알파 렌더 void imageManager::alphaRender(string strKey, HDC hdc, int destX, int destY, BYTE alpha) { image* img = findImage(strKey); if (img) img->alphaRender(hdc, destX, destY, alpha); }
void imageManager::render(string strKey, HDC hdc, int destX, int destY, int sourX, int sourY, int sourWidth, int sourHeight) { image* img = findImage(strKey); if (img) img->render(hdc, destX, destY, sourX, sourY, sourWidth, sourHeight); }
void imageManager::render(string strKey, HDC hdc, int destX, int destY) { image* img = findImage(strKey); if (img) img->render(hdc, destX, destY); }
/// Returns an image of the list. /// @param[in] image The surface of the image to get. /// @return The image with the given surface. Image* getImage(SDL_Surface *image) {return findImage(image);}
//렌더 함수 void imageManager::render(string strKey, HDC hdc) { image* img = findImage(strKey); if (img) img->render(hdc); }