2010-03-13 19:04 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbxbp/gra.ch
  * contrib/hbxbp/Makefile
  * contrib/hbxbp/xbpgeneric.prg
  + contrib/hbxbp/xbpgra.prg
  * contrib/hbxbp/xbppresspace.prg
    + Added Gra*() skeleton functions.
    ! Extended XbpPresSpace() class to cover next round of implementation.

    ; NOTE: I am not been able to find a way to execute Gra*()
            functions on a widget's presentation ( device context )
            space. Qt documentation clearly indicates that this is 
            only possible from withing method QEvent::Paint of 
            concerned widget. And it is correct. Windows itself also
            does not allow to paint from outside of WM_PAINT message.
            However my experiments have led me to the conclusion that
            this is possible if every widget is subclasses and QEvent_Paint
            is method is implemented. This is a very tedious and 
            very error prone job. If anybody come across some sparkling
            idea how this can be achieved in a resonable way, please
            speak out.

            However on other devices, such as, printer and bitmaps these 
            functions will be working. In the first phase I will implement
            it for printing only, later for widgets.
This commit is contained in:
Pritpal Bedi
2010-03-14 03:15:55 +00:00
parent f56b5a7205
commit 3d289790f4
6 changed files with 958 additions and 72 deletions

View File

@@ -17,6 +17,32 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-03-13 19:04 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbxbp/gra.ch
* contrib/hbxbp/Makefile
* contrib/hbxbp/xbpgeneric.prg
+ contrib/hbxbp/xbpgra.prg
* contrib/hbxbp/xbppresspace.prg
+ Added Gra*() skeleton functions.
! Extended XbpPresSpace() class to cover next round of implementation.
; NOTE: I am not been able to find a way to execute Gra*()
functions on a widget's presentation ( device context )
space. Qt documentation clearly indicates that this is
only possible from withing method QEvent::Paint of
concerned widget. And it is correct. Windows itself also
does not allow to paint from outside of WM_PAINT message.
However my experiments have led me to the conclusion that
this is possible if every widget is subclasses and QEvent_Paint
is method is implemented. This is a very tedious and
very error prone job. If anybody come across some sparkling
idea how this can be achieved in a resonable way, please
speak out.
However on other devices, such as, printer and bitmaps these
functions will be working. In the first phase I will implement
it for printing only, later for widgets.
2010-03-14 01:39 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/vm/extrap.c
! Fixed to do UNICODE to "ANSI" conversion in module listing

View File

@@ -43,6 +43,7 @@ PRG_SOURCES := \
xbptreeview.prg \
xbpwindow.prg \
xbpclipboard.prg \
xbpgra.prg \
PRG_HEADERS := \
appevent.ch \

View File

@@ -3,31 +3,239 @@
*/
#ifndef _GRA_CH
#define GRA_CLR_INVALID ( -6 ) //
#define GRA_CLR_FALSE ( -5 ) //
#define GRA_CLR_TRUE ( -4 ) //
#define GRA_CLR_DEFAULT ( -3 ) //
#define GRA_CLR_BACKGROUND ( -2 ) //
#define GRA_CLR_NEUTRAL ( -1 ) //
#define GRA_CLR_WHITE 0 // Qt_white
#define GRA_CLR_BLACK 1 // Qt_black
#define GRA_CLR_BLUE 2 // Qt_blue
#define GRA_CLR_RED 3 // Qt_red
#define GRA_CLR_PINK 4 // Qt_magenta
#define GRA_CLR_GREEN 5 // Qt_green
#define GRA_CLR_CYAN 6 // Qt_cyan
#define GRA_CLR_YELLOW 7 // Qt_yellow
#define GRA_CLR_DARKGRAY 8 // Qt_darkGray
#define GRA_CLR_DARKBLUE 9 // Qt_darkBlue
#define GRA_CLR_DARKRED 10 // Qt_darkRed
#define GRA_CLR_DARKPINK 11 // Qt_darkMagenta
#define GRA_CLR_DARKGREEN 12 // Qt_darkGreen
#define GRA_CLR_DARKCYAN 13 // Qt_darkCyan
#define GRA_CLR_BROWN 14 // Qt_darkYellow
#define GRA_CLR_PALEGRAY 15 // Qt_lightGray Qt_gray Qt_darkGray
#define _GRA_CH
#define GRA_CLR_INVALID ( -6 ) //
#define GRA_CLR_FALSE ( -5 ) //
#define GRA_CLR_TRUE ( -4 ) //
#define GRA_CLR_DEFAULT ( -3 ) //
#define GRA_CLR_BACKGROUND ( -2 ) //
#define GRA_CLR_NEUTRAL ( -1 ) //
#define GRA_CLR_WHITE 0 // Qt_white
#define GRA_CLR_BLACK 1 // Qt_black
#define GRA_CLR_BLUE 2 // Qt_blue
#define GRA_CLR_RED 3 // Qt_red
#define GRA_CLR_PINK 4 // Qt_magenta
#define GRA_CLR_GREEN 5 // Qt_green
#define GRA_CLR_CYAN 6 // Qt_cyan
#define GRA_CLR_YELLOW 7 // Qt_yellow
#define GRA_CLR_DARKGRAY 8 // Qt_darkGray
#define GRA_CLR_DARKBLUE 9 // Qt_darkBlue
#define GRA_CLR_DARKRED 10 // Qt_darkRed
#define GRA_CLR_DARKPINK 11 // Qt_darkMagenta
#define GRA_CLR_DARKGREEN 12 // Qt_darkGreen
#define GRA_CLR_DARKCYAN 13 // Qt_darkCyan
#define GRA_CLR_BROWN 14 // Qt_darkYellow
#define GRA_CLR_PALEGRAY 15 // Qt_lightGray Qt_gray Qt_darkGray
#define GRA_FILL 1
#define GRA_OUTLINE 2
#define GRA_OUTLINEFILL 3
#define GRA_AA_COLOR 1
#define GRA_AA_BACKCOLOR 2
#define GRA_AA_MIXMODE 3
#define GRA_AA_BGMIXMODE 4
#define GRA_AA_SYMBOL 5
#define GRA_AA_COUNT 5
#define GRA_SYM_DENSE1 1000
#define GRA_SYM_DENSE2 1001
#define GRA_SYM_DENSE3 1002
#define GRA_SYM_DENSE4 1003
#define GRA_SYM_DENSE5 1004
#define GRA_SYM_DENSE6 1005
#define GRA_SYM_DENSE7 1006
#define GRA_SYM_DENSE8 1007
#define GRA_SYM_VERT 131073
#define GRA_SYM_HORIZ 131072
#define GRA_SYM_DIAG1 131075
#define GRA_SYM_DIAG2 1008
#define GRA_SYM_DIAG3 131074
#define GRA_SYM_DIAG4 1009
#define GRA_SYM_NOSHADE 65536
#define GRA_SYM_SOLID 0
#define GRA_SYM_HALFTONE 1010
#define GRA_SYM_HATCH 131076
#define GRA_SYM_DIAGHATCH 131077
#define GRA_SYM_BLANK 65536
#define GRA_SYM_DEFAULT GRA_SYM_SOLID
#define GRA_AM_COLOR 1
#define GRA_AM_BACKCOLOR 2
#define GRA_AM_MIXMODE 3
#define GRA_AM_BGMIXMODE 4
#define GRA_AM_SYMBOL 5
#define GRA_AM_BOX 6
#define GRA_AM_COUNT 6
#define GRA_MARKSYM_CROSS 1
#define GRA_MARKSYM_PLUS 2
#define GRA_MARKSYM_DIAMOND 3
#define GRA_MARKSYM_SQUARE 4
#define GRA_MARKSYM_SIXPOINTSTAR 5
#define GRA_MARKSYM_EIGHTPOINTSTAR 6
#define GRA_MARKSYM_SOLIDDIAMOND 7
#define GRA_MARKSYM_SOLIDSQUARE 8
#define GRA_MARKSYM_DOT 9
#define GRA_MARKSYM_SMALLCIRCLE 10
#define GRA_MARKSYM_BLANK 64
#define GRA_MARKSYM_DEFAULT GRA_MARKSYM_CROSS
#define GRA_AL_COLOR 1
#define GRA_AL_MIXMODE 2
#define GRA_AL_WIDTH 3
#define GRA_AL_TYPE 4
#define GRA_AL_COUNT 4
#define GRA_LINETYPE_DOT 2
#define GRA_LINETYPE_SHORTDASH 1
#define GRA_LINETYPE_DASHDOT 3
#define GRA_LINETYPE_DOUBLEDOT GRA_LINETYPE_DOT
#define GRA_LINETYPE_LONGDASH GRA_LINETYPE_SHORTDASH
#define GRA_LINETYPE_DASHDOUBLEDOT 4
#define GRA_LINETYPE_SOLID 0
#define GRA_LINETYPE_INVISIBLE 5
#define GRA_LINETYPE_ALTERNATE GRA_LINETYPE_DASHDOT
#define GRA_LINETYPE_DEFAULT GRA_LINETYPE_SOLID
#define GRA_LINEWIDTH_NORMAL 0
#define GRA_LINEWIDTH_THICK 2
#define GRA_LINEWIDTH_DEFAULT GRA_LINEWIDTH_NORMAL
#define GRA_AS_COLOR 1
#define GRA_AS_BACKCOLOR 2
#define GRA_AS_MIXMODE 3
#define GRA_AS_BGMIXMODE 4
#define GRA_AS_BOX 5
#define GRA_AS_ANGLE 6
#define GRA_AS_SHEAR 7
#define GRA_AS_DIRECTION 8
#define GRA_AS_HORIZALIGN 9
#define GRA_AS_VERTALIGN 10
#define GRA_AS_EXTRA 11
#define GRA_AS_BREAK_EXTRA 12
#define GRA_AS_COUNT 12
#define GRA_CHDIRN_LEFTRIGHT 1
#define GRA_CHDIRN_TOPBOTTOM 2
#define GRA_CHDIRN_RIGHTLEFT 3
#define GRA_CHDIRN_BOTTOMTOP 4
#define GRA_CHDIRN_DEFAULT GRA_CHDIRN_LEFTRIGHT
#define GRA_HALIGN_LEFT 0
#define GRA_HALIGN_CENTER 6
#define GRA_HALIGN_RIGHT 2
#define GRA_HALIGN_STANDARD GRA_HALIGN_LEFT
#define GRA_HALIGN_NORMAL GRA_HALIGN_LEFT
#define GRA_VALIGN_NORMAL 1
#define GRA_VALIGN_TOP 2
#define GRA_VALIGN_HALF 3
#define GRA_VALIGN_BASE 4
#define GRA_VALIGN_BOTTOM 5
#define GRA_VALIGN_STANDARD 6
#define GRA_FGMIX_OR 15
#define GRA_FGMIX_OVERPAINT 13
#define GRA_FGMIX_LEAVEALONE 11
#define GRA_FGMIX_XOR 7
#define GRA_FGMIX_AND 9
#define GRA_FGMIX_SUBTRACT 3
#define GRA_FGMIX_MASKSRCNOT 5
#define GRA_FGMIX_ZERO 1
#define GRA_FGMIX_NOTMERGESRC 2
#define GRA_FGMIX_NOTXORSRC 10
#define GRA_FGMIX_INVERT 6
#define GRA_FGMIX_MERGESRCNOT 14
#define GRA_FGMIX_NOTCOPYSRC 4
#define GRA_FGMIX_MERGENOTSRC 12
#define GRA_FGMIX_NOTMASKSRC 8
#define GRA_FGMIX_ONE 16
#define GRA_FGMIX_DEFAULT GRA_FGMIX_OVERPAINT
#define GRA_BGMIX_OVERPAINT 2
#define GRA_BGMIX_LEAVEALONE 1
#define GRA_BGMIX_OR GRA_BGMIX_LEAVEALONE
#define GRA_BGMIX_XOR GRA_BGMIX_LEAVEALONE
#define GRA_BGMIX_DEFAULT GRA_BGMIX_LEAVEALONE
#define GRA_NUMCLR_RESERVED 15
#define GRA_SEG_MODIFIABLE 1
#define GRA_SEG_NIL 2
#define GRA_SEG_LOWER_PRI (-1)
#define GRA_SEG_HIGHER_PRI 1
#define GRA_DM_DRAW 1
#define GRA_DM_RETAIN 2
#define GRA_DM_DRAWANDRETAIN 3
#define GRA_TRANSFORM_REPLACE 0
#define GRA_TRANSFORM_ADD 1
#define GRA_TRANSFORM_PREEMPT 2
#define GRA_PATH_FILL_ALTERNATE 1
#define GRA_PATH_FILL_WINDING 2
#define GRA_PATH_FILL_EXCL GRA_PATH_FILL_ALTERNATE
#define GRA_PATH_CLIP_ALTERNATE 0
#define GRA_PATH_CLIP_WINDING 2
#define GRA_PATH_CLIP_INCL 0
#define GRA_PATH_CLIP_EXCL 8
#define GRA_PATH_CLIP_COMBINE 4
#define GRA_BLT_ROP_SRCCOPY 13369376
#define GRA_BLT_ROP_SRCPAINT 15597702
#define GRA_BLT_ROP_SRCAND 8913094
#define GRA_BLT_ROP_SRCINVERT 6684742
#define GRA_BLT_ROP_SRCERASE 4457256
#define GRA_BLT_ROP_NOTSRCCOPY 3342344
#define GRA_BLT_ROP_NOTSRCERASE 1114278
#define GRA_BLT_ROP_MERGECOPY 12583114
#define GRA_BLT_ROP_MERGEPAINT 12255782
#define GRA_BLT_ROP_PATCOPY 15728673
#define GRA_BLT_ROP_PATPAINT 16452105
#define GRA_BLT_ROP_PATINVERT 5898313
#define GRA_BLT_ROP_DSTINVERT 5570569
#define GRA_BLT_ROP_ZERO 66
#define GRA_BLT_ROP_ONE 16711778
#define GRA_BLT_BBO_OR 2
#define GRA_BLT_BBO_AND 1
#define GRA_BLT_BBO_IGNORE 3
#define GRA_PU_ARBITRARY 4
#define GRA_PU_PIXEL 8
#define GRA_PU_LOMETRIC 12
#define GRA_PU_HIMETRIC 16
#define GRA_PU_LOENGLISH 20
#define GRA_PU_HIENGLISH 24
#define GRA_PU_TWIPS 28
#define GRA_PO_ORGTOPLEFT 1
#define GRA_PO_ORGBOTTOMLEFT 2
#define XBPPS_MODE_NORMAL 0
#define XBPPS_MODE_HIGH_TXT_PRECISION 1
#define XBPPS_MODE_HIGH_PRECISION XBPPS_MODE_HIGH_TXT_PRECISION
#define GRA_CLRMODE_COMPATIBLE 0
#define GRA_CLRMODE_STANDARD 1
#define GRA_CLRMODE_DEFCOLORTAB 3
#define GRA_CLRMODE_DITHER 8
#endif

View File

@@ -225,7 +225,6 @@ FUNCTION LastAppEvent( mp1, mp2, oXbp, nThreadID )
DEFAULT nThreadID TO hb_threadID()
IF hb_hHasKey( s_hLastEvent, nThreadID )
hbide_dbg( "hb_hHasKey( s_hLastEvent, nThreadID )", nThreadID )
nEvent := s_hLastEvent[ nThreadID ] [ 1 ]
mp1 := s_hLastEvent[ nThreadID ] [ 2 ]
mp2 := s_hLastEvent[ nThreadID ] [ 3 ]
@@ -351,23 +350,6 @@ FUNCTION MsgBox( cMsg, cTitle )
/*----------------------------------------------------------------------*/
FUNCTION GraMakeRGBColor( aRGB )
LOCAL nRGB
IF hb_isArray( aRGB ) .and. len( aRGB ) == 3
IF hb_isNumeric( aRGB[ 1 ] ) .and. ( aRGB[ 1 ] >= 0 ) .and. ( aRGB[ 1 ] <= 255 )
IF hb_isNumeric( aRGB[ 2 ] ) .and. ( aRGB[ 2 ] >= 0 ) .and. ( aRGB[ 2 ] <= 255 )
IF hb_isNumeric( aRGB[ 3 ] ) .and. ( aRGB[ 3 ] >= 0 ) .and. ( aRGB[ 3 ] <= 255 )
nRGB := ( aRGB[ 1 ] + ( aRGB[ 2 ] * 256 ) + ( aRGB[ 3 ] * 256 * 256 ) ) + ( 256 * 256 * 256 )
ENDIF
ENDIF
ENDIF
ENDIF
RETURN nRGB
/*----------------------------------------------------------------------*/
FUNCTION hbxbp_ConvertAFactFromXBP( cMode, xValue )
SWITCH Upper( cMode )

View File

@@ -0,0 +1,412 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Source file for the Xbp*Classes
*
* Copyright 2010 Pritpal Bedi <pritpal@vouchcac.com>
* http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* EkOnkar
* ( The LORD is ONE )
*
* Xbase++ Compatible Gra*() Functions
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 13Mar2010
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "common.ch"
#include "xbp.ch"
#include "gra.ch"
/*----------------------------------------------------------------------*/
FUNCTION GraArc( oPS, aCenter, nRadius, aEllipse, nStartAngle, nSweepAngle, nFill )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aCenter, nRadius, aEllipse, nStartAngle, nSweepAngle, nFill )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraBitBlt( oTargetPS, oSourcePS, aTargetRect, aSourceRect, nRasterOP, nCompress )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oTargetPS, oSourcePS, aTargetRect, aSourceRect, nRasterOP, nCompress )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraBox( oPS, aLeftBottom, aRightTop, nFill, nHRadius, nVRadius )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aLeftBottom, aRightTop, nFill, nHRadius, nVRadius )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraCaptionStr( oPS, aStartPoint, aEndPoint, cCaption, nAlign, nTabChars )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aStartPoint, aEndPoint, cCaption, nAlign, nTabChars )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraError( oPS )
LOCAL nErrorCode := 0
HB_SYMBOL_UNUSED( oPS )
RETURN nErrorCode
/*----------------------------------------------------------------------*/
FUNCTION GraFocusRect( oPS, aStartPoint, aEndPoint )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aStartPoint, aEndPoint )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraGetRGBIntensity( nRGBColor )
LOCAL aRGB := {}
HB_SYMBOL_UNUSED( nRGBColor )
RETURN aRGB
/*----------------------------------------------------------------------*/
FUNCTION GraIsRGBColor( nColor )
LOCAL lIsRGBColor := .f.
HB_SYMBOL_UNUSED( nColor )
RETURN lIsRGBColor
/*----------------------------------------------------------------------*/
FUNCTION GraLine( oPS, aStartPoint, aEndPoint )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aStartPoint, aEndPoint )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraMakeRGBColor( aRGB )
LOCAL nRGB
IF hb_isArray( aRGB ) .and. len( aRGB ) == 3
IF hb_isNumeric( aRGB[ 1 ] ) .and. ( aRGB[ 1 ] >= 0 ) .and. ( aRGB[ 1 ] <= 255 )
IF hb_isNumeric( aRGB[ 2 ] ) .and. ( aRGB[ 2 ] >= 0 ) .and. ( aRGB[ 2 ] <= 255 )
IF hb_isNumeric( aRGB[ 3 ] ) .and. ( aRGB[ 3 ] >= 0 ) .and. ( aRGB[ 3 ] <= 255 )
nRGB := ( aRGB[ 1 ] + ( aRGB[ 2 ] * 256 ) + ( aRGB[ 3 ] * 256 * 256 ) ) + ( 256 * 256 * 256 )
ENDIF
ENDIF
ENDIF
ENDIF
RETURN nRGB
/*----------------------------------------------------------------------*/
FUNCTION GraMarker( oPS, aPoint )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aPoint )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraPathBegin( oPS )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraPathClip( oPS, lClip, nClipMode )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, lClip, nClipMode )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraPathEnd( oPS, lCloseFigure )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, lCloseFigure )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraPathFill( oPS, nFillMode )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, nFillMode )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraPathOutline( oPS )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraPos( oPS, aPoint )
LOCAL aPenPosition := { 0,0 }
HB_SYMBOL_UNUSED( oPS, aPoint )
RETURN aPenPosition
/*----------------------------------------------------------------------*/
FUNCTION GraQueryTextBox( oPS, cString )
LOCAL aPoints := { 0,0 }
HB_SYMBOL_UNUSED( oPS, cString )
RETURN aPoints
/*----------------------------------------------------------------------*/
FUNCTION GraRotate( oPS, aMatrix, nAngle, aPoint , nMode )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aMatrix, nAngle, aPoint , nMode )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraScale( oPS, aMatrix, aScale, aPoint , nMode )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aMatrix, aScale, aPoint , nMode )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraSegClose( oPS )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraSegDestroy( oPS, nSegmentID )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, nSegmentID )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraSegDraw( oPS, nSegmentID, aMatrix, nMode )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, nSegmentID, aMatrix, nMode )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraSegDrawMode( oPS, nDrawMode )
LOCAL nOldMode := 0
HB_SYMBOL_UNUSED( oPS, nDrawMode )
RETURN nOldMode
/*----------------------------------------------------------------------*/
FUNCTION GraSegFind( oPS, aPoint )
LOCAL aSegmentIDs := {}
HB_SYMBOL_UNUSED( oPS, aPoint )
RETURN aSegmentIDs
/*----------------------------------------------------------------------*/
FUNCTION GraSegOpen( oPS, nMode, nSegmentID )
HB_SYMBOL_UNUSED( oPS, nMode, nSegmentID )
RETURN nSegmentID
/*----------------------------------------------------------------------*/
FUNCTION GraSegPickResolution( oPS, aCenter, aSize )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aCenter, aSize )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraSegPriority( oPS, nSegmentA, nSegmentB, nPriority )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, nSegmentA, nSegmentB, nPriority )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraSetAttrArea( oPS, aAttributes )
LOCAL aOldAttributes := {}
HB_SYMBOL_UNUSED( oPS, aAttributes )
RETURN aOldAttributes
/*----------------------------------------------------------------------*/
FUNCTION GraSetAttrLine( oPS, aAttributes )
LOCAL aOldAttributes := {}
HB_SYMBOL_UNUSED( oPS, aAttributes )
RETURN aOldAttributes
/*----------------------------------------------------------------------*/
FUNCTION GraSetAttrMarker( oPS, aAttributes )
LOCAL aOldAttributes := {}
HB_SYMBOL_UNUSED( oPS, aAttributes )
RETURN aOldAttributes
/*----------------------------------------------------------------------*/
FUNCTION GraSetAttrString( oPS, aAttributes )
LOCAL aOldAttributes := {}
HB_SYMBOL_UNUSED( oPS, aAttributes )
RETURN aOldAttributes
/*----------------------------------------------------------------------*/
FUNCTION GraSetColor( oPS, nForeground, nBackground )
LOCAL aOldColor := {}
HB_SYMBOL_UNUSED( oPS, nForeground, nBackground )
RETURN aOldColor
/*----------------------------------------------------------------------*/
FUNCTION GraSetFont( oPS, oXbpFont )
LOCAL oXbpCurrentFont := NIL
HB_SYMBOL_UNUSED( oPS, oXbpFont )
RETURN oXbpCurrentFont
/*----------------------------------------------------------------------*/
FUNCTION GraSpline( oPS, aPoints, lPenPos )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aPoints, lPenPos )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraStringAt( oPS, aPoint, cString )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aPoint, cString )
RETURN lSuccess
/*----------------------------------------------------------------------*/
FUNCTION GraTranslate( oPS, aMatrix, nXDiff, nYDiff, nMode )
LOCAL lSuccess := .t.
HB_SYMBOL_UNUSED( oPS, aMatrix, nXDiff, nYDiff, nMode )
RETURN lSuccess
/*----------------------------------------------------------------------*/

View File

@@ -69,56 +69,91 @@
#include "common.ch"
#include "xbp.ch"
#include "gra.ch"
#include "appevent.ch"
/*----------------------------------------------------------------------*/
CLASS XbpPresSpace
DATA mode
DATA mode INIT XBPPS_MODE_NORMAL
DATA d
METHOD new()
METHOD create()
METHOD create( oDevice, aPageSize, nUnits )
METHOD configure() VIRTUAL
METHOD destroy() VIRTUAL
METHOD drawMode( nDrawMode ) VIRTUAL
METHOD device() VIRTUAL
METHOD lastError() VIRTUAL
METHOD mapPoint() VIRTUAL
METHOD mapColor() VIRTUAL
METHOD mapColorIndex( lCompatible ) VIRTUAL
METHOD setAttrArea( aAttributes ) VIRTUAL
METHOD setAttrLine( aAttributes ) VIRTUAL
METHOD setAttrMarker( aAttributes ) VIRTUAL
METHOD setAttrString( aAttributes ) VIRTUAL
METHOD setColor( nForeground, nBackground ) INLINE ::d := { ::nColorFG, ::nColorBG }, ;
IF( !empty( nForeground ), ::nColorFG := nForeground, ), ;
IF( !empty( nBackground ), ::nColorBG := nBackground, ), ::d
METHOD setColorIndex() VIRTUAL
METHOD setFont( oXbpFont ) VIRTUAL
METHOD setGraTransform( aMatrix, nMode ) VIRTUAL
METHOD setPageSize( aPageSize, nUnits ) VIRTUAL
METHOD setViewPort( aViewPort ) VIRTUAL
METHOD drawMode( nDrawMode )
METHOD device()
METHOD lastError()
METHOD mapPoint( aPoint, lMapToDevice )
METHOD mapColor( aRGB, lExactMatch )
METHOD maxColorIndex( lCompatible )
METHOD setAttrArea( aAttributes )
METHOD setAttrLine( aAttributes )
METHOD setAttrMarker( aAttributes )
METHOD setAttrString( aAttributes )
METHOD setColor( nForeground, nBackground )
METHOD setColorIndex( nColorIndex, aRGB )
METHOD setFont( oXbpFont )
METHOD setGraTransform( aMatrix, nMode )
METHOD setPageSize( aPageSize, nUnits )
METHOD setViewPort( aViewPort )
PROTECTED:
DATA aAttrArea
DATA aAttrLine
DATA aAttrMarker
DATA aAttrString
DATA nDrawMode
DATA aPalette INIT {}
DATA oDevice
DATA nDrawMode INIT GRA_DM_DRAWANDRETAIN
DATA lMapColorIndex
DATA nColorFG INIT GraMakeRGBColor( { 0,0,0 } )
DATA nColorBG INIT GraMakeRGBColor( { 255,255,255 } )
DATA oXbpFont
DATA aGraTransMatrix
DATA aMatrix INIT { {1.0,0.0,0.0}, {0.0,1.0,0.0}, {0.0,0.0,1.0} }
DATA nGraTransMode
DATA aPageSize
DATA nUnits
DATA aViewPort
DATA aViewPort INIT {}
DATA x INIT 0
DATA y INIT 0
/* To be used in GraArc(), GraBox(), GraPathFill */
DATA aGRA_AA_ATTR INIT { GRA_CLR_NEUTRAL , ;
GRA_CLR_NEUTRAL , ;
GRA_CLR_BACKGROUND , ;
GRA_FGMIX_OVERPAINT , ;
GRA_BGMIX_LEAVEALONE, ;
GRA_SYM_SOLID , ;
{ 0, 0 } }
/* To be used in GraLine(), GraSpline(), GraPathOutLine() and GraArc() and GraBox() in certain cases */
DATA aGRA_AL_ATTR INIT { GRA_CLR_NEUTRAL , ;
GRA_FGMIX_OVERPAINT , ;
GRA_LINEWIDTH_NORMAL, ;
GRA_LINETYPE_SOLID }
/* To be used with GraMarker() */
DATA aGRA_AM_ATTR INIT { GRA_CLR_NEUTRAL , ;
GRA_CLR_BACKGROUND , ;
GRA_FGMIX_OVERPAINT , ;
GRA_BGMIX_LEAVEALONE, ;
GRA_MARKSYM_CROSS , ;
{ 1, 1 } }
/* To be used with GraString() */
DATA aGRA_AS_ATTR INIT { GRA_CLR_NEUTRAL , ;
GRA_CLR_BACKGROUND , ;
GRA_FGMIX_OVERPAINT , ;
GRA_BGMIX_LEAVEALONE, ;
{ 1, 1 } , ;
{ 1, 0 } , ;
{ 0, 1 } , ;
GRA_CHDIRN_LEFTRIGHT, ;
GRA_HALIGN_LEFT , ;
GRA_VALIGN_BASE , ;
0 , ;
0 }
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -128,7 +163,229 @@ METHOD XbpPresSpace:new()
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:create()
METHOD XbpPresSpace:create( oDevice, aPageSize, nUnits )
DEFAULT nUnits TO GRA_PU_PIXEL
IF hb_isObject( oDevice )
::oDevice := oDevice
ENDIF
IF hb_isArray( aPageSize ) .AND. len( aPageSize ) == 2
::aPageSize := aPageSize
ENDIF
::nUnits := nUnits
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:drawMode( nDrawMode )
LOCAL nOldMode := ::nDrawMode
IF hb_isNumeric( nDrawMode ) .AND. nDrawMode >= GRA_DM_DRAW .AND. nDrawMode <= GRA_DM_DRAWANDRETAIN
::nDrawMode := nDrawMode
ENDIF
RETURN nOldMode
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:device()
RETURN ::oDevice
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:lastError()
LOCAL nError := 0
RETURN nError
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:mapPoint( aPoint, lMapToDevice )
DEFAULT lMapToDevice TO .t.
IF hb_isArray( aPoint )
IF lMapToDevice
aPoint := { 0,0 }
ENDIF
ENDIF
RETURN aPoint
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:mapColor( aRGB, lExactMatch )
LOCAL xValue := 0
HB_SYMBOL_UNUSED( aRGB )
DEFAULT lExactMatch TO .f.
RETURN xValue //<nColorIndex>|<nRGBColor>|NIL )
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:maxColorIndex( lCompatible )
DEFAULT lCompatible TO .t.
RETURN 255
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setAttrArea( aAttributes )
LOCAL v
LOCAL aOldAttr := ::aGRA_AA_ATTR
IF hb_isArray( aAttributes ) .AND. len( aAttributes ) == GRA_AA_COUNT
FOR EACH v IN aAttributes
IF !empty( v )
::aGRA_AA_ATTR[ v:__enumIndex() ] := v
ENDIF
NEXT
ENDIF
RETURN aOldAttr
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setAttrLine( aAttributes )
LOCAL v
LOCAL aOldAttr := ::aGRA_AL_ATTR
IF hb_isArray( aAttributes ) .AND. len( aAttributes ) == GRA_AL_COUNT
FOR EACH v IN aAttributes
IF !empty( v )
::aGRA_AL_ATTR[ v:__enumIndex() ] := v
ENDIF
NEXT
ENDIF
RETURN aOldAttr
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setAttrMarker( aAttributes )
LOCAL v
LOCAL aOldAttr := ::aGRA_AM_ATTR
IF hb_isArray( aAttributes ) .AND. len( aAttributes ) == GRA_AM_COUNT
FOR EACH v IN aAttributes
IF !empty( v )
::aGRA_AM_ATTR[ v:__enumIndex() ] := v
ENDIF
NEXT
ENDIF
RETURN aOldAttr
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setAttrString( aAttributes )
LOCAL v
LOCAL aOldAttr := ::aGRA_AS_ATTR
IF hb_isArray( aAttributes ) .AND. len( aAttributes ) == GRA_AS_COUNT
FOR EACH v IN aAttributes
IF !empty( v )
::aGRA_AS_ATTR[ v:__enumIndex() ] := v
ENDIF
NEXT
ENDIF
RETURN aOldAttr
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setColor( nForeground, nBackground )
LOCAL aOldAttr := { ::nColorFG, ::nColorBG }
IF !empty( nForeground )
::nColorFG := nForeground
ENDIF
IF !empty( nBackground )
::nColorBG := nBackground
ENDIF
RETURN aOldAttr
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setColorIndex( nColorIndex, aRGB )
LOCAL a_
LOCAL aOldAttr := {}
IF hb_isNumeric( nColorIndex ) .AND. nColorIndex > 15 .AND. nColorIndex <= 255 .AND. nColorIndex < len( ::aPalette )
aOldAttr := ::aPalette[ nColorIndex ]
IF hb_isArray( aRGB )
IF hb_isArray( aRGB[ 1 ] )
FOR EACH a_ IN aRGB
::aPalette[ nColorIndex + a_:__enumIndex() - 1 ] := a_
NEXT
ELSE
::aPalette[ nColorIndex ] := aRGB
ENDIF
ENDIF
ENDIF
RETURN aOldAttr
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setFont( oXbpFont )
LOCAL oOldFont := ::oXbpFont
IF hb_isObject( oXbpFont )
::oXbpFont := oXbpFont
ENDIF
RETURN oOldFont
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setGraTransform( aMatrix, nMode )
LOCAL oOldMatrix := ::aMatrix
DEFAULT nMode TO GRA_TRANSFORM_REPLACE
IF hb_isArray( aMatrix )
IF nMode == GRA_TRANSFORM_REPLACE
::aMatrix := aMatrix
ELSE
// Recalculate ??
ENDIF
ENDIF
RETURN oOldMatrix
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setPageSize( aPageSize, nUnits )
LOCAL aOldSize := ::aPageSize
IF hb_isArray( aPageSize ) .AND. len( aPageSize ) == 2
::aPageSize := aPageSize
ENDIF
IF hb_isNumeric( nUnits )
::nUnits := nUnits
ENDIF
RETURN aOldSize
/*----------------------------------------------------------------------*/
METHOD XbpPresSpace:setViewPort( aViewPort )
LOCAL aOldViewPort := ::aViewPort
IF hb_isArray( aViewPort )
::aViewPort := aViewPort
ENDIF
RETURN aOldViewPort
/*----------------------------------------------------------------------*/