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


C++ ImageResource::image方法代码示例

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


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

示例1: fromImageResource

/*!
    Creates an ImageHeader from the given \a resource.
*/
ImageHeader ImageHeader::fromImageResource(const ImageResource &resource)
{
    ImageHeader result;
    if (resource.isNull())
        return result;

    result.setType(resource.type());

    switch (resource.type()) {
    case ImageResource::Type::Image:
        result.setWidth(resource.image().width());
        result.setHeight(resource.image().height());
        result.setDepth(1);
        result.setImageFormat(resource.image().format());
        break;
    case ImageResource::Type::CubeTexture:
        result.setWidth(resource.cubeTexture().width());
        result.setHeight(resource.cubeTexture().height());
        result.setDepth(resource.cubeTexture().depth());
        result.setImageFormat(resource.cubeTexture().format());
        break;
    case ImageResource::Type::VolumeTexture:
        result.setWidth(resource.volumeTexture().width());
        result.setHeight(resource.volumeTexture().height());
        result.setDepth(resource.volumeTexture().depth());
        result.setImageFormat(resource.volumeTexture().format());
        break;
    default:
        break;
    }

    return result;
}
开发者ID:ABBAPOH,项目名称:imagedocument,代码行数:36,代码来源:imageheader.cpp

示例2: embeddedContentBox

LayoutBox* LayoutImage::embeddedContentBox() const
{
    if (!m_imageResource)
        return nullptr;

    ImageResource* cachedImage = m_imageResource->cachedImage();
    if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage())
        return toSVGImage(cachedImage->image())->embeddedContentBox();

    return nullptr;
}
开发者ID:dstockwell,项目名称:blink,代码行数:11,代码来源:LayoutImage.cpp

示例3: defaultDestinationSize

FloatSize HTMLImageElement::defaultDestinationSize() const
{
    ImageResource* image = cachedImage();
    if (!image)
        return FloatSize();
    LayoutSize size;
    size = image->imageSizeForLayoutObject(layoutObject(), 1.0f);
    if (layoutObject() && layoutObject()->isLayoutImage() && image->image() && !image->image()->hasRelativeWidth())
        size.scale(toLayoutImage(layoutObject())->imageDevicePixelRatio());
    return FloatSize(size);
}
开发者ID:dstockwell,项目名称:blink,代码行数:11,代码来源:HTMLImageElement.cpp

示例4: defaultDestinationSize

FloatSize HTMLImageElement::defaultDestinationSize() const
{
    ImageResource* image = cachedImage();
    if (!image)
        return FloatSize();
    LayoutSize size;
    size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure about this.
    if (renderer() && renderer()->isRenderImage() && image->image() && !image->image()->hasRelativeWidth())
        size.scale(toRenderImage(renderer())->imageDevicePixelRatio());
    return size;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:11,代码来源:HTMLImageElement.cpp

示例5: embeddedContentBox

RenderBox* RenderImage::embeddedContentBox() const
{
    if (!m_imageResource)
        return 0;

    ImageResource* cachedImage = m_imageResource->cachedImage();
    if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage())
        return static_cast<SVGImage*>(cachedImage->image())->embeddedContentBox();

    return 0;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:11,代码来源:RenderImage.cpp

示例6: main

int main(int argc, char *argv[])
{
    ImageIO reader("texture.dds");
    const auto result = reader.read();

    // if (!result.first) ...

    const auto &contents = result.second;
    for (int index = 0; index < contents.header().imageCount(); ++index) { // read array
        for (int level = 0; level < contents.header().mipmapCount(); ++level) { // read mipmaps
            ImageResource resource = contents.resource(index, level);
            if (resource.type() == ImageResource::Type::Image) {
                const QImage image = resource.image();
                // ...
            } else if (resource.type() == ImageResource::Type::CubeTexture) {
                CubeTexture texture = resource.cubeTexture();
                // ...
            } else if (resource.type() == ImageResource::Type::VolumeTexture) {
                VolumeTexture texture = resource.volumeTexture();
                // ...
            }
        }
    }

    ImageExifMeta exif = contents.exifMeta();
    if (!exif.isEmpty()) {
        // ...
    }

    return 0;
}
开发者ID:ABBAPOH,项目名称:imagedocument,代码行数:31,代码来源:mainpage.cpp

示例7: containerSizeIsSetForLayoutObject

static bool containerSizeIsSetForLayoutObject(ImageResource& cachedImage, const LayoutObject* layoutObject)
{
    const Image* image = cachedImage.image();
    // If a container size has been specified for this layoutObject, then
    // imageForLayoutObject() will return the SVGImageForContainer while image()
    // will return the underlying SVGImage.
    return !image->isSVGImage() || image != cachedImage.imageForLayoutObject(layoutObject);
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:8,代码来源:LayoutSVGImage.cpp

示例8: writeImageToDataObject

static void writeImageToDataObject(DataObject* dataObject, Element* element, const KURL& url)
{
    // Shove image data into a DataObject for use as a file
    ImageResource* cachedImage = getImageResource(element);
    if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
        return;

    SharedBuffer* imageBuffer = cachedImage->image()->data();
    if (!imageBuffer || !imageBuffer->size())
        return;

    String imageExtension = cachedImage->image()->filenameExtension();
    ASSERT(!imageExtension.isEmpty());

    // Determine the filename for the file contents of the image.
    String filename = cachedImage->response().suggestedFilename();
    if (filename.isEmpty())
        filename = url.lastPathComponent();

    String fileExtension;
    if (filename.isEmpty()) {
        filename = element->getAttribute(HTMLNames::altAttr);
    } else {
        // Strip any existing extension. Assume that alt text is usually not a filename.
        int extensionIndex = filename.reverseFind('.');
        if (extensionIndex != -1) {
            fileExtension = filename.substring(extensionIndex + 1);
            filename.truncate(extensionIndex);
        }
    }

    if (!fileExtension.isEmpty() && fileExtension != imageExtension) {
        String imageMimeType = MIMETypeRegistry::getMIMETypeForExtension(imageExtension);
        ASSERT(imageMimeType.startsWith("image/"));
        // Use the file extension only if it has imageMimeType: it's untrustworthy otherwise.
        if (imageMimeType == MIMETypeRegistry::getMIMETypeForExtension(fileExtension))
            imageExtension = fileExtension;
    }

    imageExtension = "." + imageExtension;
    validateFilename(filename, imageExtension);

    dataObject->addSharedBuffer(filename + imageExtension, imageBuffer);
}
开发者ID:azureplus,项目名称:chromium,代码行数:44,代码来源:DataTransfer.cpp


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