示例#1
0
void DkCompressDialog::saveSettings() {

	QSettings& settings = DkSettingsManager::instance().qSettings();
	settings.beginGroup(objectName());
	settings.setValue("Compression" + QString::number(mDialogMode), getCompression());
	
	if (mDialogMode != webp_dialog)
		settings.setValue("bgCompressionColor" + QString::number(mDialogMode), getBackgroundColor().rgba());
	settings.endGroup();
}
示例#2
0
void QCamVesta::refreshPictureSettings() {
   QCamV4L2::refreshPictureSettings();
   QCamV4L2::refreshPictureSettings(); // second call needed. if not some value are not properly restored.

   int tmp;
   emit(sharpnessChange(getSharpness()));
   emit(noiseRemovalChange(getNoiseRemoval()));
   emit(gainChange(getGain()));

   setProperty("CompressionWished",tmp=getCompression());
   emit(compressionChange(tmp));

   setProperty("Gama",tmp=getGama());
   emit gamaChange(tmp);

   getWhiteBalance();
}
示例#3
0
文件: map.c 项目: clbr/SGDK
static int execute(char *info, FILE *fs, FILE *fh)
{
    char temp[MAX_PATH_LEN];
    char id[50];
    char fileIn[MAX_PATH_LEN];
    char packedStr[256];
    int w, h;
    int packed;
    int transInd;
    int nbElem;
    tilemap_ *result;

    packed = 0;
    transInd = 0;

    nbElem = sscanf(info, "%s %s \"%[^\"]\" %d %d %s", temp, id, temp, &w, &h, packedStr);

    if (nbElem < 5)
    {
        printf("Wrong MAP definition\n");
        printf("MAP name \"file\" width height [packed]\n");
        printf("  name      Map variable name\n");
        printf("  file      the map file to convert to Map structure (.map Mappy file)\n");
        printf("  width     the map width\n");
        printf("  height    the map height\n");
        printf("  packed    compression type, accepted values:\n");
        printf("              -1 / BEST / AUTO = use best compression\n");
        printf("               0 / NONE        = no compression\n");
        printf("               1 / APLIB       = aplib library (good compression ratio but slow)\n");
        printf("               2 / FAST / LZ4W = custom lz4 compression (average compression ratio but fast)\n");

        return FALSE;
    }

    // adjust input file path
    adjustPath(resDir, temp, fileIn);
    // get packed value
    packed = getCompression(packedStr);

    printf("MAP resource not yet supported !\n");



    return FALSE;
}
示例#4
0
void DkCompressDialog::drawPreview() {

	if (mImg.isNull() || !isVisible())
		return;

	QImage origImg = mOrigView->getCurrentImageRegion();
	qDebug() << "orig img size: " << origImg.size();
	qDebug() << "min size: " << mOrigView->minimumSize();
	mNewImg = QImage(origImg.size(), QImage::Format_ARGB32);

	if ((mDialogMode == jpg_dialog || mDialogMode == j2k_dialog) && mHasAlpha)
		mNewImg.fill(mBgCol.rgb());
	else if ((mDialogMode == jpg_dialog || mDialogMode == web_dialog) && !mHasAlpha)
		mNewImg.fill(palette().color(QPalette::Background).rgb());
	else
		mNewImg.fill(QColor(0,0,0,0).rgba());
	 
	QPainter bgPainter(&mNewImg);
	bgPainter.drawImage(origImg.rect(), origImg, origImg.rect());
	bgPainter.end();

	if (mDialogMode == jpg_dialog) {
		// pre-compute the jpg compression
		QByteArray ba;
		QBuffer buffer(&ba);
		buffer.open(QIODevice::ReadWrite);
		mNewImg.save(&buffer, "JPG", mSlider->value());
		mNewImg.loadFromData(ba, "JPG");
		updateFileSizeLabel((float)ba.size(), origImg.size());
	}
	else if (mDialogMode == j2k_dialog) {
		// pre-compute the jpg compression
		QByteArray ba;
		QBuffer buffer(&ba);
		buffer.open(QIODevice::ReadWrite);
		mNewImg.save(&buffer, "J2K", mSlider->value());
		mNewImg.loadFromData(ba, "J2K");
		updateFileSizeLabel((float)ba.size(), origImg.size());
		qDebug() << "using j2k...";
	}
	else if (mDialogMode == webp_dialog && getCompression() != -1) {
		// pre-compute the jpg compression
		QByteArray ba;
		QBuffer buffer(&ba);
		buffer.open(QIODevice::ReadWrite);
		mNewImg.save(&buffer, "WEBP", mSlider->value());
		mNewImg.loadFromData(ba, "WEBP");
		updateFileSizeLabel((float)ba.size(), origImg.size());
		qDebug() << "using webp...";

		//// pre-compute the webp compression
		//DkBasicLoader loader;
		//QSharedPointer<QByteArray> buffer(new QByteArray());
		//loader.saveWebPFile(mNewImg, buffer, getCompression(), 0);
		//qDebug() << "webP buffer size: " << buffer->size();
		//loader.loadWebPFile(QString(), buffer);
		//mNewImg = loader.image();
		//updateFileSizeLabel((float)buffer->size(), origImg.size());
	}
	else if (mDialogMode == web_dialog) {

		float factor = getResizeFactor();
		if (factor != -1)
			mNewImg = DkImage::resizeImage(mNewImg, QSize(), factor, DkImage::ipl_area);

		if (!mHasAlpha) {
			// pre-compute the jpg compression
			QByteArray ba;
			QBuffer buffer(&ba);
			buffer.open(QIODevice::ReadWrite);
			mNewImg.save(&buffer, "JPG", getCompression());
			mNewImg.loadFromData(ba, "JPG");
			updateFileSizeLabel((float)ba.size(), origImg.size(), factor);
		}
		else
			updateFileSizeLabel();
	}
	else
		updateFileSizeLabel();

	//previewLabel->setScaledContents(true);
	QImage img = mNewImg.scaled(mPreviewLabel->size(), Qt::KeepAspectRatio, Qt::FastTransformation);
	mPreviewLabel->setPixmap(QPixmap::fromImage(img));
}
示例#5
0
 virtual int getFIOptions()
 {
   return getCompression();
 }