29#include <osl/diagnose.h>
34 : mpOrigGraphic(nullptr)
42 CustomWidgetController::SetDrawingArea(pDrawingArea);
51 rRenderContext.
Erase();
58 const Point aGraphicPosition((aOutputSize.
Width() - aGraphicSize.
Width() ) >> 1,
65 const Point aGraphicPosition((aOutputSize.
Width() - aGraphicSize.
Width()) >> 1,
67 maPreview.
Draw(rRenderContext, aGraphicPosition, aGraphicSize);
91 const double fGrfWH =
static_cast<double>(aGrfSize.
Width()) / aGrfSize.
Height();
92 const double fPreWH =
static_cast<double>(aPreviewSize.
Width()) / aPreviewSize.
Height();
112 if( aBmpEx.
Scale( aGrfSize ) )
127 const OUString& rUIXMLDescription,
const OUString& rID,
129 : GenericDialogController(pParent, rUIXMLDescription, rID)
130 , maTimer(
"cui GraphicFilterDialog maTimer")
132 , mxPreview(new
weld::CustomWeld(*m_xBuilder,
"preview", maPreview))
146 maPreview.GetScaleX(), maPreview.GetScaleY()));
159 sal_uInt16 nTileWidth, sal_uInt16 nTileHeight,
bool bEnhanceEdges)
161 , mxMtrWidth(m_xBuilder->weld_metric_spin_button(
"width",
FieldUnit::
PIXEL))
162 , mxMtrHeight(m_xBuilder->weld_metric_spin_button(
"height",
FieldUnit::
PIXEL))
163 , mxCbxEdges(m_xBuilder->weld_check_button(
"edges"))
165 mxMtrWidth->set_value(nTileWidth, FieldUnit::PIXEL);
169 mxMtrHeight->set_value(nTileHeight, FieldUnit::PIXEL);
181 GetModifyHdl().Call(
nullptr);
186 GetModifyHdl().Call(
nullptr);
190 double fScaleX,
double fScaleY )
228 , mxMtrRadius(m_xBuilder->weld_spin_button(
"radius"))
237 GetModifyHdl().Call(
nullptr);
270 , mxMtrThreshold(m_xBuilder->weld_metric_spin_button(
"value",
FieldUnit::
PERCENT))
271 , mxCbxInvert(m_xBuilder->weld_check_button(
"invert"))
282 GetModifyHdl().Call(
nullptr);
287 GetModifyHdl().Call(
nullptr);
324 sal_uInt16 nSepiaPercent)
326 , mxMtrSepia(m_xBuilder->weld_metric_spin_button(
"value",
FieldUnit::
PERCENT))
328 mxMtrSepia->set_value(nSepiaPercent, FieldUnit::PERCENT);
334 GetModifyHdl().Call(
nullptr);
340 sal_uInt16 nSepiaPct = sal::static_int_cast< sal_uInt16 >(
mxMtrSepia->get_value(FieldUnit::PERCENT));
361 sal_uInt16 nPosterCount)
363 , mxNumPoster(m_xBuilder->weld_spin_button(
"value"))
372 GetModifyHdl().Call(
nullptr);
378 const sal_uInt16 nPosterCount =
static_cast<sal_uInt16
>(
mxNumPoster->get_value());
420 , mxCtlLight(new
weld::CustomWeld(*m_xBuilder,
"lightsource", maCtlLight))
434 sal_uInt16 nAzim, nElev;
438 default: OSL_FAIL(
"svx::GraphicFilterEmboss::GetFilteredGraphic(), unknown Reference Point!" );
440 case RectPoint::LT: nAzim = 4500; nElev = 4500;
break;
441 case RectPoint::MT: nAzim = 9000; nElev = 4500;
break;
442 case RectPoint::RT: nAzim = 13500; nElev = 4500;
break;
443 case RectPoint::LM: nAzim = 0; nElev = 4500;
break;
444 case RectPoint::MM: nAzim = 0; nElev = 9000;
break;
445 case RectPoint::RM: nAzim = 18000; nElev = 4500;
break;
446 case RectPoint::LB: nAzim = 31500; nElev = 4500;
break;
447 case RectPoint::MB: nAzim = 27000; nElev = 4500;
break;
448 case RectPoint::RB: nAzim = 22500; nElev = 4500;
break;
bool ReduceColors(sal_uInt16 nNewColorCount)
static const AllSettings & GetSettings()
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
vcl::PixelFormat getPixelFormat() const
static bool Filter(BitmapEx &rBmpEx, BitmapFilter const &rFilter)
virtual void Resize() override
const Graphic * mpOrigGraphic
Size maOrigGraphicSizePixel
Link< LinkParamNone *, void > maModifyHdl
void SetPreview(const Graphic &rGraphic)
void init(const Graphic *pOrigGraphic, const Link< LinkParamNone *, void > &rLink)
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
CuiGraphicPreviewWindow()
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
void SetModifyHdl(const Link< LinkParamNone *, void > &rHdl)
virtual bool MouseButtonDown(const MouseEvent &rEvt) override
Link< LinkParamNone *, void > maModifyHdl
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
CuiGraphicPreviewWindow maPreview
const Link< LinkParamNone *, void > & GetModifyHdl() const
GraphicFilterDialog(weld::Window *pParent, const OUString &rUIXMLDescription, const OUString &rID, const Graphic &rGraphic)
const Size & GetGraphicSizePixel() const
Link< LinkParamNone *, void > maModifyHdl
virtual ~GraphicFilterEmboss() override
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
GraphicFilterEmboss(weld::Window *pParent, const Graphic &rGraphic, RectPoint eLightSource)
std::unique_ptr< weld::MetricSpinButton > mxMtrWidth
bool IsEnhanceEdges() const
std::unique_ptr< weld::CheckButton > mxCbxEdges
GraphicFilterMosaic(weld::Window *pParent, const Graphic &rGraphic, sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, bool bEnhanceEdges)
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
std::unique_ptr< weld::MetricSpinButton > mxMtrHeight
GraphicFilterPoster(weld::Window *pParent, const Graphic &rGraphic, sal_uInt16 nPosterColorCount)
std::unique_ptr< weld::SpinButton > mxNumPoster
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
std::unique_ptr< weld::MetricSpinButton > mxMtrSepia
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
GraphicFilterSepia(weld::Window *pParent, const Graphic &rGraphic, sal_uInt16 nSepiaPercent)
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
GraphicFilterSmooth(weld::Window *pParent, const Graphic &rGraphic, double nRadius)
std::unique_ptr< weld::SpinButton > mxMtrRadius
GraphicFilterSolarize(weld::Window *pParent, const Graphic &rGraphic, sal_uInt8 nGreyThreshold, bool bInvert)
std::unique_ptr< weld::MetricSpinButton > mxMtrThreshold
std::unique_ptr< weld::CheckButton > mxCbxInvert
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
Animation GetAnimation() const
GraphicType GetType() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
MapMode GetPrefMapMode() const
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
void StartAnimation(OutputDevice &rOutDev, const Point &rDestPt, const Size &rDestSize, tools::Long nExtraData=0, OutputDevice *pFirstFrameOutDev=nullptr)
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
void SetActualRP(RectPoint eNewRP)
virtual bool MouseButtonDown(const MouseEvent &) override
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
RectPoint GetActualRP() const
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual OutputDevice & get_ref_device()=0
Link< ColorFieldControl &, void > maModifyHdl
IMPL_LINK_NOARG(GraphicFilterDialog, ImplPreviewTimeoutHdl, Timer *, void)
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
tools::Long FRound(double fVal)
#define LINK(Instance, Class, Member)
constexpr sal_uInt16 pixelFormatBitCount(PixelFormat ePixelFormat)
constexpr OUStringLiteral PERCENT(u"Percent")