Examples of QImage


Examples of com.trolltech.qt.gui.QImage

    QGraphicsPixmapItem background = addPixmap(pixelMap);
    background.setAcceptsHoverEvents(true);
    background.setZValue(-1);
   
    // Draw colored tiles onto QPixMap
    qImage = new QImage(sceneSize, Format.Format_RGB16);
    QPainter painter = new QPainter(qImage);

    // Determine which columns and rows to not draw
    TreeSet<Integer> colsToSkip = new TreeSet<Integer>();
    TreeSet<Integer> rowsToSkip = new TreeSet<Integer>();
View Full Code Here

Examples of com.trolltech.qt.gui.QImage

    qpm.fill(new QColor(255, 255,255, 0));
    QGraphicsPixmapItem background = addPixmap(qpm);
    background.setAcceptsHoverEvents(true);
    background.setZValue(-1);
    // Draw colored tiles onto QImage   
    qImage = new QImage(new QSize((numCols + 1) * (tileSize + 1),
        (numRows + 1) * (tileSize + 1)), Format.Format_RGB16);
    QPainter painter = new QPainter(qImage);

    painter.setPen(new QPen(QColor.black, lineWidth));
    // Draw lines between tiles
View Full Code Here

Examples of com.trolltech.qt.gui.QImage

            AspectRatioMode.KeepAspectRatio, TransformationMode.SmoothTransformation);
        else
          return null;
      }
      else {
        QImage img = listManager.getThumbnail(note.getGuid());
        if (img != null)
          return img.scaled(Global.largeThumbnailSize,
            AspectRatioMode.KeepAspectRatio, TransformationMode.SmoothTransformation);
        else
          return null;
      }
       
View Full Code Here

Examples of com.trolltech.qt.gui.QImage

          if (!buffer.open(QIODevice.OpenModeFlag.ReadWrite)) {
            logger.log(logger.EXTREME, "Failure to open buffer.  Aborting.");
            return;
          }
          QPixmap p = icon.pixmap(32, 32);
          QImage i = p.toImage();
           i.save(buffer, filetype.toUpperCase());
           buffer.close();
           QByteArray b = new QByteArray(buffer.buffer());
           if (!b.isNull() && !b.isEmpty())
             query.bindValue(":icon", b.toByteArray());
           else
View Full Code Here

Examples of com.trolltech.qt.gui.QImage

          if (!buffer.open(QIODevice.OpenModeFlag.ReadWrite)) {
            logger.log(logger.EXTREME, "Failure to open buffer.  Aborting.");
            return;
          }
          QPixmap p = icon.pixmap(32, 32);
          QImage i = p.toImage();
           i.save(buffer, filetype.toUpperCase());
           buffer.close();
           QByteArray b = new QByteArray(buffer.buffer());
           if (!b.isNull() && !b.isEmpty())
             query.bindValue(":icon", b.toByteArray());
           else
View Full Code Here

Examples of com.trolltech.qt.gui.QImage

  }
  public QImage getThumbnail(String guid) {
//    if (getThumbnails().containsKey(guid))
//      return getThumbnails().get(guid);
   
    QImage img = new QImage();
    img = QImage.fromData(conn.getNoteTable().getThumbnail(guid));
    if (img == null || img.isNull())
      return null;
    //getThumbnails().put(guid, img);
    return img;
  }
View Full Code Here

Examples of com.trolltech.qt.gui.QImage

          if (!buffer.open(QIODevice.OpenModeFlag.ReadWrite)) {
            logger.log(logger.EXTREME, "Failure to open buffer.  Aborting.");
            return;
          }
          QPixmap p = icon.pixmap(32, 32);
          QImage i = p.toImage();
           i.save(buffer, type.toUpperCase());
           buffer.close();
           QByteArray b = new QByteArray(buffer.buffer());
           if (!b.isNull() && !b.isEmpty())
             query.bindValue(":icon", b.toByteArray());
           else
View Full Code Here

Examples of com.trolltech.qt.gui.QImage

          if (!buffer.open(QIODevice.OpenModeFlag.ReadWrite)) {
            logger.log(logger.EXTREME, "Failure to open buffer.  Aborting.");
            return;
          }
          QPixmap p = icon.pixmap(32, 32);
          QImage i = p.toImage();
           i.save(buffer, type.toUpperCase());
           buffer.close();
           QByteArray b = new QByteArray(buffer.buffer());
           if (!b.isNull() && !b.isEmpty())
             query.bindValue(":icon", b.toByteArray());
           else
View Full Code Here

Examples of com.trolltech.qt.gui.QImage

      logger.log(logger.EXTREME, "Creating resource");
      int sequence = 0;
      if (currentNote.getResources() != null || currentNote.getResources().size() > 0)
        sequence = currentNote.getResources().size();
      newRes = createResource(path,sequence ,"image/gif", false);
      QImage pix = new QImage();
      pix.loadFromData(image);
      newRes.setHeight(new Integer(pix.height()).shortValue());
      newRes.setWidth(new Integer(pix.width()).shortValue());
      logger.log(logger.EXTREME, "Renaming temporary file to " +newRes.getGuid()+".gif");
      path = Global.getFileManager().getResDirPath(newRes.getGuid()+".gif");
      tfile.rename(path);
    } else {
      newRes = conn.getNoteTable().noteResourceTable.getNoteResource(latexGuid, false);
      path = Global.getFileManager().getResDirPath(newRes.getGuid()+".gif");
      tfile = new QFile(path);
      tfile.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.WriteOnly));
      tfile.write(image);
      tfile.close();
      newRes.getData().setBody(image.toByteArray());
      // Calculate the new hash value
        MessageDigest md;

        logger.log(logger.EXTREME, "Generating MD5");
        try {
        md = MessageDigest.getInstance("MD5");
          md.update(image.toByteArray());
          byte[] hash = md.digest();
          newRes.getData().setBodyHash(hash);
      } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
      }
      QImage pix = new QImage();
      pix.loadFromData(image);
      newRes.setHeight(new Integer(pix.height()).shortValue());
      newRes.setWidth(new Integer(pix.width()).shortValue());
      conn.getNoteTable().noteResourceTable.updateNoteResource(newRes, true);
    }

    logger.log(logger.EXTREME, "Setting source: " +replyUrl.toString());
    newRes.getAttributes().setSourceURL(replyUrl.toString());
View Full Code Here

Examples of com.trolltech.qt.gui.QImage

  }

  // Insert an image into the editor
  private void insertImage(QMimeData mime) {
    logger.log(logger.EXTREME, "Entering insertImage");
    QImage img = (QImage) mime.imageData();
    String script_start = new String(
        "document.execCommand('insertHTML', false, '");
    String script_end = new String("');");

    long now = new Date().getTime();
    String path = Global.getFileManager().getResDirPath(
        (new Long(now).toString()) + ".jpg");

    // This block is just a hack to make sure we wait at least 1ms so we
    // don't
    // have collisions on image names
    long i = new Date().getTime();
    while (now == i)
      i = new Date().getTime();

    // Open the file & write the data
    QFile tfile = new QFile(path);
    tfile.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.WriteOnly));
    if (!img.save(tfile)) {
      tfile.close();
      return;
    }
    tfile.close();
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.