Go to the documentation of this file.
47 #include <qscrollarea.h>
86 virtual void moveBy(
double dx,
double dy);
87 void move(
double x,
double y);
115 virtual void advance(
int stage);
123 virtual void draw(QPainter&) = 0;
178 virtual int rtti()
const;
206 virtual QPolygon chunks()
const;
207 virtual void addToChunks();
208 virtual void removeFromChunks();
209 virtual void changeChunks();
219 double myx, myy, myz;
239 QtCanvas(QPixmap p,
int h,
int v,
int tilewidth,
int tileheight);
243 virtual void setTiles(QPixmap tiles,
int h,
int v,
244 int tilewidth,
int tileheight);
251 virtual void setTile(
int x,
int y,
int tilenum);
254 return grid[x + y * htiles];
286 return QSize(awidth, aheight);
290 return QRect(0, 0, awidth, aheight);
294 return x >= 0 && y >= 0 && x < awidth && y < aheight;
302 return x >= 0 && y >= 0 && x < chwidth && y < chheight;
313 virtual void retune(
int chunksize,
int maxclusters = 100);
317 return x1 / chunksize == x2 / chunksize && y1 / chunksize == y2 / chunksize;
337 void drawArea(
const QRect&, QPainter* p,
bool double_buffer =
false);
343 void drawCanvasArea(
const QRect&, QPainter* p = 0,
bool double_buffer =
true);
367 void init(
int w,
int h,
int chunksze = 16,
int maxclust = 100);
372 QRect changeBounds();
377 int chwidth, chheight;
382 void initTiles(QPixmap p,
int h,
int v,
int tilewidth,
int tileheight);
390 QTimer* update_timer;
392 bool debug_redraw_areas;
429 virtual void drawContents(QPainter* p,
int cx,
int cy,
int cw,
int ch);
449 void updateContentsSize();
459 #ifndef QT_NO_IMAGEIO
483 void init(
const QImage&);
484 void init(
const QPixmap& pixmap,
int hx,
int hy);
492 QImage* collision_mask;
500 #ifndef QT_NO_IMAGEIO
506 #ifndef QT_NO_IMAGEIO
507 bool readPixmaps(
const QString& datafilenamepattern,
int framecount = 0);
517 return img ? img[i] : 0;
522 return (uint)framecount;
528 #ifndef QT_NO_IMAGEIO
529 bool readPixmaps(
const QString& datafilenamepattern,
int framecount,
bool maskonly);
547 void move(
double x,
double y);
558 return images->
count();
585 return images->
image(frm);
590 return images->
image(f);
592 virtual void advance(
int stage);
595 void draw(QPainter& painter);
601 void removeFromChunks();
630 virtual void setPen(QPen p);
650 void draw(QPainter&);
663 void scanPolygon(
const QPolygon& pa,
int winding,
665 QPolygon chunks()
const;
698 return QRect(
int(
x()),
int(
y()), w, h);
728 void moveBy(
double dx,
double dy);
766 void setPoints(
int x1,
int y1,
int x2,
int y2);
770 return QPoint(x1, y1);
774 return QPoint(x2, y2);
781 void moveBy(
double dx,
double dy);
836 class QtCanvasTextExtra;
850 QString
text()
const;
852 QColor
color()
const;
854 void moveBy(
double dx,
double dy);
870 virtual void draw(QPainter&);
876 void removeFromChunks();
885 QtCanvasTextExtra* extra;
virtual void drawShape(QPainter &)=0
virtual void contentsMouseMoveEvent(QMouseEvent *)
QColor backgroundColor() const
void move(double x, double y)
virtual void addView(QtCanvasView *)
friend void qt_unview(QtCanvas *c)
virtual QRect boundingRect() const =0
virtual void setEnabled(bool yes)
virtual void setActive(bool yes)
virtual QRect boundingRectAdvanced() const
virtual void contentsContextMenuEvent(QContextMenuEvent *)
void setCanvas(QtCanvas *v)
void setFont(const QFont &)
void drawArea(const QRect &, QPainter *p, bool double_buffer=false)
bool collidesWith(const QtCanvasItem *) const
friend class QtCanvasLine
bool validChunk(const QPoint &p) const
void addItemToChunk(QtCanvasItem *, int i, int j)
QtCanvasItem(QtCanvas *canvas)
void setHighQualityRendering(bool enable)
virtual void drawBackground(QPainter &, const QRect &area)
QRect boundingRect() const
void removeItemFromChunk(QtCanvasItem *, int i, int j)
friend class QtCanvasPolygonalItem
QPolygon areaPoints() const
void drawViewArea(QtCanvasView *view, QPainter *p, const QRect &r, bool dbuf)
virtual void moveBy(double dx, double dy)
void moveBy(double dx, double dy)
void moveBy(double dx, double dy)
bool collidesWith(const QtCanvasItem *) const
QPolygon areaPoints() const
virtual void removeAnimation(QtCanvasItem *)
virtual void setChanged(const QRect &area)
void setPoints(int x1, int y1, int x2, int y2)
void removeItemFromChunkContaining(QtCanvasItem *, int x, int y)
bool setWorldMatrix(const QMatrix &)
virtual void contentsDragLeaveEvent(QDragLeaveEvent *)
virtual void setCanvas(QtCanvas *)
QtCanvas(QObject *parent=0)
virtual void setTile(int x, int y, int tilenum)
void setColor(const QColor &)
virtual void setTiles(QPixmap tiles, int h, int v, int tilewidth, int tileheight)
virtual void drawContents(QPainter *p, int cx, int cy, int cw, int ch)
bool collidesWith(const QtCanvasItem *) const
virtual bool collidesWith(const QtCanvasItem *) const =0
friend class QtCanvasText
QtCanvasItemList collisions(const QPoint &) const
void setImage(int i, QtCanvasPixmap *p)
void setSize(int w, int h)
virtual void advance(int stage)
void setControlPoints(QPolygon, bool closed=true)
virtual void contentsDragEnterEvent(QDragEnterEvent *)
bool readCollisionMasks(const QString &filenamepattern)
void setYVelocity(double vy)
virtual ~QtCanvasPolygonalItem()
QtCanvasItemList allItems()
double a(double t, double a0, double j)
virtual void setChangedChunkContaining(int x, int y)
virtual void resize(int width, int height)
virtual void setBackgroundPixmap(const QPixmap &p)
virtual void setPen(QPen p)
virtual void removeItem(QtCanvasItem *)
virtual ~QtCanvasSprite()
virtual void draw(QPainter &)=0
bool validChunk(int x, int y) const
virtual void contentsMouseDoubleClickEvent(QMouseEvent *)
friend class QtCanvasEllipse
virtual void contentsDragMoveEvent(QDragMoveEvent *)
virtual void setVelocity(double vx, double vy)
void setOffset(int x, int y)
virtual QPolygon areaPoints() const =0
virtual QSize sizeHint() const
bool highQualityRendering
virtual void contentsMousePressEvent(QMouseEvent *)
virtual void contentsMouseReleaseEvent(QMouseEvent *)
void drawShape(QPainter &)
virtual void setChangedChunk(int i, int j)
QPolygon controlPoints() const
virtual void advance(int stage)
void setAngles(int start, int length)
virtual void setUnchanged(const QRect &area)
virtual void setBackgroundColor(const QColor &c)
QRect boundingRect() const
QtCanvas * canvas() const
void setSize(int w, int h)
const QMatrix & inverseWorldMatrix() const
virtual void setFrameAnimation(FrameAnimationType=Cycle, int step=1, int state=0)
void setText(const QString &)
int tilesHorizontally() const
friend class QtCanvasSprite
void setXVelocity(double vx)
QList< QtCanvasItem * > QtCanvasItemList
virtual void drawForeground(QPainter &, const QRect &area)
QtCanvasPixmap * image(int f) const
virtual QPolygon areaPointsAdvanced() const
QtCanvasPixmap * image(int i) const
virtual QtCanvasPixmap * imageAdvanced() const
QtCanvasSpline(QtCanvas *canvas)
QPixmap backgroundPixmap() const
double v(double t, double v0, double a0, double j)
QPoint startPoint() const
virtual void contentsDropEvent(QDropEvent *)
virtual void setBrush(QBrush b)
virtual void setAnimated(bool y)
QPolygon areaPoints() const
virtual void contentsWheelEvent(QWheelEvent *)
virtual void addItem(QtCanvasItem *)
bool collidesWith(const QtCanvasItem *) const
void drawCanvasArea(const QRect &, QPainter *p=0, bool double_buffer=true)
QtCanvasPixmap(const QString &datafilename)
friend class QtCanvasRectangle
void addItemToChunkContaining(QtCanvasItem *, int x, int y)
bool sameChunk(int x1, int y1, int x2, int y2) const
friend bool qt_testCollision(const QtCanvasSprite *s1, const QtCanvasSprite *s2)
friend bool qt_testCollision(const QtCanvasSprite *s1, const QtCanvasSprite *s2)
void drawShape(QPainter &)
void drawShape(QPainter &)
virtual void setVisible(bool yes)
QRect boundingRect() const
double angle(const Point &a, const Point &b, const Point &c)
bool readPixmaps(const QString &datafilenamepattern, int framecount=0)
bool onCanvas(int x, int y) const
virtual void setUpdatePeriod(int ms)
virtual void setSelected(bool yes)
int tile(int x, int y) const
QtCanvasPixmap * image() const
virtual void setAllChanged()
const QMatrix & worldMatrix() const
virtual void addAnimation(QtCanvasItem *)
QtCanvas * canvas() const
bool collidesWith(const QtCanvasItem *) const
virtual void removeView(QtCanvasView *)
void moveBy(double dx, double dy)
QPolygon areaPoints() const
void move(double x, double y)
bool onCanvas(const QPoint &p) const
QtCanvasItemList collisions(bool exact) const
virtual void draw(QPainter &)
QtCanvasView(QWidget *parent=0)
int tilesVertically() const
void drawShape(QPainter &)
void draw(QPainter &painter)
virtual void retune(int chunksize, int maxclusters=100)
virtual void setAdvancePeriod(int ms)
friend class QtCanvasPolygon
void setSequence(QtCanvasPixmapArray *seq)