- Inherits from:
- Object
- Conforms to:
- DDrawable
- Declared in:
- DGraphicScreen.h
Object
|
+---DGraphicDrawable
Class Description
The DGraphicDrawable class implements a class with the shared methods between
the graphic screen class and the graphic surface class. It contains the methods
for drawing, clipping, color.. The x and y positions start from zero, so the
screen size is 0..maxX and 0..maxY (inclusive).
ToDo: drawing boxes, circles..
- Direct subclasses:
- DGraphicScreen, DGraphicSurface
- Last modified:
- 26-Aug-2008 (DGraphicScreen.h)
Instance Variables
- protected unsigned _maxX
- the right x-position of the drawable
- protected unsigned _maxY
- the bottom y-position of the drawable
- protected DColor *_fgc
- the current foreground color
- protected DColor *_bgc
- the current background color
- protected id <DFont> _font
- the current font
- protected DSimpleFont *_basicFont
- the basic font
- protected void *_surface
- the surface of the drawable
- private BOOL _drawing
- is drawing active ?
- private unsigned _clipMinX
- the left x-position for the clip area
- private unsigned _clipMaxX
- the right x-position for the clip area
- private unsigned _clipMinY
- the top y-position for the clip area
- private unsigned _clipMaxY
- the bottom y-position for the clip area
- private unsigned _cursorX
- the x-position of the cursor
- private unsigned _cursorY
- the y-position of the cursor
- private unsigned _nextY
- the next y-position after writing text
- private int _lineType
- the last line type
- private int _dashLength
- the length of a dash
- private int _bezierSteps
- the number of iteration steps for a bezier curve (def. 15)
- commonly used methods
- - (DGraphicDrawable *) init
- Initialise an graphic drawable object
- Returns:
- the object
- Copy related methods
- - shallowCopy
- Do a shallow copy of the graphic drawable object
- Returns:
- the object
- Deconstructor
- - free
- Free the graphic screen
- Returns:
- the object
- Member methods
- - (int) bezierSteps
- Return the number of bezier iteration steps (def. 15)
- Returns:
- the number of steps
- - (DGraphicDrawable *) bezierSteps :(int) steps
- Set the number of bezier iteration steps
- Parameters:
- steps - the number of bezier steps (>1)
- Returns:
- the object
- - (int) dashLength
- Return the length of a dash (def. 10)
- Returns:
- the dash length
- - (DGraphicDrawable *) dashLength :(int) length
- Set the length of a dash
- Parameters:
- length - the dash length
- Returns:
- the object
- - (BOOL) isOpen
- Check if the graphic drawable object is open
- Returns:
- is it ?
- - (int) lineType
- Return the current line type
- Returns:
- the line type (DDW_LINE_SOLID,DDW_LINE_DASHED,DDW_LINE_DOTTED)
- - (DGraphicDrawable *) lineType :(int) type
- Set the current line type
- Parameters:
- type - the line type (DDW_LINE_SOLID,DDW_LINE_DASHED,DDW_LINE_DOTTED)
- Returns:
- the object
- Cursor methods
- - (int) cursor :(int) state
- Set the visibility of the cursor
- Parameters:
- state - the cursor state (DDW_CURSOR..)
- Returns:
- the previous state of the cursor
- - (BOOL) cursor :(unsigned) x :(unsigned) y
- Set the cursor to a position
- Parameters:
- x - the x-position
y - the y-position
- Returns:
- success
- - (unsigned) cursorX
- Return the x position of the cursor
- Returns:
- the x position
- - (unsigned) cursorY
- Return the y position of the cursor
- Returns:
- the y position
- - (int) error
- Return the last error
- Returns:
- the last error (0)
- - (int) pointer :(int) state
- Set the visibility of the mouse pointer
- Parameters:
- state - the pointer state (DDW_POINTER..)
- Returns:
- the previous state of the pointer
- - (BOOL) seek :(unsigned long) offset :(int) origin
- Move the current position to a location
- Parameters:
- offset - the offset from the origin (in positions)
origin - the origin for the offset (0=begin, 1=current, 2=end)
- Returns:
- success
- - (BOOL) skip :(unsigned long) offset
- Skip a number of positions
- Parameters:
- offset - the number of positions to skip
- Returns:
- success
- - (unsigned long) tell
- Tell the current position in the writeable
- Returns:
- the current position
- Font methods
- - (id <DFont>) font
- Get the current font
- Returns:
- the (reference to the) current font (or nil)
- - (id <DFont>) font :(id <DFont>) font
- Set the current font
- Parameters:
- font - the (reference to the) font (or nil for none)
- Returns:
- the (reference to the) previous font
- Surface methods
- - (DGraphicDrawable *) drawable :(unsigned) width :(unsigned) height
- Set the dimensions of the drawable
- Parameters:
- width - the width (> 0)
height - the height (> 0)
- Returns:
- the object
- - (unsigned) height
- Return the height
- Returns:
- the height
- - (BOOL) isValid :(unsigned) x :(unsigned) y
- Check if a cursor position is valid (within the drawable)
- Parameters:
- x - the x-position
y - the y-position
- Returns:
- is it ?
- - (unsigned) maxX
- Return the maximum x-position
- Returns:
- the maximum x-position
- - (unsigned) maxY
- Return the maximum y-position
- Returns:
- the maximum y-position
- - (unsigned) width
- Return the width
- Returns:
- the width
- Clipping methods
- - (BOOL) clip
- Reset the clipping area to the full surface
- Returns:
- success
- - (BOOL) clip :(unsigned) minX :(unsigned) minY :(unsigned) maxX :(unsigned) maxY
- Set a clipping area
- Parameters:
- minX - the left x-position of the clip area
maxX - the right x-position of the clip area
minY - the top y-position of the clip area
maxY - the bottom y-position of the clip area
- Returns:
- success
- - (unsigned) clipMaxX
- Return the right position of the clip area
- Returns:
- the right x-position
- - (unsigned) clipMaxY
- Return the bottom position of the clip area
- Returns:
- the bottom y-position
- - (unsigned) clipMinX
- Return the left position of the clip area
- Returns:
- the left x-position
- - (unsigned) clipMinY
- Return the top position of the clip area
- Returns:
- the top y-position
- Color methods
- - (DColor *) backgroundColor
- Get the background color
- Returns:
- a reference to the background color
- - (BOOL) backgroundColor :(DColor *) bgc
- Set the background color
- Parameters:
- bgc - the background color
- Returns:
- success
- - (BOOL) color :(DColor *) fgc :(DColor *) bgc
- Set the fore- and background color
- Parameters:
- fgc - the foreground color
bgc - the background color
- Returns:
- success
- - (DColor *) foregroundColor
- Get the foreground color
- Returns:
- a reference to the foreground color
- - (BOOL) foregroundColor :(DColor *) fgc
- Set the foreground color
- Parameters:
- fgc - the foreground color
- Returns:
- success
- Drawing control methods
- - (BOOL) isDrawing
- Check if the screen is in drawing mode
- Returns:
- is it ?
- - (BOOL) startDrawing
- Start drawing on the screen
- Returns:
- success
- - (BOOL) startDrawing :(unsigned) minX :(unsigned) minY :(unsigned) maxX :(unsigned) maxY
- Start drawing in a clipped area on the screen
- Parameters:
- minX - the left x-position of the clipping area
maxX - the right x-position of the clipping area
minY - the top y-position of the clipping area
maxY - the bottom y-position of the clipping area
- Returns:
- success
- - (DGraphicDrawable *) stopDrawing
- Stop drawing on the screen
- Returns:
- the screen object
- Drawing methods
- - (BOOL) clear
- Clear the drawable (in background color)
- Returns:
- success
- - (BOOL) writeChar :(char) ch
- Write a character on the screen on the current cursor position
- Parameters:
- ch - the character
- Returns:
- success
- - (BOOL) writeChar :(unsigned) startX :(unsigned) startY :(char) ch
- Write a character on the screen
- Parameters:
- startX - the start x position
startY - the start y position
ch - the character
- Returns:
- success
- - (BOOL) writeLine :(const char *) text
- Write a text line on the screen on the current cursor position
- Parameters:
- text - the text string
- Returns:
- success
- - (BOOL) writeText :(const char *) text
- Write a text string on the screen on the current cursor position
- Parameters:
- text - the text string
- Returns:
- success
- - (BOOL) writeText :(unsigned) startX :(unsigned) startY :(const char *) text
- Write a text string on the screen
- Parameters:
- startX - the start x position
startY - the start y position
text - the text string
- Returns:
- success
- Image methods
- - (BOOL) blit :(unsigned) startX :(unsigned) startY :(DGraphicDrawable *) other :(unsigned) oStartX :(unsigned) oStartY :(unsigned) oEndX :(unsigned) oEndY
- Blit another graphic drawable on this graphic drawable (without alpha blending)
- Parameters:
- startX - the start x-position where the info is placed on this drawable
startY - the start y-position where the info is placed on this drawable
other - the other drawable
oStartX - the start x-position on the other drawable
oStartY - the start y-position on the other drawable
oEndX - the end x-position on the other drawable
oEndY - the end y-position on the other drawable
- Returns:
- success
- - (BOOL) drawBezierLine :(unsigned) startX :(unsigned) startY :(unsigned) strrcX :(unsigned) strrcY :(unsigned) endrcX :(unsigned) endrcY :(unsigned) endX :(unsigned) endY
- Draw a bezier line on the screen
- Parameters:
- startX - the x position for the start of the line
startY - the y position for the start of the line
strrcX - the x position for the start direction point
strrcY - the y position for the start direction point
endrcX - the x position for the end direction point
endrcY - the y position for the end direction point
endX - the x position for the end of the line
endY - the y position for the end of the line
- Returns:
- success
- - (BOOL) drawHLine : (unsigned) endX
- Draw a (horizontal) line on the drawable starting from the current position and
with the previous line width and type settings
- Parameters:
- endX - the x position for the end of the line
- Returns:
- success
- - (BOOL) drawHLine :(unsigned) startX :(unsigned) startY :(unsigned) endX
- Draw a horizontal line with the previous line width and type settings
- Parameters:
- startX - the x position for the start of the line
endX - the x position for the end of the line
startY - the y position for the line
- Returns:
- success
- - (BOOL) drawHLine :(unsigned) startX :(unsigned) startY :(unsigned) endX :(int) lineType
- Draw a (horizontal) line on the drawable
- Parameters:
- startX - the x position for the start of the line
endX - the x position for the end of the line
startY - the y position for the line
lineType - the type of the line DDW_LINE_...
- Returns:
- success
- - (BOOL) drawLine :(unsigned) endX :(unsigned) endY
- Draw a line on the drawable starting from the current position and
with the current line width and type settings
- Parameters:
- endX - the x-position for the end of the line
endY - the y-position for the end of the line
- Returns:
- success
- - (BOOL) drawLine :(unsigned) startX :(unsigned) startY :(unsigned) endX :(unsigned) endY
- Draw a line with the current line type and width settings
- Parameters:
- startX - the x position for the start of the line
endX - the x position for the end of the line
startY - the y position for the start of the line
endY - the y position for the end of the line
- Returns:
- success
- - (BOOL) drawLine :(unsigned) startX :(unsigned) startY :(unsigned) endX :(unsigned) endY :(int) lineType
- Draw a line on the screen
- Parameters:
- startX - the x position for the start of the line
endX - the x position for the end of the line
startY - the y position for the start of the line
endY - the y position for the end of the line
lineType - the type of the line (DDW_LINE_...)
- Returns:
- success
- - (BOOL) drawPoint
- Draw a point on the current position
- Returns:
- success
- - (BOOL) drawPoint :(unsigned) startX :(unsigned) startY
- Draw a point on the drawable
- Parameters:
- startX - the x-position
startY - the y-position
- Returns:
- success
- - (BOOL) drawVLine :(unsigned) endY
- Draw a (vertical) line on the drawable starting from the current position and
with the current line width and type settings
- Parameters:
- endY - the y position for the end of the line
- Returns:
- success
- - (BOOL) drawVLine :(unsigned) startX :(unsigned) startY :(unsigned) endY
- Draw a vertical line with the current line type and width settings
- Parameters:
- startX - the x position for the line
startY - the y position for the line
endY - the y position for the end of the line
- Returns:
- success
- - (BOOL) drawVLine :(unsigned) startX :(unsigned) startY :(unsigned) endY :(int) lineType
- Draw a vertical line on the screen
- Parameters:
- startX - the x position for the line
startY - the y position for the line
endY - the y position for the end of the line
lineType - the type of the line (DDW_LINE_...)
- Returns:
- success
- - (BOOL) readImage :(unsigned) startX :(unsigned) startY :(id <DImage>) image
- Read an image from the drawable
- Parameters:
- startX - the start x position
startY - the start y position
image - the destination image object
- Returns:
- success
- - (BOOL) writeImage :(unsigned) startX :(unsigned) startY :(id <DImage>) image
- Write an image to the drawable
- Parameters:
- startX - the start x position
startY - the start y position
image - the source image object
- Returns:
- success
generated 06-Sep-2008 by ObjcDoc 3.0.0