6
1 Attributes of drawing elements All drawn objects have attributes Color Line widths Fill These are often specified in a structure Windows: Device Context (DC) X: Graphics Context (GC) Abstracted in Qt by a QPainter Object See http://doc.trolltech.com/3.0/qpainter.html Abstracted in Java’s Swing classes by the Graphics object

1 Attributes of drawing elements All drawn objects have attributes Color Line widths Fill These are often specified in a structure Windows: Device Context

Embed Size (px)

Citation preview

Page 1: 1 Attributes of drawing elements All drawn objects have attributes Color Line widths Fill These are often specified in a structure Windows: Device Context

1

Attributes of drawing elements

All drawn objects have attributes Color Line widths Fill

These are often specified in a structure Windows: Device Context (DC) X: Graphics Context (GC)

Abstracted in Qt by a QPainter Object See http://doc.trolltech.com/3.0/qpainter.html

Abstracted in Java’s Swing classes by the Graphics object

Page 2: 1 Attributes of drawing elements All drawn objects have attributes Color Line widths Fill These are often specified in a structure Windows: Device Context

Fall 2004 CS-321Dr. Mark L. Hornick

2

Color[see http://doc.trolltech.com/3.0/qcolor.html]

Specified by Red, Green, and Blue (usually 0-255) Great for hardware, poor for the user?

Predefined color names (known by Qt) Predefined names for standard colors Mapped to RGB values (“Papaya whip”, “Peru”,

…)

Page 3: 1 Attributes of drawing elements All drawn objects have attributes Color Line widths Fill These are often specified in a structure Windows: Device Context

Fall 2004 CS-321Dr. Mark L. Hornick

3

Line Attributes[see http://doc.trolltech.com/3.0/qpen.html]

Width How many pixels wide is a line Draws rectangle or lines parallel to ideal line

Style Solid, Dashed, etc. Line cap Line end

Page 4: 1 Attributes of drawing elements All drawn objects have attributes Color Line widths Fill These are often specified in a structure Windows: Device Context

Fall 2004 CS-321Dr. Mark L. Hornick

4

Line Cap Styles [http://doc.trolltech.com/3.0/qt.html#PenCapStyle-enum]

Not all styles are supported

by Qt.

Not last

Butt

Round

Projecting

Line endpoint

Page 5: 1 Attributes of drawing elements All drawn objects have attributes Color Line widths Fill These are often specified in a structure Windows: Device Context

Fall 2004 CS-321Dr. Mark L. Hornick

5

Line Join Styles[http://doc.trolltech.com/qt.html#PenJoinStyle-enum]

Qt 3 supports all 3 styles.

Bevel RoundMiter

Page 6: 1 Attributes of drawing elements All drawn objects have attributes Color Line widths Fill These are often specified in a structure Windows: Device Context

Fall 2004 CS-321Dr. Mark L. Hornick

6

Polygon Attributes[see http://doc.trolltech.com/3.0/qbrush.html]

Filling Inside-Outside Rule

Even-Odd Non-Zero Winding Number

Solid Pattern