本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}