krita/ui

KisPrescaledProjection Class Reference

KisPrescaledProjection is responsible for keeping around a prescaled QImage representation that is always suitable for painting onto the canvas. More...

#include <kis_prescaled_projection.h>

Inheritance diagram for KisPrescaledProjection:

List of all members.

Public Slots

void documentOffsetMoved (const QPoint &documentOffset)
void initBackend (bool useMipmapping, bool cacheKisImageAsQImage)
QRect preScale (const QRect &rc)
void preScale ()
void resizePrescaledImage (const QSize &newSize)
void setCurrentNode (const KisNodeSP node)
void setImageSize (qint32 w, qint32 h)
void setMonitorProfile (const KoColorProfile *profile)
void showCurrentMask (bool showMask)
QRect updateCanvasProjection (const QRect &rc)
void updateSettings ()

Public Member Functions

 KisPrescaledProjection ()
virtual ~KisPrescaledProjection ()
bool drawCheckers () const
QPixmap prescaledPixmap () const
QImage prescaledQImage () const
void setDrawCheckers (bool drawCheckers)
void setImage (KisImageWSP image)
void setViewConverter (KoViewConverter *viewConverter)
void updateDocumentOrigin (const QPoint &documentOrigin)

Detailed Description

KisPrescaledProjection is responsible for keeping around a prescaled QImage representation that is always suitable for painting onto the canvas.

Optionally, the KisPrescaledProjection can also provide a QPixmap with the checkered background blended in.

Optionally, the projection can also draw the mask and selection masks and the selection outline.

The following scaling methods are supported:

  • Qt's smooth scaling
  • Our own smooth scaling (similar to Blitz, port to using Blitz)
  • Our own sampling (similar to Blitz, port to using Blitz)
  • nearest-neighbour sampling on KisImage directly (doesn't need a QImage of the visible area)

Note: the export macro is only for the unittest.

Note: with any method except for nearest-neighbour sampling Krita keeps a QImage the size of the unscaled image in memory. This should become either a QImage the size of the nearest pyramid level or a tiled QImage representation like the OpenGL image textures.

Definition at line 72 of file kis_prescaled_projection.h.


Constructor & Destructor Documentation

KisPrescaledProjection::KisPrescaledProjection (  ) 

Definition at line 129 of file kis_prescaled_projection.cpp.

KisPrescaledProjection::~KisPrescaledProjection (  )  [virtual]

Definition at line 137 of file kis_prescaled_projection.cpp.


Member Function Documentation

void KisPrescaledProjection::documentOffsetMoved ( const QPoint documentOffset  )  [slot]

Called whenever the view widget needs to show a different part of the document.

Parameters:
documentOffset the offset in widget pixels

Definition at line 219 of file kis_prescaled_projection.cpp.

bool KisPrescaledProjection::drawCheckers (  )  const
Returns:
true if the prescaled projection is set to draw the checkers, too. In that case, prescaledPixmap returns a complete pixmap (which doesn't have transparency) and prescaledQImage returns an empty QImage. This setting is false initially.

Definition at line 156 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::initBackend ( bool  useMipmapping,
bool  cacheKisImageAsQImage 
) [slot]

Called from updateSettings to set up chosen backend: KisProjectionCache or KisImagePyramidBased.

Definition at line 182 of file kis_prescaled_projection.cpp.

QRect KisPrescaledProjection::preScale ( const QRect rc  )  [slot]

preScale and draw onto the scaled projection the specified rect, in canvas view pixels.

Definition at line 357 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::preScale (  )  [slot]

Called whenever the zoom level changes or another chunk of the image becomes visible.

The currently visible area of the image is complete scaled again.

Definition at line 351 of file kis_prescaled_projection.cpp.

QPixmap KisPrescaledProjection::prescaledPixmap (  )  const

The pre-scaled pixmap includes the underlying checker represenation.

It is only generated when the drawCheckers() is true, otherwise it is empty. The prescaled pixmal is exactly as big as the canvas widget in pixels.

Definition at line 167 of file kis_prescaled_projection.cpp.

QImage KisPrescaledProjection::prescaledQImage (  )  const

Return the prescaled QImage.

This image has a transparency channel and is therefore suitable for generated a prescaled representation of an image for the KritaShape. The prescaled image is exactly as big as the canvas widget in pixels.

Definition at line 172 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::resizePrescaledImage ( const QSize newSize  )  [slot]

Resize the prescaled image.

The size is given in canvas widget pixels.

Definition at line 369 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::setCurrentNode ( const KisNodeSP  node  )  [slot]

Set the current node.

Definition at line 340 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::setDrawCheckers ( bool  drawCheckers  ) 

Set the drawCheckers variable to.

Parameters:
drawCheckers. 
See also:
drawCheckers.

Definition at line 162 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::setImage ( KisImageWSP  image  ) 

Definition at line 146 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::setImageSize ( qint32  w,
qint32  h 
) [slot]

Called whenever the size of the KisImage changes.

Definition at line 282 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::setMonitorProfile ( const KoColorProfile *  profile  )  [slot]

Set the current monitor profile.

Definition at line 334 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::setViewConverter ( KoViewConverter viewConverter  ) 

Set the view converter, the object that is responsible for translating between image pixels, document points and view pixels, keeping track of zoom levels.

Definition at line 177 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::showCurrentMask ( bool  showMask  )  [slot]

Toggle whether the selection should be displayed as a mask.

(The display as ants should be a toggle, too, but is done elsewhere.)

Definition at line 345 of file kis_prescaled_projection.cpp.

QRect KisPrescaledProjection::updateCanvasProjection ( const QRect rc  )  [slot]

The image projection has changed, now update the canvas representation of it.

Parameters:
rc the are to be updated in image pixels
Returns:
a rect to be updated in widget pixels

FIXME: leave only one of these intersections: canvas or image

We needn't this stuff ouside KisImage's area. Lets user paint there, anyway we won't show him anything =)

Definition at line 296 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::updateDocumentOrigin ( const QPoint documentOrigin  ) 

Return the intersection of the widget size and the given rect in image pixels converted to widget pixels.

Definition at line 535 of file kis_prescaled_projection.cpp.

void KisPrescaledProjection::updateSettings (  )  [slot]

Called whenever the configuration settings change.

Definition at line 198 of file kis_prescaled_projection.cpp.


The documentation for this class was generated from the following files: