summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLuke Deller <luke@deller.id.au>2019-10-31 01:36:22 +1100
committerMiklos Vajna <vmiklos@collabora.com>2019-10-31 08:51:49 +0100
commitef3dabd1f814d1b005efc5d5144978c1d26a8e73 (patch)
tree12e670ed7d28c2cd054aa3a3af48be42f4df468f /include
parent0dd56a4a745266dcf88d43150ef1d798619ab522 (diff)
Fix IsTransparent() for unloaded graphics
Fix Graphic::IsAlpha() and Graphic::IsTransparent() for unloaded graphics. This fixes tdf#118036. GraphicDescriptor::Detect(true) is currently used to read the image size from the header of images which are not being fully loaded yet. This change extends GraphicDescriptor to also report whether the image supports transparency or alpha, implemented only for PNG format so far. Change-Id: I1753c0d11491f1dc518e23da8d7b3842945770cb Reviewed-on: https://gerrit.libreoffice.org/81785 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/graphicfilter.hxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index eea2e9ac8b7d..45fe8e261f9e 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -145,6 +145,8 @@ class VCL_DLLPUBLIC GraphicDescriptor final
GraphicFileFormat nFormat;
bool const bOwnStream;
sal_uInt8 mnNumberOfImageComponents;
+ bool bIsTransparent;
+ bool bIsAlpha;
void ImpConstruct();
@@ -214,6 +216,12 @@ public:
/** @return number of color channels */
sal_uInt8 GetNumberOfImageComponents() const { return mnNumberOfImageComponents; }
+ /** @return whether image supports transparency */
+ bool IsTransparent() const { return bIsTransparent; }
+
+ /** @return whether image supports alpha values for translucent colours */
+ bool IsAlpha() const { return bIsAlpha; }
+
/** @return filter number that is needed by the GraphFilter to read this format */
static OUString GetImportFormatShortName( GraphicFileFormat nFormat );
};