krita/ui

KisAutogradientResource Class Reference

Is for creating custom gradient colour pickers. More...

#include <kis_autogradient_resource.h>

Inheritance diagram for KisAutogradientResource:

List of all members.

Public Member Functions

 KisAutogradientResource ()
void createSegment (int interpolation, int colorInterpolation, double startOffset, double endOffset, double middleOffset, const QColor &left, const QColor &right)
void duplicateSegment (KoGradientSegment *segment)
const QList< double > getHandlePositions () const
const QList< double > getMiddleHandlePositions () const
virtual bool load ()
void mirrorSegment (KoGradientSegment *segment)
void moveSegmentEndOffset (KoGradientSegment *segment, double t)
void moveSegmentMiddleOffset (KoGradientSegment *segment, double t)
void moveSegmentStartOffset (KoGradientSegment *segment, double t)
KoGradientSegment * removeSegment (KoGradientSegment *segment)
bool removeSegmentPossible () const
void splitSegment (KoGradientSegment *segment)

Detailed Description

Is for creating custom gradient colour pickers.

A gradient is a field which shifts from one colour to one or more other colours. The gradient colour picker defines what colours are used in the image's gradient field. This class only handles the gradient colour picker, _not_ the image's gradient field.

Definition at line 47 of file kis_autogradient_resource.h.


Constructor & Destructor Documentation

KisAutogradientResource::KisAutogradientResource (  )  [inline]

Definition at line 52 of file kis_autogradient_resource.h.


Member Function Documentation

void KisAutogradientResource::createSegment ( int  interpolation,
int  colorInterpolation,
double  startOffset,
double  endOffset,
double  middleOffset,
const QColor left,
const QColor right 
)

a gradient colour picker can consist of one or more segments.

A segment has two end points - each colour in the gradient colour picker represents a segment end point.

Parameters:
interpolation 
colorInterpolation 
startOffset 
endOffset 
middleOffset 
left 
right 
Returns:
void

Definition at line 30 of file kis_autogradient_resource.cc.

void KisAutogradientResource::duplicateSegment ( KoGradientSegment *  segment  ) 

duplicate the specified segment

Parameters:
segment the segment to duplicate
Returns:
void

Definition at line 132 of file kis_autogradient_resource.cc.

const QList< double > KisAutogradientResource::getHandlePositions (  )  const

gets a list of end points of the segments in the gradient colour picker.

If two colours, one segment then two end points, and if three colours, then two segments with four endpoints.

Returns:
a list of double values

Definition at line 36 of file kis_autogradient_resource.cc.

const QList< double > KisAutogradientResource::getMiddleHandlePositions (  )  const

gets a list of middle points of the segments in the gradient colour picker.

Returns:
a list of double values

Definition at line 47 of file kis_autogradient_resource.cc.

virtual bool KisAutogradientResource::load (  )  [inline, virtual]

Definition at line 169 of file kis_autogradient_resource.h.

void KisAutogradientResource::mirrorSegment ( KoGradientSegment *  segment  ) 

create a segment horizontally reversed to the specified one.

Parameters:
segment the segment to reverse
Returns:
void

Definition at line 151 of file kis_autogradient_resource.cc.

void KisAutogradientResource::moveSegmentEndOffset ( KoGradientSegment *  segment,
double  t 
)

Moves the endoffset of the specified segment to the specified value and corrects the startoffset of the following segment.

If the segment is the last segment the endoffset will be set to 1.0 . The offset will maximally be moved till the middle of the current or the following segment. This is useful if someone moves the segment handler in the gradient colour picker, and needs the segment to move with it. Sets the end position of the segment to the correct new position.

Parameters:
segment the segment for which to move the relative end position within the gradient colour picker.
t the new end position for the segment
Returns:
void

Definition at line 78 of file kis_autogradient_resource.cc.

void KisAutogradientResource::moveSegmentMiddleOffset ( KoGradientSegment *  segment,
double  t 
)

moves the Middle of the specified segment to the specified value.

The offset will maximally be moved till the endoffset or startoffset of the segment. This sets the middle of the segment to the same position as the handler of the gradient colour picker.

Parameters:
segment the segment for which to move the relative middle position within the gradient colour picker.
t the new middle position for the segment
Returns:
void

Definition at line 99 of file kis_autogradient_resource.cc.

void KisAutogradientResource::moveSegmentStartOffset ( KoGradientSegment *  segment,
double  t 
)

Moves the StartOffset of the specified segment to the specified value and corrects the endoffset of the previous segment.

If the segment is the first Segment the startoffset will be set to 0.0 . The offset will maximally be moved till the middle of the current or the previous segment. This is useful if someone clicks to move the handler for a segment, to set the half the segment to the right and half the segment to the left of the handler.

Parameters:
segment the segment for which to move the relative offset within the gradient colour picker.
t the new startoff position for the segment
Returns:
void

Definition at line 57 of file kis_autogradient_resource.cc.

KoGradientSegment * KisAutogradientResource::removeSegment ( KoGradientSegment *  segment  ) 

removes the specific segment from the gradient colour picker.

Parameters:
segment the segment to remove
Returns:
the segment which will be at the place of the old segment. 0 if the segment is not in the gradient or it is not possible to remove the segment.

Definition at line 170 of file kis_autogradient_resource.cc.

bool KisAutogradientResource::removeSegmentPossible (  )  const

checks if it's possible to remove a segment (at least two segments in the gradient)

Returns:
true if it's possible to remove an segment

Definition at line 198 of file kis_autogradient_resource.cc.

void KisAutogradientResource::splitSegment ( KoGradientSegment *  segment  ) 

splits the specified segment into two equal parts

Parameters:
segment the segment to split
Returns:
void

Definition at line 111 of file kis_autogradient_resource.cc.


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