File indexing completed on 2024-05-12 15:56:45

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2006-2007 Thomas Zander <zander@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KOPOSTSCRIPTPAINTDEVICE_H
0008 #define KOPOSTSCRIPTPAINTDEVICE_H
0009 
0010 #include <QPaintDevice>
0011 
0012 #include "kritaflake_export.h"
0013 
0014 /**
0015  * Helper class to disable any screen conversion as that is done in flake.
0016  *
0017  * Flake has the property that all content is always defined in pts. And only when it
0018  * is displayed is it converted to the proper zoom and resolution.
0019  *
0020  * This is in contradiction to the normal behavior of Qt fonts which automatically
0021  * applies DPI on creation.  So this is where this special paint device comes in.
0022  *
0023  * Usage;
0024  *
0025  * For all QFont() and QFontMetrics constructors add an instance of this PaintDevice
0026  * to the constructor if those fonts are to be used for painting in a KoShape inheriting
0027  * class.
0028  *
0029  * Note: never try to actually paint on this paint device, since that will noisily crash.
0030  */
0031 class KRITAFLAKE_EXPORT KoPostscriptPaintDevice : public QPaintDevice
0032 {
0033 public:
0034     /// constructor
0035     KoPostscriptPaintDevice();
0036     /// reimplemented from QPaintDevice
0037     QPaintEngine *paintEngine() const override;
0038     /// reimplemented from QPaintDevice
0039     int metric(QPaintDevice::PaintDeviceMetric metric) const override;
0040 };
0041 
0042 #endif