NITFPRIV(NITF_CLEVEL) checkImageSize(nitf_Record* record, nitf_Error* error) { int clevel = NITF_CLEVEL_03; nitf_ListIterator it = nitf_List_begin(record->images); nitf_ListIterator end = nitf_List_end(record->images); int i = 0; while (nitf_ListIterator_notEqualTo(&it, &end) ) { nitf_ImageSegment* imageSegment = (nitf_ImageSegment*)nitf_ListIterator_get(&it); int result = checkImage(imageSegment->subheader, error); if ( result == NITF_CLEVEL_CHECK_FAILED ) return result; if ( result > clevel ) { clevel = result; } ++i; nitf_ListIterator_increment(&it); } return clevel; }
static int lua_image_gc(lua_State *L) { struct Image *pImage = checkImage(L, 1); if (pImage) { ui_unload_image(pImage->data); } return 0; }
bool Auvsi_Recognize::checkAll() { bool result = true; if (checkImage(_shape)) ;//printf("Shape is good"); else { result = false; printf("Shape is bad"); } if (checkImage(_letter)) ;//printf("Letter is good\n"); else { result = false; printf("Letter is bad\n"); } return result; }
QScriptValue ImageBuilder::add(QScriptValue imgArg) { Image *simg = 0; QScriptValue err = checkImage(context(), imgArg, simg); if (err.isError()) return err; QString errStr = add(simg->getImg(), TAffine()); if (errStr != "") return context()->throwError( tr("%1 : %2").arg(errStr).arg(imgArg.toString())); else return context()->thisObject(); }
static int lua_image_height(lua_State *L) { struct Image *pImage; int height = 0; pImage = checkImage(L, 1); if (pImage) height = pImage->height; lua_pushnumber(state, height); return 1; }
static int lua_image_width(lua_State *L) { struct Image *pImage; int width = 0; pImage = checkImage(L, 1); if (pImage) width = pImage->width; lua_pushnumber(state, width); return 1; }
QScriptValue ImageBuilder::add(QScriptValue imgArg, QScriptValue transformationArg) { Image *simg = 0; QScriptValue err = checkImage(context(), imgArg, simg); if (err.isError()) return err; Transform *transformation = qscriptvalue_cast<Transform *>(transformationArg); if (!transformation) { return context()->throwError( tr("Bad argument (%1): should be a Transformation") .arg(transformationArg.toString())); } TAffine aff = transformation->getAffine(); QString errStr = add(simg->getImg(), aff); if (errStr != "") return context()->throwError( tr("%1 : %2").arg(errStr).arg(imgArg.toString())); else return context()->thisObject(); }
int lua_image_draw(lua_State *L) { struct Image *pImage = checkImage(L, 1); int argc = lua_gettop(state); int x, y; int result; if (argc == 3) { if ((lua_type(state, 2) == LUA_TNUMBER) && (lua_type(state, 3) == LUA_TNUMBER)) { x = lua_tonumber(state, 2); y = lua_tonumber(state, 3); ui_draw_image(pImage->data, x, y); result = 0; } else result = EINVAL; } else result = EINVAL; lua_pushnumber(state, result); return 1; }
/* returns the sequence number of the page processed */ int TIFF2PS(FILE* fd, TIFF* tif, float pw, float ph) { uint32 w, h; float ox, oy, prw, prh; float scale; uint32 subfiletype; uint16* sampleinfo; static int npages = 0; if (!TIFFGetField(tif, TIFFTAG_XPOSITION, &ox)) ox = 0; if (!TIFFGetField(tif, TIFFTAG_YPOSITION, &oy)) oy = 0; setupPageState(tif, &w, &h, &prw, &prh); do { tf_numberstrips = TIFFNumberOfStrips(tif); TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &tf_rowsperstrip); setupPageState(tif, &w, &h, &prw, &prh); if (!npages) PSHead(fd, tif, w, h, prw, prh, ox, oy); TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample); TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel); TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfiguration); TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression); TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES, &extrasamples, &sampleinfo); alpha = (extrasamples == 1 && sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA); if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) { switch (samplesperpixel - extrasamples) { case 1: if (isCCITTCompression(tif)) photometric = PHOTOMETRIC_MINISWHITE; else photometric = PHOTOMETRIC_MINISBLACK; break; case 3: photometric = PHOTOMETRIC_RGB; break; case 4: photometric = PHOTOMETRIC_SEPARATED; break; } } if (checkImage(tif)) { tf_bytesperrow = TIFFScanlineSize(tif); npages++; fprintf(fd, "%%%%Page: %d %d\n", npages, npages); fprintf(fd, "gsave\n"); fprintf(fd, "100 dict begin\n"); if (pw != 0 && ph != 0) { /* NB: maintain image aspect ratio */ scale = (pw*PS_UNIT_SIZE/prw) < (ph*PS_UNIT_SIZE/prh) ? (pw*PS_UNIT_SIZE/prw) : (ph*PS_UNIT_SIZE/prh); if (scale > 1.0) scale = 1.0; fprintf(fd, "0 %f translate\n", ph*PS_UNIT_SIZE-prh*scale); fprintf(fd, "%f %f scale\n", prw*scale, prh*scale); } else fprintf(fd, "%f %f scale\n", prw, prh); PSpage(fd, tif, w, h); fprintf(fd, "end\n"); fprintf(fd, "grestore\n"); fprintf(fd, "showpage\n"); } if (generateEPSF) break; TIFFGetFieldDefaulted(tif, TIFFTAG_SUBFILETYPE, &subfiletype); } while (((subfiletype & FILETYPE_PAGE) || printAll) && TIFFReadDirectory(tif)); return(npages); }
void KisQPainterCanvas::slotConfigChanged() { m_d->checkBrush = QBrush(checkImage()); notifyConfigChanged(); }