当前位置: 首页>>代码示例>>C++>>正文


C++ ImageDocument类代码示例

本文整理汇总了C++中ImageDocument的典型用法代码示例。如果您正苦于以下问题:C++ ImageDocument类的具体用法?C++ ImageDocument怎么用?C++ ImageDocument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ImageDocument类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleEvent

void ImageEventListener::handleEvent(ExecutionContext*, Event* event)
{
    if (event->type() == EventTypeNames::resize) {
        m_doc->windowSizeChanged(ImageDocument::ScaleOnlyUnzoomedDocument);
    } else if (event->type() == EventTypeNames::click && event->isMouseEvent()) {
        MouseEvent* mouseEvent = toMouseEvent(event);
        m_doc->imageClicked(mouseEvent->x(), mouseEvent->y());
    }
}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:9,代码来源:ImageDocument.cpp

示例2: willMoveToNewOwnerDocument

void ImageDocumentElement::willMoveToNewOwnerDocument()
{
    if (m_imageDocument) {
        m_imageDocument->disconnectImageElement();
        m_imageDocument = 0;
    }
    HTMLImageElement::willMoveToNewOwnerDocument();
}
开发者ID:mikedougherty,项目名称:webkit,代码行数:8,代码来源:ImageDocument.cpp

示例3: didMoveToNewDocument

void ImageDocumentElement::didMoveToNewDocument(Document* oldDocument)
{
    if (m_imageDocument) {
        m_imageDocument->disconnectImageElement();
        m_imageDocument = nullptr;
    }
    HTMLImageElement::didMoveToNewDocument(oldDocument);
}
开发者ID:emutavchi,项目名称:WebKitForWayland,代码行数:8,代码来源:ImageDocument.cpp

示例4: process

//-----------------------------------------------------------------------------
int ModeConvertImage::process()
{
    // check input and template files exists
    if (QFile::exists(this->mInputFilename))
    {
        // check dodocument name
        QString docNameWS = this->mDocumentName;
        docNameWS.remove(QRegExp("\\s"));
        if (!docNameWS.isEmpty())
        {
            // check preset exists
            if (Preset::presetsList().contains(this->mPresetName))
            {
                Preset::setSelectedName(this->mPresetName);

                // load image from input file
                QImage imageLoaded;
                if (imageLoaded.load(this->mInputFilename))
                {
                    QImage imageConverted = imageLoaded.convertToFormat(QImage::Format_ARGB32);

                    ImageDocument imageDocument;
                    QStringList keys = imageDocument.dataContainer()->keys();

                    // process all keys (1 in image document)
                    QStringListIterator iterator(keys);
                    while (iterator.hasNext())
                    {
                        QString key = iterator.next();
                        imageDocument.dataContainer()->setImage(key, &imageConverted);

                        imageDocument.setDocumentName(docNameWS);
                        imageDocument.dataContainer()->setInfo("converted filename", QVariant(this->mOuputFilename));

                        // save to output file
                        QFile file(this->mOuputFilename);
                        if (file.open(QFile::WriteOnly))
                        {
                            Preset preset;
                            preset.load(this->mPresetName);

                            // optional template file
                            if(!this->mTemplateFilename.isEmpty() && QFile::exists(this->mTemplateFilename))
                            {
                                preset.templates()->setImage(this->mTemplateFilename);
                            }

                            QString result = imageDocument.convert(&preset);

                            file.write(result.toUtf8());
                            file.close();

                            if (imageDocument.outputFilename() != this->mOuputFilename)
                            {
                                imageDocument.setOutputFilename(this->mOuputFilename);
                            }
                        }
                    }

                    return 0;
                }
            }
        }
    }

    return 1;
}
开发者ID:AbuShaqra,项目名称:lcd-image-converter,代码行数:68,代码来源:modeconvertimage.cpp

示例5: finish

void ImageTokenizer::finish()
{
    if (!m_parserStopped && m_doc->imageElement()) {
        CachedImage* cachedImage = m_doc->cachedImage();
        RefPtr<SharedBuffer> data = m_doc->frame()->loader()->documentLoader()->mainResourceData();

        // If this is a multipart image, make a copy of the current part, since the resource data
        // will be overwritten by the next part.
        if (m_doc->frame()->loader()->documentLoader()->isLoadingMultipartContent())
            data = data->copy();

        cachedImage->data(data.release(), true);
        cachedImage->finish();

        cachedImage->setResponse(m_doc->frame()->loader()->documentLoader()->response());

        IntSize size = cachedImage->imageSize(pageZoomFactor(m_doc));
        if (size.width()) {
            // Compute the title, we use the decoded filename of the resource, falling
            // back on the (decoded) hostname if there is no path.
            String fileName = decodeURLEscapeSequences(m_doc->url().lastPathComponent());
            if (fileName.isEmpty())
                fileName = m_doc->url().host();
            m_doc->setTitle(imageTitle(fileName, size));
        }

        m_doc->imageChanged();
    }

    m_doc->finishedParsing();
}
开发者ID:mikedougherty,项目名称:webkit,代码行数:31,代码来源:ImageDocument.cpp

示例6: handleEvent

void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event)
{
    if (event->type() == eventNames().resizeEvent)
        m_doc->windowSizeChanged();
    else if (event->type() == eventNames().clickEvent) {
        MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
        m_doc->imageClicked(mouseEvent->x(), mouseEvent->y());
    }
}
开发者ID:mikedougherty,项目名称:webkit,代码行数:9,代码来源:ImageDocument.cpp

示例7: writeRawData

bool ImageTokenizer::writeRawData(const char* data, int len)
{
    CachedImage* cachedImage = m_doc->cachedImage();
    cachedImage->data(m_doc->frame()->loader()->documentLoader()->mainResourceData(), false);

    m_doc->imageChanged();
    
    return false;
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:9,代码来源:ImageDocument.cpp

示例8: handleEvent

void ImageEventListener::handleEvent(Event* event, bool isWindowEvent)
{
    if (event->type() == eventNames().resizeEvent)
        m_doc->windowSizeChanged();
    else if (event->type() == eventNames().clickEvent) {
        MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
        m_doc->imageClicked(mouseEvent->x(), mouseEvent->y());
    }
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:9,代码来源:ImageDocument.cpp

示例9: finish

void ImageTokenizer::finish()
{
    if (!m_parserStopped && m_doc->imageElement()) {
        CachedImage* cachedImage = m_doc->cachedImage();
        RefPtr<SharedBuffer> data = m_doc->frame()->loader()->documentLoader()->mainResourceData();

        // If this is a multipart image, make a copy of the current part, since the resource data
        // will be overwritten by the next part.
        if (m_doc->frame()->loader()->documentLoader()->isLoadingMultipartContent())
            data = data->copy();

        cachedImage->data(data.release(), true);
        cachedImage->finish();

        cachedImage->setResponse(m_doc->frame()->loader()->documentLoader()->response());

        IntSize size = cachedImage->imageSize(m_doc->frame()->pageZoomFactor());
        if (size.width())
            m_doc->setTitle(imageTitle(cachedImage->response().suggestedFilename(), size));

        m_doc->imageChanged();
    }

    m_doc->finishedParsing();
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:25,代码来源:ImageDocument.cpp

示例10: writeRawData

bool ImageTokenizer::writeRawData(const char*, int)
{
    Frame* frame = m_doc->frame();
    Settings* settings = frame->settings();
    if (!frame->loader()->client()->allowImages(!settings || settings->areImagesEnabled()))
        return false;

    CachedImage* cachedImage = m_doc->cachedImage();
    cachedImage->data(frame->loader()->documentLoader()->mainResourceData(), false);

    m_doc->imageChanged();

    return false;
}
开发者ID:mikedougherty,项目名称:webkit,代码行数:14,代码来源:ImageDocument.cpp


注:本文中的ImageDocument类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。