krita

KisAlphaMask Class Reference

#include <kis_alpha_mask.h>

Inherits KShared.

List of all members.


Detailed Description

KisAlphaMask is intended to create alpha values from a QImage for use in brush creation.

It is not a generic alpha mask that can be used with KisPaintDevices: use a KisSelection for that.

Definition at line 34 of file kis_alpha_mask.h.


Public Member Functions

 KisAlphaMask (const QImage &img)
 KisAlphaMask (const QImage &img, bool hasColor)
 KisAlphaMask (Q_INT32 width, Q_INT32 height)
Q_INT32 height () const
Q_INT32 width () const
Q_UINT8 alphaAt (Q_INT32 x, Q_INT32 y) const
void setAlphaAt (Q_INT32 x, Q_INT32 y, Q_UINT8 alpha)

Static Public Member Functions

static KisAlphaMaskSP interpolate (KisAlphaMaskSP mask1, KisAlphaMaskSP mask2, double t)

Constructor & Destructor Documentation

KisAlphaMask::KisAlphaMask ( const QImage &  img  ) 

Create an alpha mask based on the specified QImage.

If the image is not a grayscale, the mask value is calculated from the effective grey level and alpha value.

Definition at line 41 of file kis_alpha_mask.cc.

KisAlphaMask::KisAlphaMask ( const QImage &  img,
bool  hasColor 
)

As above except quicker as the image does not need to be scanned to see if it has any colour pixels.

Definition at line 28 of file kis_alpha_mask.cc.

KisAlphaMask::KisAlphaMask ( Q_INT32  width,
Q_INT32  height 
)

Create a transparent mask.

Definition at line 54 of file kis_alpha_mask.cc.


Member Function Documentation

Q_INT32 KisAlphaMask::height (  )  const

Returns:
the number of alpha values in a scanline.

Definition at line 71 of file kis_alpha_mask.cc.

Q_INT32 KisAlphaMask::width (  )  const

Returns:
the number of lines in the mask.

Definition at line 66 of file kis_alpha_mask.cc.

Q_UINT8 KisAlphaMask::alphaAt ( Q_INT32  x,
Q_INT32  y 
) const [inline]

Returns:
the alpha value at the specified position.
Returns Q_UINT8 OPACITY_TRANSPARENT if the value is outside the bounds of the mask.

XXX: this is, of course, not the best way of masking. Better would be to let KisAlphaMask fill a chunk of memory with the alpha values at the right position, something like void applyMask(Q_UINT8 *pixeldata, Q_INT32 pixelWidth, Q_INT32 alphaPos). That would be fastest, or we could provide an iterator over the mask, that would be nice, too.

Definition at line 80 of file kis_alpha_mask.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys