2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2013-10-23 19:10:20 +02:00
|
|
|
#ifndef INCLUDED_VCL_BITMAP_HXX
|
|
|
|
#define INCLUDED_VCL_BITMAP_HXX
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2013-04-16 08:41:07 +00:00
|
|
|
#include <tools/color.hxx>
|
2012-01-03 15:12:33 +01:00
|
|
|
#include <tools/link.hxx>
|
2012-06-10 19:26:30 +03:00
|
|
|
#include <tools/solar.h>
|
2015-08-27 15:25:11 +02:00
|
|
|
#include <vcl/checksum.hxx>
|
2007-04-11 16:47:49 +00:00
|
|
|
#include <vcl/dllapi.h>
|
|
|
|
#include <vcl/mapmod.hxx>
|
|
|
|
#include <vcl/region.hxx>
|
2011-05-17 10:03:46 +02:00
|
|
|
#include <vcl/scopedbitmapaccess.hxx>
|
2015-05-06 09:00:50 +02:00
|
|
|
#include <o3tl/typed_flags_set.hxx>
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2015-05-06 09:00:50 +02:00
|
|
|
enum class BmpMirrorFlags
|
|
|
|
{
|
|
|
|
NONE = 0x00,
|
|
|
|
Horizontal = 0x01,
|
|
|
|
Vertical = 0x02,
|
|
|
|
};
|
|
|
|
namespace o3tl
|
|
|
|
{
|
|
|
|
template<> struct typed_flags<BmpMirrorFlags> : is_typed_flags<BmpMirrorFlags, 0x03> {};
|
|
|
|
}
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
|
2015-05-05 14:09:24 +02:00
|
|
|
enum class BmpScaleFlag
|
|
|
|
{
|
|
|
|
NONE = 0,
|
2014-12-15 18:36:32 +01:00
|
|
|
// Try to preferably use these.
|
2015-05-05 14:09:24 +02:00
|
|
|
Default = 1,
|
|
|
|
Fast = 2,
|
|
|
|
BestQuality = 3,
|
2014-12-15 18:36:32 +01:00
|
|
|
// Specific algorithms, use only if you really need to.
|
2015-05-05 14:09:24 +02:00
|
|
|
Interpolate = 4,
|
|
|
|
Super = 5,
|
|
|
|
Lanczos = 6,
|
|
|
|
BiCubic = 7,
|
|
|
|
BiLinear = 8,
|
|
|
|
Box = 9,
|
|
|
|
};
|
2012-10-29 16:20:25 +00:00
|
|
|
|
2012-06-22 17:19:12 +02:00
|
|
|
|
2015-05-06 10:52:59 +02:00
|
|
|
enum class BmpDitherFlags
|
|
|
|
{
|
|
|
|
NONE = 0x0000,
|
|
|
|
Matrix = 0x0001,
|
|
|
|
Floyd = 0x0002,
|
|
|
|
Floyd16 = 0x0004,
|
|
|
|
};
|
|
|
|
namespace o3tl
|
|
|
|
{
|
|
|
|
template<> struct typed_flags<BmpDitherFlags> : is_typed_flags<BmpDitherFlags, 0x07> {};
|
|
|
|
}
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2014-09-28 22:33:50 +10:00
|
|
|
#define BMP_COL_TRANS Color( 252, 3, 251 )
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
enum BmpConversion
|
|
|
|
{
|
|
|
|
BMP_CONVERSION_NONE = 0,
|
|
|
|
BMP_CONVERSION_1BIT_THRESHOLD = 1,
|
|
|
|
BMP_CONVERSION_1BIT_MATRIX = 2,
|
|
|
|
BMP_CONVERSION_4BIT_GREYS = 3,
|
|
|
|
BMP_CONVERSION_4BIT_COLORS = 4,
|
|
|
|
BMP_CONVERSION_8BIT_GREYS = 5,
|
|
|
|
BMP_CONVERSION_8BIT_COLORS = 6,
|
|
|
|
BMP_CONVERSION_24BIT = 7,
|
|
|
|
BMP_CONVERSION_4BIT_TRANS = 8,
|
|
|
|
BMP_CONVERSION_8BIT_TRANS = 9,
|
|
|
|
BMP_CONVERSION_GHOSTED = 10
|
|
|
|
};
|
|
|
|
|
|
|
|
enum BmpCombine
|
|
|
|
{
|
|
|
|
BMP_COMBINE_COPY = 0,
|
|
|
|
BMP_COMBINE_INVERT = 1,
|
|
|
|
BMP_COMBINE_AND = 2,
|
|
|
|
BMP_COMBINE_NAND = 3,
|
|
|
|
BMP_COMBINE_OR = 4,
|
|
|
|
BMP_COMBINE_NOR = 5,
|
|
|
|
BMP_COMBINE_XOR = 6,
|
|
|
|
BMP_COMBINE_NXOR = 7
|
|
|
|
};
|
|
|
|
|
|
|
|
enum BmpReduce
|
|
|
|
{
|
|
|
|
BMP_REDUCE_SIMPLE = 0,
|
2016-08-11 14:06:49 +02:00
|
|
|
BMP_REDUCE_POPULAR = 1
|
2007-04-11 16:47:49 +00:00
|
|
|
};
|
|
|
|
|
2016-12-21 17:06:15 +02:00
|
|
|
enum class BmpFilter
|
2007-04-11 16:47:49 +00:00
|
|
|
{
|
2016-12-21 17:06:15 +02:00
|
|
|
Smooth = 0,
|
|
|
|
Sharpen = 1,
|
|
|
|
RemoveNoise = 2,
|
|
|
|
SobelGrey = 3,
|
|
|
|
EmbossGrey = 4,
|
|
|
|
Solarize = 5,
|
|
|
|
Sepia = 6,
|
|
|
|
Mosaic = 7,
|
|
|
|
PopArt = 8,
|
|
|
|
DuoTone = 9,
|
|
|
|
|
|
|
|
Unknown = 65535
|
2007-04-11 16:47:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class VCL_DLLPUBLIC BmpFilterParam
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2015-11-26 10:01:20 +02:00
|
|
|
BmpFilterParam( sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) :
|
2016-12-21 17:06:15 +02:00
|
|
|
meFilter( BmpFilter::Unknown ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ) {}
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2015-11-26 10:01:20 +02:00
|
|
|
BmpFilterParam( sal_uInt8 cSolarGreyThreshold, sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) :
|
2016-12-21 17:06:15 +02:00
|
|
|
meFilter( BmpFilter::Solarize ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ),
|
2007-04-11 16:47:49 +00:00
|
|
|
mcSolarGreyThreshold( cSolarGreyThreshold ) {}
|
|
|
|
|
2015-11-26 10:01:20 +02:00
|
|
|
BmpFilterParam( double nRadius, sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) :
|
2016-12-21 17:06:15 +02:00
|
|
|
meFilter( BmpFilter::Smooth ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ),
|
2012-06-15 22:54:02 +02:00
|
|
|
mnRadius( nRadius ) {}
|
2012-06-15 07:22:32 +02:00
|
|
|
|
2015-11-26 10:01:20 +02:00
|
|
|
BmpFilterParam( sal_uInt16 nSepiaPercent, sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) :
|
2016-12-21 17:06:15 +02:00
|
|
|
meFilter( BmpFilter::Sepia ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ),
|
2015-11-25 08:42:22 +02:00
|
|
|
mnSepiaPercent( nSepiaPercent )
|
2015-11-25 14:03:28 +02:00
|
|
|
{
|
|
|
|
assert(nSepiaPercent<=100);
|
|
|
|
}
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2015-11-26 10:01:20 +02:00
|
|
|
BmpFilterParam( const Size& rMosaicTileSize, sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) :
|
2016-12-21 17:06:15 +02:00
|
|
|
meFilter( BmpFilter::Mosaic ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd )
|
2007-04-11 16:47:49 +00:00
|
|
|
{
|
|
|
|
maMosaicTileSize.mnTileWidth = rMosaicTileSize.Width();
|
|
|
|
maMosaicTileSize.mnTileHeight= rMosaicTileSize.Height();
|
|
|
|
}
|
2015-11-26 10:01:20 +02:00
|
|
|
BmpFilterParam( sal_uInt16 nEmbossAzimuthAngle100, sal_uInt16 nEmbossElevationAngle100,
|
|
|
|
sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) :
|
2016-12-21 17:06:15 +02:00
|
|
|
meFilter( BmpFilter::EmbossGrey ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd )
|
2007-04-11 16:47:49 +00:00
|
|
|
{
|
|
|
|
maEmbossAngles.mnAzimuthAngle100 = nEmbossAzimuthAngle100;
|
|
|
|
maEmbossAngles.mnElevationAngle100 = nEmbossElevationAngle100;
|
|
|
|
}
|
|
|
|
|
2014-09-28 22:33:50 +10:00
|
|
|
private:
|
2014-09-27 14:52:40 +02:00
|
|
|
friend class ::Bitmap;
|
2014-09-28 22:33:50 +10:00
|
|
|
friend class BitmapEx;
|
|
|
|
friend class Animation;
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2014-09-28 22:33:50 +10:00
|
|
|
private:
|
|
|
|
BmpFilter meFilter;
|
|
|
|
sal_uLong mnProgressStart;
|
|
|
|
sal_uLong mnProgressEnd;
|
|
|
|
|
|
|
|
public:
|
|
|
|
struct MosaicTileSize
|
|
|
|
{
|
|
|
|
sal_uLong mnTileWidth;
|
|
|
|
sal_uLong mnTileHeight;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EmbossAngles
|
|
|
|
{
|
|
|
|
sal_uInt16 mnAzimuthAngle100;
|
|
|
|
sal_uInt16 mnElevationAngle100;
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
union
|
|
|
|
{
|
|
|
|
sal_uInt16 mnSepiaPercent;
|
|
|
|
sal_uInt8 mcSolarGreyThreshold;
|
|
|
|
double mnRadius;
|
|
|
|
|
|
|
|
MosaicTileSize maMosaicTileSize;
|
|
|
|
EmbossAngles maEmbossAngles;
|
|
|
|
};
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2014-09-28 22:33:50 +10:00
|
|
|
};
|
|
|
|
|
2014-12-03 17:02:37 -05:00
|
|
|
class BitmapInfoAccess;
|
2007-04-11 16:47:49 +00:00
|
|
|
class BitmapReadAccess;
|
|
|
|
class BitmapWriteAccess;
|
|
|
|
class BitmapPalette;
|
|
|
|
class ImpBitmap;
|
|
|
|
class Color;
|
|
|
|
class ResId;
|
|
|
|
class GDIMetaFile;
|
|
|
|
class AlphaMask;
|
|
|
|
class OutputDevice;
|
|
|
|
class SalBitmap;
|
2015-07-09 21:02:48 +02:00
|
|
|
namespace vcl
|
|
|
|
{
|
|
|
|
class Kernel;
|
|
|
|
}
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
struct BitmapSystemData
|
|
|
|
{
|
2016-02-16 14:14:43 +02:00
|
|
|
#if defined(_WIN32)
|
2007-04-11 16:47:49 +00:00
|
|
|
void* pDIB; // device independent byte buffer
|
|
|
|
void* pDDB; // if not NULL then this is actually an HBITMAP
|
2013-01-11 11:07:23 +02:00
|
|
|
#elif defined( MACOSX ) || defined( IOS )
|
2008-06-24 10:37:34 +00:00
|
|
|
void* rImageContext; //Image context (CGContextRef)
|
2007-04-11 16:47:49 +00:00
|
|
|
#else
|
|
|
|
void* aPixmap;
|
|
|
|
#endif
|
|
|
|
int mnWidth;
|
|
|
|
int mnHeight;
|
|
|
|
};
|
|
|
|
|
|
|
|
class VCL_DLLPUBLIC Bitmap
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2014-09-28 22:33:50 +10:00
|
|
|
Bitmap();
|
|
|
|
Bitmap( const Bitmap& rBitmap );
|
2015-11-10 10:28:29 +01:00
|
|
|
Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal = nullptr );
|
2014-09-28 22:33:50 +10:00
|
|
|
Bitmap( const ResId& rResId );
|
|
|
|
Bitmap( SalBitmap* pSalBitmap );
|
|
|
|
virtual ~Bitmap();
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
Bitmap& operator=( const Bitmap& rBitmap );
|
2016-09-02 09:26:53 +01:00
|
|
|
Bitmap& operator=( Bitmap&& rBitmap );
|
2014-02-21 12:53:51 +01:00
|
|
|
inline bool operator!() const;
|
|
|
|
inline bool operator==( const Bitmap& rBitmap ) const;
|
|
|
|
inline bool operator!=( const Bitmap& rBitmap ) const;
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool IsEqual( const Bitmap& rBmp ) const;
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
inline bool IsEmpty() const;
|
2007-04-11 16:47:49 +00:00
|
|
|
void SetEmpty();
|
|
|
|
|
|
|
|
inline const MapMode& GetPrefMapMode() const;
|
|
|
|
inline void SetPrefMapMode( const MapMode& rMapMode );
|
|
|
|
|
|
|
|
inline const Size& GetPrefSize() const;
|
|
|
|
inline void SetPrefSize( const Size& rSize );
|
|
|
|
|
|
|
|
Size GetSizePixel() const;
|
|
|
|
|
2014-09-28 22:33:50 +10:00
|
|
|
sal_uInt16 GetBitCount() const;
|
|
|
|
inline sal_uLong GetColorCount() const;
|
|
|
|
inline sal_uLong GetSizeBytes() const;
|
2014-02-21 12:53:51 +01:00
|
|
|
bool HasGreyPalette() const;
|
2007-04-11 16:47:49 +00:00
|
|
|
/** get system dependent bitmap data
|
|
|
|
|
|
|
|
@param rData
|
|
|
|
The system dependent BitmapSystemData structure to be filled
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true if the bitmap has a valid system object (e.g. not empty)
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
|
|
|
bool GetSystemData( BitmapSystemData& rData ) const;
|
|
|
|
|
2015-08-27 15:25:11 +02:00
|
|
|
BitmapChecksum GetChecksum() const;
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
Bitmap CreateDisplayBitmap( OutputDevice* pDisplay );
|
|
|
|
|
2014-09-28 22:33:50 +10:00
|
|
|
static const BitmapPalette&
|
|
|
|
GetGreyPalette( int nEntries );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-09-28 22:33:50 +10:00
|
|
|
bool MakeMono( sal_uInt8 cThreshold );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
/** Convert bitmap format
|
|
|
|
|
|
|
|
@param eConversion
|
|
|
|
The format this bitmap should be converted to.
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the conversion was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Convert( BmpConversion eConversion );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Reduce number of colors for the bitmap
|
|
|
|
|
|
|
|
@param nNewColorCount
|
|
|
|
Maximal number of bitmap colors after the reduce operation
|
|
|
|
|
|
|
|
@param eReduce
|
|
|
|
Algorithm to use for color reduction
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the color reduction operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-09-28 22:33:50 +10:00
|
|
|
bool ReduceColors(
|
|
|
|
sal_uInt16 nNewColorCount,
|
|
|
|
BmpReduce eReduce = BMP_REDUCE_SIMPLE );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Apply a dither algorithm to the bitmap
|
|
|
|
|
|
|
|
This method dithers the bitmap inplace, i.e. a true color
|
|
|
|
bitmap is converted to a paletted bitmap, reducing the color
|
|
|
|
deviation by error diffusion.
|
|
|
|
|
|
|
|
@param nDitherFlags
|
|
|
|
The algorithm to be used for dithering
|
|
|
|
*/
|
2015-05-06 10:52:59 +02:00
|
|
|
bool Dither( BmpDitherFlags nDitherFlags = BmpDitherFlags::Matrix );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Crop the bitmap
|
|
|
|
|
|
|
|
@param rRectPixel
|
|
|
|
A rectangle specifying the crop amounts on all four sides of
|
|
|
|
the bitmap. If the upper left corner of the bitmap is assigned
|
|
|
|
(0,0), then this method cuts out the given rectangle from the
|
|
|
|
bitmap. Note that the rectangle is clipped to the bitmap's
|
|
|
|
dimension, i.e. negative left,top rectangle coordinates or
|
|
|
|
exceeding width or height is ignored.
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if cropping was performed successfully. If
|
2007-04-11 16:47:49 +00:00
|
|
|
nothing had to be cropped, because e.g. the crop rectangle
|
2014-02-24 01:53:13 +11:00
|
|
|
included the bitmap, false is returned, too!
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Crop( const Rectangle& rRectPixel );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Expand the bitmap by pixel padding
|
|
|
|
|
|
|
|
@param nDX
|
|
|
|
Number of pixel to pad at the right border of the bitmap
|
|
|
|
|
|
|
|
@param nDY
|
|
|
|
Number of scanlines to pad at the bottom border of the bitmap
|
|
|
|
|
|
|
|
@param pInitColor
|
|
|
|
Color to use for padded pixel
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if padding was performed successfully. false is
|
2007-04-11 16:47:49 +00:00
|
|
|
not only returned when the operation failed, but also if
|
|
|
|
nothing had to be done, e.g. because nDX and nDY were zero.
|
|
|
|
*/
|
2014-09-28 22:33:50 +10:00
|
|
|
bool Expand(
|
|
|
|
sal_uLong nDX, sal_uLong nDY,
|
2015-11-10 10:28:29 +01:00
|
|
|
const Color* pInitColor = nullptr );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Copy a rectangular area from another bitmap
|
|
|
|
|
|
|
|
@param rRectDst
|
|
|
|
Destination rectangle in this bitmap. This is clipped to the
|
|
|
|
bitmap dimensions.
|
|
|
|
|
|
|
|
@param rRectSrc
|
|
|
|
Source rectangle in pBmpSrc. This is clipped to the source
|
|
|
|
bitmap dimensions. Note further that no scaling takes place
|
|
|
|
during this copy operation, i.e. only the minimum of source
|
|
|
|
and destination rectangle's width and height are used.
|
|
|
|
|
|
|
|
@param pBmpSrc
|
|
|
|
The source bitmap to copy from. If this argument is NULL, or
|
|
|
|
equal to the object this method is called on, copying takes
|
|
|
|
place within the same bitmap.
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation completed successfully. false
|
2007-04-11 16:47:49 +00:00
|
|
|
is not only returned when the operation failed, but also if
|
|
|
|
nothing had to be done, e.g. because one of the rectangles are
|
|
|
|
empty.
|
|
|
|
*/
|
2014-09-28 22:33:50 +10:00
|
|
|
bool CopyPixel(
|
|
|
|
const Rectangle& rRectDst,
|
|
|
|
const Rectangle& rRectSrc,
|
2015-11-10 10:28:29 +01:00
|
|
|
const Bitmap* pBmpSrc = nullptr );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2014-09-28 22:33:50 +10:00
|
|
|
bool CopyPixel_AlphaOptimized(
|
|
|
|
const Rectangle& rRectDst,
|
|
|
|
const Rectangle& rRectSrc,
|
2016-08-30 15:34:35 +02:00
|
|
|
const Bitmap* pBmpSrc );
|
2014-07-10 10:37:08 +02:00
|
|
|
|
2007-04-11 16:47:49 +00:00
|
|
|
/** Perform boolean operations with another bitmap
|
|
|
|
|
|
|
|
@param rMask
|
|
|
|
The mask bitmap in the selected combine operation
|
|
|
|
|
|
|
|
@param eCombine
|
|
|
|
The combine operation to perform on the bitmap
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-09-28 22:33:50 +10:00
|
|
|
bool CombineSimple(
|
|
|
|
const Bitmap& rMask,
|
|
|
|
BmpCombine eCombine );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Alpha-blend the given bitmap against a specified uniform
|
|
|
|
background color.
|
|
|
|
|
|
|
|
@attention This method might convert paletted bitmaps to
|
|
|
|
truecolor, to be able to represent every necessary color. Note
|
|
|
|
that during alpha blending, lots of colors not originally
|
|
|
|
included in the bitmap can be generated.
|
|
|
|
|
|
|
|
@param rAlpha
|
|
|
|
Alpha mask to blend with
|
|
|
|
|
|
|
|
@param rBackgroundColor
|
|
|
|
Background color to use for every pixel during alpha blending
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if blending was successful, false otherwise
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-09-28 22:33:50 +10:00
|
|
|
bool Blend(
|
|
|
|
const AlphaMask& rAlpha,
|
|
|
|
const Color& rBackgroundColor );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Fill the entire bitmap with the given color
|
|
|
|
|
|
|
|
@param rFillColor
|
|
|
|
Color value to use for filling
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Erase( const Color& rFillColor );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Perform the Invert operation on every pixel
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Invert();
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Mirror the bitmap
|
|
|
|
|
|
|
|
@param nMirrorFlags
|
|
|
|
About which axis (horizontal, vertical, or both) to mirror
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2015-05-06 09:00:50 +02:00
|
|
|
bool Mirror( BmpMirrorFlags nMirrorFlags );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Scale the bitmap
|
|
|
|
|
|
|
|
@param rNewSize
|
|
|
|
The resulting size of the scaled bitmap
|
|
|
|
|
|
|
|
@param nScaleFlag
|
|
|
|
The algorithm to be used for scaling
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2015-05-05 14:09:24 +02:00
|
|
|
bool Scale( const Size& rNewSize, BmpScaleFlag nScaleFlag = BmpScaleFlag::Default );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Scale the bitmap
|
|
|
|
|
|
|
|
@param rScaleX
|
|
|
|
The scale factor in x direction.
|
|
|
|
|
|
|
|
@param rScaleY
|
|
|
|
The scale factor in y direction.
|
|
|
|
|
2014-02-04 19:55:39 +00:00
|
|
|
@param nScaleFlag
|
2015-05-05 14:09:24 +02:00
|
|
|
Method of scaling - it is recommended that either BmpScaleFlag::Default or BmpScaleFlag::BestQuality be used.
|
2014-02-04 19:55:39 +00:00
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2015-05-05 14:09:24 +02:00
|
|
|
bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag = BmpScaleFlag::Default );
|
2012-07-24 22:01:18 +02:00
|
|
|
|
2015-01-17 20:46:55 +01:00
|
|
|
/**
|
|
|
|
Returns true if bitmap scaling is considered to be fast.
|
|
|
|
|
|
|
|
Currently this returns true if OpenGL is used for scaling, otherwise false (CPU scaling is slower).
|
|
|
|
|
|
|
|
@since 4.5
|
|
|
|
*/
|
|
|
|
static bool HasFastScale();
|
|
|
|
|
2015-07-02 18:23:08 +02:00
|
|
|
// Adapt the BitCount of rNew to BitCount of total, including grey or color palette
|
2012-10-30 11:02:38 +00:00
|
|
|
// Can be used to create alpha/mask bitmaps after their processing in 24bit
|
2014-09-28 22:33:50 +10:00
|
|
|
void AdaptBitCount(Bitmap& rNew) const;
|
2012-10-30 11:02:38 +00:00
|
|
|
|
2007-04-11 16:47:49 +00:00
|
|
|
/** Rotate bitmap by the specified angle
|
|
|
|
|
|
|
|
@param nAngle10
|
|
|
|
The rotation angle in tenth of a degree. The bitmap is always rotated around its center.
|
|
|
|
|
|
|
|
@param rFillColor
|
|
|
|
The color to use for filling blank areas. During rotation, the
|
|
|
|
bitmap is enlarged such that the whole rotation result fits
|
|
|
|
in. The empty spaces around that rotated original bitmap are
|
|
|
|
then filled with this color.
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Rotate( long nAngle10, const Color& rFillColor );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Create on-off mask from bitmap
|
|
|
|
|
|
|
|
This method creates a bitmask from the bitmap, where every
|
|
|
|
pixel that equals rTransColor is set transparent, the rest
|
|
|
|
opaque.
|
|
|
|
|
|
|
|
@param rTransColor
|
|
|
|
Color value where the bitmask should be transparent
|
|
|
|
|
|
|
|
@param nTol
|
|
|
|
Tolerance value. Specifies the maximal difference between
|
|
|
|
rTransColor and the individual pixel values, such that the
|
|
|
|
corresponding pixel is still regarded transparent.
|
|
|
|
|
|
|
|
@return the resulting bitmask.
|
|
|
|
*/
|
2011-01-12 15:07:10 +01:00
|
|
|
Bitmap CreateMask( const Color& rTransColor, sal_uLong nTol = 0UL ) const;
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Create region of similar colors in a given rectangle
|
|
|
|
|
|
|
|
@param rColor
|
|
|
|
All pixel which have this color are included in the calculated region
|
|
|
|
|
|
|
|
@param rRect
|
|
|
|
The rectangle within which matching pixel are looked for. This
|
|
|
|
rectangle is always clipped to the bitmap dimensions.
|
|
|
|
|
|
|
|
@return the generated region.
|
|
|
|
*/
|
2014-09-27 14:52:40 +02:00
|
|
|
vcl::Region CreateRegion( const Color& rColor, const Rectangle& rRect ) const;
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Replace all pixel where the given mask is on with the specified color
|
|
|
|
|
|
|
|
@param rMask
|
|
|
|
Mask specifying which pixel should be replaced
|
|
|
|
|
|
|
|
@param rReplaceColor
|
|
|
|
Color to be placed in all changed pixel
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Replace( const Bitmap& rMask, const Color& rReplaceColor );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Merge bitmap with given background color according to specified alpha mask
|
|
|
|
|
|
|
|
@param rAlpha
|
|
|
|
Alpha mask specifying the amount of background color to merge in
|
|
|
|
|
|
|
|
@param rMergeColor
|
|
|
|
Background color to be used for merging
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Replace( const AlphaMask& rAlpha, const Color& rMergeColor );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Replace all pixel having the search color with the specified color
|
|
|
|
|
|
|
|
@param rSearchColor
|
|
|
|
Color specifying which pixel should be replaced
|
|
|
|
|
|
|
|
@param rReplaceColor
|
|
|
|
Color to be placed in all changed pixel
|
|
|
|
|
|
|
|
@param nTol
|
|
|
|
Tolerance value. Specifies the maximal difference between
|
|
|
|
rSearchColor and the individual pixel values, such that the
|
|
|
|
corresponding pixel is still regarded a match.
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol = 0 );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Replace all pixel having one the search colors with the corresponding replace color
|
|
|
|
|
2014-02-04 19:55:39 +00:00
|
|
|
@param pSearchColors
|
2007-04-11 16:47:49 +00:00
|
|
|
Array of colors specifying which pixel should be replaced
|
|
|
|
|
2014-02-04 19:55:39 +00:00
|
|
|
@param rReplaceColors
|
2007-04-11 16:47:49 +00:00
|
|
|
Array of colors to be placed in all changed pixel
|
|
|
|
|
|
|
|
@param nColorCount
|
|
|
|
Size of the aforementioned color arrays
|
|
|
|
|
2014-02-04 19:55:39 +00:00
|
|
|
@param pTols
|
2007-04-11 16:47:49 +00:00
|
|
|
Tolerance value. Specifies the maximal difference between
|
|
|
|
pSearchColor colors and the individual pixel values, such that
|
|
|
|
the corresponding pixel is still regarded a match.
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-09-28 22:33:50 +10:00
|
|
|
bool Replace(
|
|
|
|
const Color* pSearchColors,
|
|
|
|
const Color* rReplaceColors,
|
|
|
|
sal_uLong nColorCount,
|
2015-11-10 10:28:29 +01:00
|
|
|
sal_uLong* pTols = nullptr );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Convert the bitmap to a meta file
|
|
|
|
|
|
|
|
This works by putting continuous areas of the same color into
|
|
|
|
polygons painted in this color, by tracing the area's bounding
|
|
|
|
line.
|
|
|
|
|
|
|
|
@param rMtf
|
|
|
|
The resulting meta file
|
|
|
|
|
|
|
|
@param cReduce
|
|
|
|
If non-null, minimal size of bound rects for individual polygons. Smaller ones are ignored.
|
|
|
|
|
|
|
|
@param pProgress
|
|
|
|
A callback for showing the progress of the vectorization
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-09-28 22:33:50 +10:00
|
|
|
bool Vectorize(
|
|
|
|
GDIMetaFile& rMtf,
|
2016-08-30 15:34:35 +02:00
|
|
|
sal_uInt8 cReduce,
|
2016-09-14 12:26:36 +02:00
|
|
|
const Link<long,void>* pProgress );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Change various global color characteristics
|
|
|
|
|
|
|
|
@param nLuminancePercent
|
|
|
|
Percent of luminance change, valid range [-100,100]. Values outside this range are clipped to the valid range.
|
|
|
|
|
|
|
|
@param nContrastPercent
|
|
|
|
Percent of contrast change, valid range [-100,100]. Values outside this range are clipped to the valid range.
|
|
|
|
|
|
|
|
@param nChannelRPercent
|
|
|
|
Percent of red channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
|
|
|
|
|
|
|
|
@param nChannelGPercent
|
|
|
|
Percent of green channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
|
|
|
|
|
|
|
|
@param nChannelBPercent
|
|
|
|
Percent of blue channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
|
|
|
|
|
|
|
|
@param fGamma
|
|
|
|
Exponent of the gamma function applied to the bitmap. The
|
|
|
|
value 1.0 results in no change, the valid range is
|
|
|
|
(0.0,10.0]. Values outside this range are regarded as 1.0.
|
|
|
|
|
|
|
|
@param bInvert
|
2014-02-24 01:53:13 +11:00
|
|
|
If true, invert the channel values with the logical 'not' operator
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2014-04-18 20:46:34 +02:00
|
|
|
@param msoBrightness
|
|
|
|
Use the same formula for brightness as used by MSOffice.
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-09-28 22:33:50 +10:00
|
|
|
bool Adjust(
|
2016-08-30 15:34:35 +02:00
|
|
|
short nLuminancePercent,
|
2014-09-28 22:33:50 +10:00
|
|
|
short nContrastPercent = 0,
|
|
|
|
short nChannelRPercent = 0,
|
|
|
|
short nChannelGPercent = 0,
|
|
|
|
short nChannelBPercent = 0,
|
|
|
|
double fGamma = 1.0,
|
|
|
|
bool bInvert = false,
|
|
|
|
bool msoBrightness = false );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
/** Apply specified filter to the bitmap
|
|
|
|
|
|
|
|
@param eFilter
|
|
|
|
The filter algorithm to apply
|
|
|
|
|
|
|
|
@param pFilterParam
|
|
|
|
Various parameter for the different bitmap filter algorithms
|
|
|
|
|
2014-02-24 01:53:13 +11:00
|
|
|
@return true, if the operation was completed successfully.
|
2007-04-11 16:47:49 +00:00
|
|
|
*/
|
2014-09-28 22:33:50 +10:00
|
|
|
bool Filter(
|
|
|
|
BmpFilter eFilter,
|
2015-11-10 10:28:29 +01:00
|
|
|
const BmpFilterParam* pFilterParam = nullptr );
|
2014-09-28 22:33:50 +10:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
SAL_DLLPRIVATE void ImplMakeUnique();
|
2016-04-14 09:23:37 +02:00
|
|
|
const std::shared_ptr<ImpBitmap>& ImplGetImpBitmap() const { return mxImpBmp; }
|
2016-04-11 15:29:25 +02:00
|
|
|
SAL_DLLPRIVATE void ImplSetImpBitmap( const std::shared_ptr<ImpBitmap>& xImpBmp );
|
2014-09-28 22:33:50 +10:00
|
|
|
SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap );
|
|
|
|
|
|
|
|
SAL_DLLPRIVATE void ImplAdaptBitCount(Bitmap& rNew) const;
|
|
|
|
SAL_DLLPRIVATE bool ImplScaleFast( const double& rScaleX, const double& rScaleY );
|
|
|
|
SAL_DLLPRIVATE bool ImplScaleInterpolate( const double& rScaleX, const double& rScaleY );
|
|
|
|
|
|
|
|
SAL_DLLPRIVATE bool ImplConvolutionPass(
|
|
|
|
Bitmap& aNewBitmap,
|
|
|
|
BitmapReadAccess* pReadAcc,
|
|
|
|
int aNumberOfContributions,
|
|
|
|
double* pWeights,
|
|
|
|
int* pPixels,
|
|
|
|
int* pCount );
|
|
|
|
|
|
|
|
SAL_DLLPRIVATE bool ImplMakeMono( sal_uInt8 cThreshold );
|
|
|
|
SAL_DLLPRIVATE bool ImplMakeMonoDither();
|
|
|
|
SAL_DLLPRIVATE bool ImplMakeGreyscales( sal_uInt16 nGreyscales );
|
2015-11-10 10:28:29 +01:00
|
|
|
SAL_DLLPRIVATE bool ImplConvertUp( sal_uInt16 nBitCount, Color* pExtColor = nullptr );
|
|
|
|
SAL_DLLPRIVATE bool ImplConvertDown( sal_uInt16 nBitCount, Color* pExtColor = nullptr );
|
2014-09-28 22:33:50 +10:00
|
|
|
SAL_DLLPRIVATE bool ImplConvertGhosted();
|
|
|
|
SAL_DLLPRIVATE bool ImplDitherMatrix();
|
|
|
|
SAL_DLLPRIVATE bool ImplDitherFloyd();
|
|
|
|
SAL_DLLPRIVATE bool ImplDitherFloyd16();
|
|
|
|
SAL_DLLPRIVATE bool ImplReduceSimple( sal_uInt16 nColorCount );
|
|
|
|
SAL_DLLPRIVATE bool ImplReducePopular( sal_uInt16 nColorCount );
|
|
|
|
SAL_DLLPRIVATE bool ImplReduceMedian( sal_uInt16 nColorCount );
|
|
|
|
SAL_DLLPRIVATE void ImplMedianCut(
|
|
|
|
sal_uLong* pColBuf,
|
|
|
|
BitmapPalette& rPal,
|
|
|
|
long nR1, long nR2, long nG1, long nG2, long nB1, long nB2,
|
|
|
|
long nColors, long nPixels, long& rIndex );
|
|
|
|
|
2016-11-15 09:46:46 +02:00
|
|
|
SAL_DLLPRIVATE bool ImplConvolute3( const long* pMatrix );
|
2015-09-21 10:06:26 +02:00
|
|
|
|
|
|
|
SAL_DLLPRIVATE bool ImplMedianFilter();
|
|
|
|
SAL_DLLPRIVATE bool ImplSobelGrey();
|
|
|
|
SAL_DLLPRIVATE bool ImplEmbossGrey( const BmpFilterParam* pFilterParam );
|
|
|
|
SAL_DLLPRIVATE bool ImplSolarize( const BmpFilterParam* pFilterParam );
|
|
|
|
SAL_DLLPRIVATE bool ImplSepia( const BmpFilterParam* pFilterParam );
|
|
|
|
SAL_DLLPRIVATE bool ImplMosaic( const BmpFilterParam* pFilterParam );
|
|
|
|
SAL_DLLPRIVATE bool ImplPopArt();
|
2014-09-28 22:33:50 +10:00
|
|
|
|
2016-08-30 15:34:35 +02:00
|
|
|
SAL_DLLPRIVATE bool ImplSeparableBlurFilter( const double aRadius );
|
|
|
|
SAL_DLLPRIVATE bool ImplSeparableUnsharpenFilter( const double aRadius );
|
2014-09-28 22:33:50 +10:00
|
|
|
SAL_DLLPRIVATE bool ImplDuotoneFilter( const sal_uLong nColorOne, sal_uLong nColorTwo );
|
2016-10-07 11:57:50 +02:00
|
|
|
SAL_DLLPRIVATE static void ImplBlurContributions(
|
2014-09-28 22:33:50 +10:00
|
|
|
const int aSize,
|
|
|
|
const int aNumberOfContributions,
|
|
|
|
double* pBlurVector,
|
|
|
|
double*& pWeights,
|
|
|
|
int*& pPixels,
|
|
|
|
int*& pCount );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
|
|
|
public:
|
2013-04-16 08:41:07 +00:00
|
|
|
|
2014-12-03 17:02:37 -05:00
|
|
|
BitmapInfoAccess* AcquireInfoAccess();
|
2007-04-11 16:47:49 +00:00
|
|
|
BitmapReadAccess* AcquireReadAccess();
|
|
|
|
BitmapWriteAccess* AcquireWriteAccess();
|
2015-04-01 16:23:59 +02:00
|
|
|
static void ReleaseAccess( BitmapInfoAccess* pAccess );
|
2007-04-11 16:47:49 +00:00
|
|
|
|
2015-03-29 18:23:28 +09:00
|
|
|
typedef vcl::ScopedBitmapAccess<BitmapReadAccess, Bitmap, &Bitmap::AcquireReadAccess> ScopedReadAccess;
|
|
|
|
typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap, &Bitmap::AcquireWriteAccess> ScopedWriteAccess;
|
|
|
|
typedef vcl::ScopedBitmapAccess<BitmapInfoAccess, Bitmap, &Bitmap::AcquireInfoAccess> ScopedInfoAccess;
|
2014-09-28 22:33:50 +10:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2016-02-16 10:39:28 +00:00
|
|
|
std::shared_ptr<ImpBitmap> mxImpBmp;
|
2014-09-28 22:33:50 +10:00
|
|
|
MapMode maPrefMapMode;
|
|
|
|
Size maPrefSize;
|
|
|
|
|
2007-04-11 16:47:49 +00:00
|
|
|
};
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
inline bool Bitmap::operator!() const
|
2007-04-11 16:47:49 +00:00
|
|
|
{
|
2016-02-16 10:39:28 +00:00
|
|
|
return( mxImpBmp == nullptr );
|
2007-04-11 16:47:49 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
inline bool Bitmap::operator==( const Bitmap& rBitmap ) const
|
2007-04-11 16:47:49 +00:00
|
|
|
{
|
2016-02-16 10:39:28 +00:00
|
|
|
return( rBitmap.mxImpBmp == mxImpBmp );
|
2007-04-11 16:47:49 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
inline bool Bitmap::operator!=( const Bitmap& rBitmap ) const
|
2007-04-11 16:47:49 +00:00
|
|
|
{
|
2016-02-16 10:39:28 +00:00
|
|
|
return( rBitmap.mxImpBmp != mxImpBmp );
|
2007-04-11 16:47:49 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
inline bool Bitmap::IsEmpty() const
|
2007-04-11 16:47:49 +00:00
|
|
|
{
|
2016-02-16 10:39:28 +00:00
|
|
|
return( mxImpBmp == nullptr );
|
2007-04-11 16:47:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline const MapMode& Bitmap::GetPrefMapMode() const
|
|
|
|
{
|
|
|
|
return maPrefMapMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Bitmap::SetPrefMapMode( const MapMode& rMapMode )
|
|
|
|
{
|
|
|
|
maPrefMapMode = rMapMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const Size& Bitmap::GetPrefSize() const
|
|
|
|
{
|
|
|
|
return maPrefSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Bitmap::SetPrefSize( const Size& rSize )
|
|
|
|
{
|
|
|
|
maPrefSize = rSize;
|
|
|
|
}
|
|
|
|
|
2011-01-12 15:07:10 +01:00
|
|
|
inline sal_uLong Bitmap::GetColorCount() const
|
2007-04-11 16:47:49 +00:00
|
|
|
{
|
2014-11-30 23:37:56 +01:00
|
|
|
return( (sal_uLong)1 << (sal_uLong) GetBitCount() );
|
2007-04-11 16:47:49 +00:00
|
|
|
}
|
|
|
|
|
2011-01-12 15:07:10 +01:00
|
|
|
inline sal_uLong Bitmap::GetSizeBytes() const
|
2007-04-11 16:47:49 +00:00
|
|
|
{
|
|
|
|
const Size aSizePix( GetSizePixel() );
|
2011-01-12 15:07:10 +01:00
|
|
|
return( ( (sal_uLong) aSizePix.Width() * aSizePix.Height() * GetBitCount() ) >> 3UL );
|
2007-04-11 16:47:49 +00:00
|
|
|
}
|
|
|
|
|
2013-10-23 19:10:20 +02:00
|
|
|
#endif // INCLUDED_VCL_BITMAP_HXX
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|