/* GfxEntryPanel::statusString * Returns a string with extended editing/entry info for the status * bar *******************************************************************/ string GfxEntryPanel::statusString() { // Setup status string SImage* image = getImage(); string status = S_FMT("%dx%d", image->getWidth(), image->getHeight()); // Colour format if (image->getType() == RGBA) status += ", 32bpp"; else status += ", 8bpp"; // PNG stuff if (entry->getType()->getFormat() == "img_png") { // alPh if (EntryOperations::getalPhChunk(entry)) status += ", alPh"; // tRNS if (EntryOperations::gettRNSChunk(entry)) status += ", tRNS"; } return status; }
int canWrite(SImage& image) { // If it's the correct size and colour format, it's writable if (image.getType() == PALMASK && validSize(image.getWidth(), image.getHeight())) return WRITABLE; // Otherwise, it can be converted via palettising and cropping return CONVERTIBLE; }
bool writeImage(SImage& image, MemChunk& data, Palette* pal, int index) { // Can't write if RGBA if (image.getType() == RGBA) return false; // Check size if (!validSize(image.getWidth(), image.getHeight())) return false; // Just dump image data to memchunk data.clear(); data.write(imageData(image), image.getWidth() * image.getHeight()); return true; }
int canWrite(SImage& image) { // If it's the correct size and colour format, it's writable int width = image.getWidth(); int height = image.getHeight(); // Shouldn't happen but... if (width < 0 || height < 0) return NOTWRITABLE; if (image.getType() == PALMASK && validSize(image.getWidth(), image.getHeight())) return WRITABLE; // Otherwise, check if it can be cropped to a valid size for (unsigned a = 0; a < n_valid_flat_sizes; a++) if (((unsigned)width >= valid_flat_size[a][0] && (unsigned)height >= valid_flat_size[a][1] && valid_flat_size[a][2] == 1) || gfx_extraconv) return CONVERTIBLE; return NOTWRITABLE; }