~ubuntu-branches/debian/sid/kxstitch/sid

« back to all changes in this revision

Viewing changes to kxstitch/stitch.h

  • Committer: Bazaar Package Importer
  • Author(s): eric pareja
  • Date: 2005-02-19 12:37:22 UTC
  • Revision ID: james.westby@ubuntu.com-20050219123722-kt3ru1nqvllietee
Tags: upstream-0.6
ImportĀ upstreamĀ versionĀ 0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2003 by Stephen Allewell                                *
 
3
 *   stephen@mirramar.fsnet.co.uk                                          *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 ***************************************************************************/
 
10
 
 
11
#ifndef STITCH_H
 
12
#define STITCH_H
 
13
 
 
14
#include <qptrqueue.h>
 
15
#include <qpoint.h>
 
16
 
 
17
/** Store information about individual stitches.
 
18
    @author Stephen P. Allewell
 
19
    <pre>
 
20
    Stitches encoded as follows
 
21
 
 
22
      1\/2
 
23
      4/\8
 
24
 
 
25
    Type      binary  decimal
 
26
    Delete    00000000  0
 
27
    TLQtr     00000001  1
 
28
    TRQtr     00000010  2
 
29
    BLQtr     00000100  4
 
30
    BTHalf    00000110  6
 
31
    TL3Qtr    00000111  7
 
32
    BRQtr     00001000  8
 
33
    TBHalf    00001001  9
 
34
    TR3Qtr    00001011  11
 
35
    BL3Qtr    00001101  13
 
36
    BR3Qtr    00001110  14
 
37
    Full      00001111  15
 
38
    FRKnot    00010000  16
 
39
    </pre>
 
40
  */
 
41
class Stitch
 
42
{
 
43
public:
 
44
  enum Type {Delete=0,TLQtr=1,TRQtr=2,BLQtr=4,BTHalf=6,TL3Qtr=7,BRQtr=8,TBHalf=9,TR3Qtr=11,BL3Qtr=13,BR3Qtr=14,Full=15,FRKnot=16};
 
45
  typedef QPtrQueue<Stitch> Queue;
 
46
 
 
47
/** Constructor
 
48
    @param t StitchType of stitch to be stored.
 
49
    @param i Index into the floss table.
 
50
  */
 
51
  Stitch(Type t, int i);
 
52
 
 
53
  Type  type;
 
54
  int   floss;
 
55
};
 
56
 
 
57
/** Stores the start and end coordinates and the color of a backstitch
 
58
    @author Stephen P. Allewell
 
59
  */
 
60
class BackStitch
 
61
{
 
62
public:
 
63
/** Constructor
 
64
    @param s Start coordinate
 
65
    @param e End coordinate
 
66
    @param i Index into the color palette
 
67
  */
 
68
  BackStitch(QPoint s, QPoint e, int i);
 
69
/** Tests to see if a coordinate is the start or end of the current backstitch
 
70
    @return TRUE if p is the start or end of this backstitch, FALSE otherwise.
 
71
    @param p Coordinate to be checked.
 
72
  */
 
73
  bool contains(QPoint p);
 
74
 
 
75
  QPoint  start;
 
76
  QPoint  end;
 
77
  int     floss;
 
78
};
 
79
 
 
80
/** Store information about a french knot
 
81
    @author Stephen P. Allewell
 
82
  */
 
83
class Knot
 
84
{
 
85
public:
 
86
/** Constructor
 
87
    @param p The coordinates of the knot.
 
88
    @param i The index into the floss table.
 
89
  */
 
90
  Knot(QPoint p, int i);
 
91
 
 
92
  QPoint  pos;
 
93
  int     floss;
 
94
};
 
95
 
 
96
#endif