From efc3299ae903dac4a058fa650f5b6ebdf8f54424 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 10 Nov 2010 17:50:35 +0000 Subject: [PATCH] 2010-11-10 18:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbzebra/hbzebra.hbp - contrib/hbzebra/d_gen.c + contrib/hbzebra/coredraw.c * Renamed. * contrib/hbzebra/tests/testhpdf.prg ! Fixed to use HPDF_PAGE_FILL(). * contrib/hbzebra/hbzebra.hbp - contrib/hbzebra/d_win.c - contrib/hbzebra/d_hpdf.c - Deleted specialized drawing backend from HBZEBRA. ; TODO: Delete also cairo backend. --- harbour/ChangeLog | 15 +++ .../contrib/hbzebra/{d_gen.c => coredraw.c} | 0 harbour/contrib/hbzebra/d_hpdf.c | 103 ---------------- harbour/contrib/hbzebra/d_win.c | 116 ------------------ harbour/contrib/hbzebra/hbzebra.hbp | 18 +-- harbour/contrib/hbzebra/tests/testhpdf.prg | 4 +- 6 files changed, 18 insertions(+), 238 deletions(-) rename harbour/contrib/hbzebra/{d_gen.c => coredraw.c} (100%) delete mode 100644 harbour/contrib/hbzebra/d_hpdf.c delete mode 100644 harbour/contrib/hbzebra/d_win.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c0e7dccca5..f8c8726988 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,21 @@ The license applies to all entries newer than 2009-04-28. */ +2010-11-10 18:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbzebra/hbzebra.hbp + - contrib/hbzebra/d_gen.c + + contrib/hbzebra/coredraw.c + * Renamed. + + * contrib/hbzebra/tests/testhpdf.prg + ! Fixed to use HPDF_PAGE_FILL(). + + * contrib/hbzebra/hbzebra.hbp + - contrib/hbzebra/d_win.c + - contrib/hbzebra/d_hpdf.c + - Deleted specialized drawing backend from HBZEBRA. + ; TODO: Delete also cairo backend. + 2010-11-10 18:21 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbzebra/code39.c ! Pacified remaining msvc warnings/error. Please review me & test. diff --git a/harbour/contrib/hbzebra/d_gen.c b/harbour/contrib/hbzebra/coredraw.c similarity index 100% rename from harbour/contrib/hbzebra/d_gen.c rename to harbour/contrib/hbzebra/coredraw.c diff --git a/harbour/contrib/hbzebra/d_hpdf.c b/harbour/contrib/hbzebra/d_hpdf.c deleted file mode 100644 index bd5d5b221b..0000000000 --- a/harbour/contrib/hbzebra/d_hpdf.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * Zebra barcode library - * - * Copyright 2010 Viktor Szakats (harbour.01 syenar.hu) - * Copyright 2010 Mindaugas Kavaliauskas - * www - http://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. - * - */ - -#include "hbzebra.h" -#include "hpdf.h" - -int hb_zebra_draw_hpdf( PHB_ZEBRA pZebra, HPDF_Page hPage, double dX, double dY, double dWidth, double dHeight, int iFlags ) -{ - double dLast; - HB_SIZE n, nLen, nCount; - HB_BOOL fBit, fLastBit; - - HB_SYMBOL_UNUSED( iFlags ); - - if( pZebra->iError != 0 ) - return HB_ZEBRA_ERROR_INVALIDZEBRA; - - HPDF_Page_SetLineWidth( hPage, ( HPDF_REAL ) 0.1 ); - - nLen = hb_bitbuffer_len( pZebra->pBits ); - fLastBit = hb_bitbuffer_get( pZebra->pBits, 0 ); - dLast = dX; - nCount = 1; - for( n = 1; n < nLen; n++ ) - { - fBit = hb_bitbuffer_get( pZebra->pBits, n ); - if( fBit != fLastBit ) - { - if( fLastBit ) - HPDF_Page_Rectangle( hPage, ( HPDF_REAL ) dLast, ( HPDF_REAL ) dY, ( HPDF_REAL ) ( dWidth * nCount ), ( HPDF_REAL ) dHeight ); - - dLast += dWidth * nCount; - nCount = 0; - fLastBit = fBit; - } - nCount++; - } - if( fLastBit ) - HPDF_Page_Rectangle( hPage, ( HPDF_REAL ) dLast, ( HPDF_REAL ) dY, ( HPDF_REAL ) ( dWidth * nCount ), ( HPDF_REAL ) dHeight ); - - HPDF_Page_FillStroke( hPage ); - - return 0; -} - -HB_FUNC( HB_ZEBRA_DRAW_HPDF ) -{ - PHB_ZEBRA pZebra = hb_zebra_param( 1 ); - if( pZebra ) - { - hb_retni( hb_zebra_draw_hpdf( pZebra, ( HPDF_Page ) hb_parptr( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ), hb_parni( 7 ) ) ); - } -} diff --git a/harbour/contrib/hbzebra/d_win.c b/harbour/contrib/hbzebra/d_win.c deleted file mode 100644 index 5e4e1e1fa9..0000000000 --- a/harbour/contrib/hbzebra/d_win.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * Zebra barcode library - * - * Copyright 2010 Viktor Szakats (harbour.01 syenar.hu) - * Copyright 2010 Mindaugas Kavaliauskas - * www - http://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. - * - */ - -#include "hbzebra.h" -#include "hbwapi.h" - -int hb_zebra_draw_wapi( PHB_ZEBRA pZebra, HDC hDC, HBRUSH hBrush, double dX, double dY, double dWidth, double dHeight, int iFlags ) -{ - double dLast; - HB_SIZE n, nLen, nCount; - HB_BOOL fBit, fLastBit; - RECT rect; - - HB_SYMBOL_UNUSED( iFlags ); - - if( pZebra->iError != 0 ) - return HB_ZEBRA_ERROR_INVALIDZEBRA; - - nLen = hb_bitbuffer_len( pZebra->pBits ); - fLastBit = hb_bitbuffer_get( pZebra->pBits, 0 ); - dLast = dX; - nCount = 1; - for( n = 1; n < nLen; n++ ) - { - fBit = hb_bitbuffer_get( pZebra->pBits, n ); - if( fBit != fLastBit ) - { - if( fLastBit ) - { - rect.left = ( LONG ) dLast; - rect.top = ( LONG ) dY; - rect.right = ( LONG ) ( dLast + dWidth * nCount ); - rect.bottom = ( LONG ) ( dY + dHeight ); - FillRect( hDC, &rect, hBrush ); - } - dLast += dWidth * nCount; - nCount = 0; - fLastBit = fBit; - } - nCount++; - } - if( fLastBit ) - { - rect.left = ( LONG ) dLast; - rect.top = ( LONG ) dY; - rect.right = ( LONG ) ( dLast + dWidth * nCount ); - rect.bottom = ( LONG ) ( dY + dHeight ); - FillRect( hDC, &rect, hBrush ); - } - - return 0; -} - -HB_FUNC( HB_ZEBRA_DRAW_WAPI ) -{ - PHB_ZEBRA pZebra = hb_zebra_param( 1 ); - if( pZebra ) - { - HDC hDC = hbwapi_par_HDC( 2 ); - HBRUSH hBrush = hbwapi_par_HBRUSH( 8 ); - if( hDC && hBrush ) - { - hb_retni( hb_zebra_draw_wapi( pZebra, hDC, hBrush, hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ), hb_parni( 7 ) ) ); - } - } -} diff --git a/harbour/contrib/hbzebra/hbzebra.hbp b/harbour/contrib/hbzebra/hbzebra.hbp index 803048030c..f3b929aac0 100644 --- a/harbour/contrib/hbzebra/hbzebra.hbp +++ b/harbour/contrib/hbzebra/hbzebra.hbp @@ -36,23 +36,7 @@ msi.c -depimplibd=cairo:cairo -depfinish=cairo -d_gen.c +coredraw.c {HBMK_HAS_CAIRO}d_cairo.c {HBMK_HAS_CAIRO}../hbcairo/hbcairo.hbc - -{allwin}d_win.c -{allwin}../hbwin/hbwin.hbc - --depoptional=libharu:yes --depkeyhead=libharu:hpdf.h --depcontrol=libharu:local{HB_BUILD_3RDEXT='no'} --depcontrol=libharu:${HB_WITH_LIBHARU} --depincpath=libharu:/usr/include --depincpath=libharu:/usr/local/include --depincpathlocal=libharu:../hbhpdf/3rd/libhpdf --depimplibs=libharu:../libhpdf.dll --depimplibs=libharu:../lib_dll/libhpdf.dll --depfinish=libharu - -{HBMK_HAS_LIBHARU}d_hpdf.c diff --git a/harbour/contrib/hbzebra/tests/testhpdf.prg b/harbour/contrib/hbzebra/tests/testhpdf.prg index 2b0710a6d2..a8e5b86ff3 100644 --- a/harbour/contrib/hbzebra/tests/testhpdf.prg +++ b/harbour/contrib/hbzebra/tests/testhpdf.prg @@ -89,8 +89,8 @@ STATIC FUNCTION hb_zebra_draw_hpdf( hZebra, page, ... ) RETURN HB_ZEBRA_ERROR_INVALIDZEBRA ENDIF - HPDF_Page_SetLineWidth( page, 0.1 ) /* Standard line width */ hb_zebra_draw( hZebra, {| x, y, w, h | HPDF_Page_Rectangle( page, x, y, w, h ) }, ... ) - HPDF_Page_FillStroke( page ) + + HPDF_Page_Fill( page ) RETURN 0