[CONFIGURATION]

* BUG: Remove the libtoolize "--install" flag in the reconf script, as it 
  breaks the "main" source sub-directory. We must add an option to this
  script to handle that flag correctly.

[DEVELOPMENT ENVIRONMENT]
* BUG: Correctly display errors raised at program startup.

[EXAMPLES]
* BUG: The Notepad example has been fixed.

[GB.DRAW]
* NEW: Work continue on the Paint class.


git-svn-id: svn://localhost/gambas/trunk@2514 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2009-12-24 15:09:08 +00:00
parent a05c17d9cc
commit efb2659278
14 changed files with 522 additions and 298 deletions

View File

@ -10,12 +10,32 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: .project:1 #: CComponentBox.class:92
msgid "Gambas 3" msgid "Experimental"
msgstr "" msgstr ""
#: .project:2 #: CComponentBox.class:94 FPropertyProject.class:1883
msgid "Integrated Development Environment for Gambas" msgid "Not finished but stable"
msgstr ""
#: CComponentBox.class:200 ProjectItem.class:70
msgid "Authors"
msgstr ""
#: CComponentBox.class:207 FPropertyProject.class:2082
msgid "Requires"
msgstr ""
#: CComponentBox.class:209
msgid "Excludes"
msgstr ""
#: CComponentBox.class:215
msgid "Implements"
msgstr ""
#: CComponentBox.class:228 FPropertyProject.class:2057
msgid "Provides"
msgstr "" msgstr ""
#: CComponent.class:66 #: CComponent.class:66
@ -270,35 +290,7 @@ msgstr ""
msgid "Loading information on component &1..." msgid "Loading information on component &1..."
msgstr "" msgstr ""
#: CComponentBox.class:92 #: CModule.class:28 FCreateFile.class:625 FEditor.class:3389 FForm.class:3539
msgid "Experimental"
msgstr ""
#: CComponentBox.class:94 FPropertyProject.class:1883
msgid "Not finished but stable"
msgstr ""
#: CComponentBox.class:200 ProjectItem.class:70
msgid "Authors"
msgstr ""
#: CComponentBox.class:207 FPropertyProject.class:2082
msgid "Requires"
msgstr ""
#: CComponentBox.class:209
msgid "Excludes"
msgstr ""
#: CComponentBox.class:215
msgid "Implements"
msgstr ""
#: CComponentBox.class:228 FPropertyProject.class:2057
msgid "Provides"
msgstr ""
#: CModule.class:28 FCreateFile.class:625 FEditor.class:3385 FForm.class:3539
#: FInfo.class:88 #: FInfo.class:88
msgid "Form" msgid "Form"
msgstr "" msgstr ""
@ -335,11 +327,11 @@ msgstr ""
msgid "Gambas reports" msgid "Gambas reports"
msgstr "" msgstr ""
#: Design.module:215 Project.module:1659 #: Design.module:220 Project.module:1659
msgid "In class &1 at line &2." msgid "In class &1 at line &2."
msgstr "" msgstr ""
#: Design.module:319 #: Design.module:324
msgid "" msgid ""
"The program has stopped unexpectedly\n" "The program has stopped unexpectedly\n"
"by raising signal #&1.\n" "by raising signal #&1.\n"
@ -348,13 +340,13 @@ msgid ""
"gambas@users.sourceforge.net." "gambas@users.sourceforge.net."
msgstr "" msgstr ""
#: Design.module:323 #: Design.module:328
msgid "" msgid ""
"The program has returned\n" "The program has returned\n"
"the value: &1" "the value: &1"
msgstr "" msgstr ""
#: Design.module:379 FAbout.class:565 FColorChooser.class:197 #: Design.module:384 FAbout.class:565 FColorChooser.class:197
#: FCommit.class:391 FConnectionEditor.class:411 FCreateFile.class:879 #: FCommit.class:391 FConnectionEditor.class:411 FCreateFile.class:879
#: FFontChooser.class:80 FGotoLine.class:57 FList.class:333 FMain.class:2767 #: FFontChooser.class:80 FGotoLine.class:57 FList.class:333 FMain.class:2767
#: FMakeExecutable.class:138 FMenu.class:1093 FNewConnection.class:586 #: FMakeExecutable.class:138 FMenu.class:1093 FNewConnection.class:586
@ -365,11 +357,11 @@ msgstr ""
msgid "OK" msgid "OK"
msgstr "" msgstr ""
#: Design.module:774 #: Design.module:779
msgid "Output terminal" msgid "Output terminal"
msgstr "" msgstr ""
#: Design.module:801 #: Design.module:806
msgid "No terminal emulator found." msgid "No terminal emulator found."
msgstr "" msgstr ""
@ -442,7 +434,7 @@ msgstr ""
#: FColorChooser.class:203 FCommit.class:397 FConflict.class:191 #: FColorChooser.class:203 FCommit.class:397 FConflict.class:191
#: FConnectionEditor.class:261 FCreateFile.class:885 FDebugInfo.class:490 #: FConnectionEditor.class:261 FCreateFile.class:885 FDebugInfo.class:490
#: FEditor.class:2132 FFind.class:114 FFindList.class:195 #: FEditor.class:2132 FFindList.class:195 FFind.class:114
#: FFontChooser.class:86 FForm.class:2830 FGotoLine.class:63 #: FFontChooser.class:86 FForm.class:2830 FGotoLine.class:63
#: FHelpBrowser.class:258 FIconEditor.class:1393 FImportTable.class:38 #: FHelpBrowser.class:258 FIconEditor.class:1393 FImportTable.class:38
#: FList.class:155 FMain.class:204 FMakeExecutable.class:144 #: FList.class:155 FMain.class:204 FMakeExecutable.class:144
@ -450,7 +442,7 @@ msgstr ""
#: FNewTable.class:168 FNewTranslation.class:70 FOpenProject.class:146 #: FNewTable.class:168 FNewTranslation.class:70 FOpenProject.class:146
#: FOption.class:576 FPasteSpecial.class:279 FPropertyProject.class:1236 #: FOption.class:576 FPasteSpecial.class:279 FPropertyProject.class:1236
#: FSave.class:118 FSelectExtraFile.class:78 FSelectIcon.class:271 #: FSave.class:118 FSelectExtraFile.class:78 FSelectIcon.class:271
#: FTableChooser.class:145 FText.class:107 FTextEditor.class:462 #: FTableChooser.class:145 FTextEditor.class:462 FText.class:107
#: FTranslate.class:606 Project.module:350 #: FTranslate.class:606 Project.module:350
msgid "Cancel" msgid "Cancel"
msgstr "" msgstr ""
@ -1242,7 +1234,7 @@ msgstr ""
msgid "Find definition" msgid "Find definition"
msgstr "" msgstr ""
#: FEditor.class:3144 FHelpBrowser.class:244 #: FEditor.class:3148 FHelpBrowser.class:244
msgid "Go back" msgid "Go back"
msgstr "" msgstr ""
@ -1334,6 +1326,18 @@ msgstr ""
msgid "Procedure list" msgid "Procedure list"
msgstr "" msgstr ""
#: FFindList.class:75
msgid "Column"
msgstr ""
#: FFindList.class:238
msgid "Find list"
msgstr ""
#: FFindList.class:273 FFind.class:395 FOutput.class:309 FTranslate.class:567
msgid "Search string cannot be found."
msgstr ""
#: FFind.class:114 #: FFind.class:114
msgid "Are you sure to want to replace all?" msgid "Are you sure to want to replace all?"
msgstr "" msgstr ""
@ -1342,10 +1346,6 @@ msgstr ""
msgid "Replace" msgid "Replace"
msgstr "" msgstr ""
#: FFind.class:395 FFindList.class:273 FOutput.class:309 FTranslate.class:567
msgid "Search string cannot be found."
msgstr ""
#: FFind.class:397 #: FFind.class:397
msgid "Search string replaced once." msgid "Search string replaced once."
msgstr "" msgstr ""
@ -1402,14 +1402,6 @@ msgstr ""
msgid "Search in strings" msgid "Search in strings"
msgstr "" msgstr ""
#: FFindList.class:75
msgid "Column"
msgstr ""
#: FFindList.class:238
msgid "Find list"
msgstr ""
#: FFontChooser.class:57 #: FFontChooser.class:57
msgid "Select a font" msgid "Select a font"
msgstr "" msgstr ""
@ -3494,6 +3486,10 @@ msgstr ""
msgid "Connection" msgid "Connection"
msgstr "" msgstr ""
#: FTextEditor.class:764
msgid "Text editor"
msgstr ""
#: FText.class:77 #: FText.class:77
msgid "Edit text property" msgid "Edit text property"
msgstr "" msgstr ""
@ -3502,10 +3498,6 @@ msgstr ""
msgid "Use a fixed font" msgid "Use a fixed font"
msgstr "" msgstr ""
#: FTextEditor.class:764
msgid "Text editor"
msgstr ""
#: FTips.class:47 #: FTips.class:47
msgid "Tip of the day" msgid "Tip of the day"
msgstr "" msgstr ""
@ -4814,6 +4806,18 @@ msgstr ""
msgid "'tar' has returned the following error code:" msgid "'tar' has returned the following error code:"
msgstr "" msgstr ""
#: ProjectItem.class:70
msgid "Author"
msgstr ""
#: .project:1
msgid "Gambas 3"
msgstr ""
#: .project:2
msgid "Integrated Development Environment for Gambas"
msgstr ""
#: Project.module:145 #: Project.module:145
msgid "Automation" msgid "Automation"
msgstr "" msgstr ""
@ -5119,10 +5123,6 @@ msgstr ""
msgid "Unable to update all forms." msgid "Unable to update all forms."
msgstr "" msgstr ""
#: ProjectItem.class:70
msgid "Author"
msgstr ""
#: Save.module:38 #: Save.module:38
msgid "Cannot save file !" msgid "Cannot save file !"
msgstr "" msgstr ""

View File

@ -53,9 +53,13 @@ End
Public Sub CheckErrorMessage(hEditor As FEditor) Public Sub CheckErrorMessage(hEditor As FEditor)
If Not $sError Then Return If Not $sError Then Return
If hEditor Then
If hEditor.Name = $sPosClass And If hEditor.Editor.Line = ($iPosLine - 1) Then If hEditor.Name = $sPosClass And If hEditor.Editor.Line = ($iPosLine - 1) Then
hEditor.ShowErrorMessage($sError, "error") hEditor.ShowErrorMessage($sError, "error")
Endif Endif
Else
FMain.ShowError($sError)
Endif
End End
@ -212,12 +216,13 @@ Public Sub Debug_Read(Data As String)
If aData[1] And If Not $bError Then If aData[1] And If Not $bError Then
'$bError = True '$bError = True
$sError = "<b>" & MakeErrorMessage(aData[1]) & "</b><p>" & Subst(("In class &1 at line &2."), $sPosClass, $iPosLine) $sError = "<b>" & MakeErrorMessage(aData[1]) & "</b>"
If sClass Then $sError &= "<p>" & Subst(("In class &1 at line &2."), $sPosClass, $iPosLine)
If sClass Then
Try CheckErrorMessage(Project.ActiveForm) Try CheckErrorMessage(Project.ActiveForm)
' 'Message.Error(aData[1]) Else
' Try Project.ActiveForm.ShowMessage(aData[1], "error") Try CheckErrorMessage(Null)
' If Error Then Message.Error(aData[1]) Endif
' $bError = False
Endif Endif
SetState(STATE_DEBUG) SetState(STATE_DEBUG)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -1,8 +1,10 @@
# Gambas Project File 3.0 # Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r2498)
Startup=FNotepad Startup=FNotepad
Icon=notepad.png Icon=notepad.png
Version=0.0.1 Version=0.0.1
Library=gb.gui Component=gb.gui
Environment="GB_GUI=gb.qt4"
TabSize=2 TabSize=2
Translate=1 Translate=1
Language=fr Language=fr

View File

@ -1,25 +1,25 @@
' Gambas class file ' Gambas class file
STATIC PUBLIC SUB Run() Static Public Sub Run()
DIM hForm AS Form Dim hForm As Form
hForm = NEW FAbout hForm = New FAbout
hForm.ShowModal hForm.ShowModal
END End
PUBLIC SUB _new() Public Sub _new()
ME.Center Me.Center
END End
PUBLIC SUB btnOK_Click() Public Sub btnOK_Click()
ME.Close Me.Close
END End

View File

@ -1,224 +1,225 @@
' Gambas class file ' Gambas class file
PRIVATE $sPath AS String Private $sPath As String
PRIVATE $bModify AS Boolean Private $bModify As Boolean
STATIC PUBLIC SUB Main() Static Public Sub Main()
DIM hForm AS Form Dim hForm As Form
hForm = NEW FNotepad hForm = New FNotepad
hForm.Show hForm.Show
END End
PUBLIC SUB _new() Public Sub _new()
txtNotepad.Text = "" txtNotepad.Text = ""
$bModify = FALSE $bModify = False
RefreshTitle RefreshTitle
txtNotePad.SetFocus txtNotePad.SetFocus
END End
PRIVATE FUNCTION GetName() AS String Private Function GetName() As String
IF $sPath THEN RETURN $sPath If $sPath Then Return $sPath
RETURN "(New document)" Return "(New document)"
END End
PRIVATE SUB RefreshTitle() Private Sub RefreshTitle()
DIM sTitle AS String Dim sTitle As String
IF $bModify THEN sTitle = "*" If $bModify Then sTitle = "*"
sTitle = sTitle & GetName() sTitle = sTitle & GetName()
ME.Title = sTitle Me.Title = sTitle
END End
PRIVATE SUB SetPath(sPath AS String) Private Sub SetPath(sPath As String)
$sPath = sPath $sPath = sPath
RefreshTitle RefreshTitle
END End
PRIVATE SUB SetModify(bModify AS Boolean) Private Sub SetModify(bModify As Boolean)
IF $bModify = bModify THEN RETURN If $bModify = bModify Then Return
$bModify = bModify $bModify = bModify
RefreshTitle RefreshTitle
END End
PRIVATE FUNCTION CloseDoc() AS Boolean Private Function CloseDoc() As Boolean
IF $bModify THEN If $bModify Then
SELECT CASE Message.Question(GetName() & "\n\nFile has been modified. Do you want to save it ?", "Yes", "No", "Cancel") Select Case Message.Question(GetName() & "\n\nFile has been modified. Do you want to save it ?", "Yes", "No", "Cancel")
CASE 1 Case 1
Save Save
CASE 3 Case 3
RETURN TRUE Return True
END SELECT End Select
ENDIF Endif
$sPath = "" $sPath = ""
txtNotepad.Text = "" txtNotepad.Text = ""
$bModify = FALSE $bModify = False
RefreshTitle RefreshTitle
END End
PUBLIC SUB Load(sPath AS String) Public Sub LoadFile(sPath As String)
DIM sData AS String Dim sData As String
IF CloseDoc() THEN RETURN If CloseDoc() Then Return
sData = File.Load(sPath) sData = File.Load(sPath)
txtNotepad.Text = Conv(sData, System.Charset, Desktop.Charset) Try txtNotepad.Text = Conv(sData, System.Charset, Desktop.Charset)
$bModify = FALSE If Error Then txtNotepad.Text = Conv(sData, "ISO_8859-1", Desktop.Charset)
$bModify = False
SetPath(sPath) SetPath(sPath)
CATCH Catch
Message.Error(sPath & "\nUnable to load file.\n" & Error.Text) Message.Error(sPath & "\nUnable to load file.\n" & Error.Text)
END End
PUBLIC SUB Save(OPTIONAL bSaveAs AS Boolean) Public Sub Save(Optional bSaveAs As Boolean)
IF bSaveAs OR NOT $sPath THEN If bSaveAs Or Not $sPath Then
IF Dialog.SaveFile() THEN RETURN If Dialog.SaveFile() Then Return
SetPath(Dialog.Path) SetPath(Dialog.Path)
ENDIF Endif
File.Save($sPath, txtNotepad.Text) File.Save($sPath, txtNotepad.Text)
END End
PUBLIC SUB mnuOpen_Click() Public Sub mnuOpen_Click()
DIM sPath AS String Dim sPath As String
Dialog.Filter = ["*", "All files", "*.{c;cpp;h}", "C/C++ files", "*.txt", "Text files", "*.desktop", "Desktop files"] Dialog.Filter = ["*", "All files", "*.{c;cpp;h}", "C/C++ files", "*.txt", "Text files", "*.desktop", "Desktop files"]
IF Dialog.OpenFile() THEN RETURN If Dialog.OpenFile() Then Return
Load(Dialog.Path) LoadFile(Dialog.Path)
END End
PUBLIC SUB mnuSave_Click() Public Sub mnuSave_Click()
Save Save
END End
PUBLIC SUB mnuSaveAs_Click() Public Sub mnuSaveAs_Click()
Save(TRUE) Save(True)
END End
PUBLIC SUB mnuQuit_Click() Public Sub mnuQuit_Click()
ME.Close Me.Close
END End
PUBLIC SUB txtNotepad_Change() Public Sub txtNotepad_Change()
SetModify(TRUE) SetModify(True)
END End
PUBLIC SUB mnuClose_Click() Public Sub mnuClose_Click()
CloseDoc CloseDoc
END End
PUBLIC SUB Form_Close() Public Sub Form_Close()
IF CloseDoc() THEN STOP EVENT If CloseDoc() Then Stop Event
END End
PUBLIC SUB mnuAbout_Click() Public Sub mnuAbout_Click()
INC Application.Busy 'Inc Application.Busy
FAbout.Run FAbout.Run
DEC Application.Busy 'Dec Application.Busy
END End
PUBLIC SUB mnuCopy_Click() Public Sub mnuCopy_Click()
txtNotepad.Copy txtNotepad.Copy
END End
PUBLIC SUB mnuPaste_Click() Public Sub mnuPaste_Click()
txtNotepad.Paste txtNotepad.Paste
END End
PUBLIC SUB mnuCut_Click() Public Sub mnuCut_Click()
txtNotepad.Cut txtNotepad.Cut
END End
PUBLIC SUB mnuUndo_Click() Public Sub mnuUndo_Click()
txtNotepad.Undo txtNotepad.Undo
END End
PUBLIC SUB mnuRedo_Click() Public Sub mnuRedo_Click()
txtNotepad.Redo txtNotepad.Redo
END End
PUBLIC SUB mnuFont_Click() Public Sub mnuFont_Click()
Dialog.Font = txtNotepad.Font Dialog.Font = txtNotepad.Font
IF Dialog.SelectFont() THEN RETURN If Dialog.SelectFont() Then Return
txtNotepad.Font = Dialog.Font txtNotepad.Font = Dialog.Font
END End
PUBLIC SUB mnuWrap_Click() Public Sub mnuWrap_Click()
mnuWrap.Checked = NOT mnuWrap.Checked mnuWrap.Checked = Not mnuWrap.Checked
txtNotePad.Wrap = mnuWrap.Checked txtNotePad.Wrap = mnuWrap.Checked
END End

View File

@ -901,7 +901,9 @@ void CLASS_make_description(CLASS *class, CLASS_DESC *desc, int n_desc, int *fir
if (check_override(parent_type, type)) if (check_override(parent_type, type))
{ {
#if DEBUG_DESC
fprintf(stderr, "type = '%c' parent_type = '%c'\n", type, parent_type); fprintf(stderr, "type = '%c' parent_type = '%c'\n", type, parent_type);
#endif
THROW(E_OVERRIDE, parent->name, cds->name, class->name); THROW(E_OVERRIDE, parent->name, cds->name, class->name);
} }
} }

View File

@ -57,7 +57,7 @@
#include "gbx_library.h" #include "gbx_library.h"
/*#define DEBUG*/ //#define DEBUG
//#define DEBUG_PRELOAD //#define DEBUG_PRELOAD
// Maximum size of a project or startup file // Maximum size of a project or startup file
@ -445,14 +445,14 @@ void LIBRARY_load(LIBRARY *lib)
GB_DESC **desc; GB_DESC **desc;
char *path; char *path;
if (lib->handle)
return;
#ifdef DEBUG #ifdef DEBUG
clock_t t = clock(); clock_t t = clock();
fprintf(stderr, "Loading library %s\n", lib->name); fprintf(stderr, "Loading library %s\n", lib->name);
#endif #endif
if (lib->handle)
return;
path = FILE_buffer(); path = FILE_buffer();
sprintf(path, LIB_PATTERN, COMPONENT_path, lib->name); sprintf(path, LIB_PATTERN, COMPONENT_path, lib->name);

View File

@ -7,10 +7,11 @@ gb_draw_la_LDFLAGS = -module @LD_FLAGS@
gb_draw_la_CFLAGS = -I$(top_srcdir)/share @INCLTDL@ $(AM_CFLAGS) gb_draw_la_CFLAGS = -I$(top_srcdir)/share @INCLTDL@ $(AM_CFLAGS)
gb_draw_la_SOURCES = \ gb_draw_la_SOURCES = \
gb.draw.h \ gb.draw.h gb.paint.h \
gb_list.c \ gb_list.c \
matrix.h matrix.c \ matrix.h matrix.c \
CDraw.h CDraw.c \ CDraw.h CDraw.c \
cpaint.h cpaint.c \
main.h main.c main.h main.c

View File

@ -30,6 +30,10 @@ static GB_PAINT *_current = NULL;
#define THIS _current #define THIS _current
#define PAINT _current->desc #define PAINT _current->desc
#define THIS_EXTENTS ((PAINT_EXTENTS *)_object)
#define THIS_BRUSH ((PAINT_BRUSH *)_object)
#define THIS_MATRIX ((PAINT_MATRIX *)_object)
static bool check_device() static bool check_device()
{ {
if (!_current) if (!_current)
@ -71,7 +75,7 @@ bool PAINT_begin(void *device)
paint->device = device; paint->device = device;
_current = paint; _current = paint;
if (paint->desc->Begin(paint)) if (PAINT->Begin(paint))
return TRUE; return TRUE;
//DRAW->SetBackground(draw, GB_PAINT_COLOR_DEFAULT); //DRAW->SetBackground(draw, GB_PAINT_COLOR_DEFAULT);
@ -80,96 +84,60 @@ bool PAINT_begin(void *device)
return FALSE; return FALSE;
} }
void PAINT_end()
BEGIN_METHOD(Paint_begin, GB_OBJECT device)
void *device = VARG(device);
if (GB.CheckObject(device))
return;
DRAW_begin(device);
END_METHOD
void DRAW_end()
{ {
GB_PAINT *draw; GB_PAINT *paint;
if (!_current) if (!_current)
return; return;
draw = _current; paint = _current;
_current = _current->previous; _current = _current->previous;
draw->desc->End(draw); PAINT->End(paint);
GB.Unref(POINTER(&draw->device)); GB.Unref(POINTER(&paint->device));
GB.Free(POINTER(&draw)); GB.Free(POINTER(&paint));
} }
BEGIN_METHOD_VOID(Paint_end) /**** PaintExtents *********************************************************/
DRAW_end(); #define IMPLEMENT_EXTENTS_PROPERTY(_method, _field) \
BEGIN_PROPERTY(_method) \
GB.ReturnFloat(THIS_EXTENTS->ext._field); \
END_PROPERTY
END_METHOD IMPLEMENT_EXTENTS_PROPERTY(PaintExtents_X, x1)
IMPLEMENT_EXTENTS_PROPERTY(PaintExtents_Y, y1)
IMPLEMENT_EXTENTS_PROPERTY(PaintExtents_X2, x2)
IMPLEMENT_EXTENTS_PROPERTY(PaintExtents_Y2, y2)
BEGIN_PROPERTY(PaintExtents_Width)
BEGIN_METHOD_VOID(Paint_exit) GB.ReturnFloat(THIS_EXTENTS->ext.x2 - THIS_EXTENTS->ext.x1);
while (_current)
DRAW_end();
END_METHOD
BEGIN_METHOD_VOID(Paint_save)
CHECK_DEVICE();
DRAW->Save(THIS);
END_METHOD
BEGIN_METHOD_VOID(Paint_restore)
CHECK_DEVICE();
DRAW->Restore(THIS);
END_METHOD
BEGIN_PROPERTY(Paint_device)
CHECK_DEVICE();
GB.ReturnObject(THIS->device);
END_PROPERTY END_PROPERTY
BEGIN_PROPERTY(Paint_width) BEGIN_PROPERTY(PaintExtents_Height)
CHECK_DEVICE(); GB.ReturnFloat(THIS_EXTENTS->ext.y2 - THIS_EXTENTS->ext.y1);
GB.ReturnInteger(THIS->width);
END_PROPERTY END_PROPERTY
BEGIN_METHOD(PaintExtents_Merge, GB_OBJECT extents)
BEGIN_PROPERTY(Paint_height) PAINT_EXTENTS *extents = VARG(extents);
CHECK_DEVICE(); if (GB.CheckObject(extents))
GB.ReturnInteger(THIS->height); return;
END_PROPERTY if (extents->ext.x1 < THIS_EXTENTS->ext.x1) THIS_EXTENTS->ext.x1 = extents->ext.x1;
if (extents->ext.y1 < THIS_EXTENTS->ext.y1) THIS_EXTENTS->ext.y1 = extents->ext.y1;
if (extents->ext.x2 > THIS_EXTENTS->ext.x2) THIS_EXTENTS->ext.x2 = extents->ext.x2;
BEGIN_PROPERTY(Paint_resolution) if (extents->ext.y2 > THIS_EXTENTS->ext.y2) THIS_EXTENTS->ext.y2 = extents->ext.y2;
CHECK_DEVICE();
GB.ReturnInteger(THIS->resolution);
END_PROPERTY
END_METHOD
GB_DESC PaintExtentsDesc[] = GB_DESC PaintExtentsDesc[] =
{ {
@ -187,32 +155,269 @@ GB_DESC PaintExtentsDesc[] =
GB_END_DECLARE GB_END_DECLARE
}; };
/**** PaintMatrix **********************************************************/
static GB_PAINT_DESC *handle_matrix(void *_object, bool set, GB_TRANSFORM *pmatrix)
{
if (!_object)
{
PAINT->Matrix(THIS, set, pmatrix);
return PAINT;
}
else
{
THIS_BRUSH->desc->Brush.Matrix(THIS_BRUSH->brush, set, pmatrix);
return THIS_BRUSH->desc;
}
}
#define IMPLEMENT_MATRIX_METHOD_VOID(_method, _code) \
BEGIN_METHOD_VOID(_method) \
GB_TRANSFORM matrix; \
handle_matrix(_object, FALSE, &matrix)->Transform._code; \
handle_matrix(_object, TRUE, &matrix); \
RETURN_SELF(); \
END_METHOD
#define IMPLEMENT_MATRIX_METHOD(_method, _arg, _code) \
BEGIN_METHOD(_method, _arg) \
GB_TRANSFORM matrix; \
handle_matrix(_object, FALSE, &matrix)->Transform._code; \
handle_matrix(_object, TRUE, &matrix); \
RETURN_SELF(); \
END_METHOD
IMPLEMENT_MATRIX_METHOD_VOID(PaintMatrix_Reset, Init(matrix, 1, 0, 0, 1, 0, 0))
IMPLEMENT_MATRIX_METHOD(PaintMatrix_Translate, GB_FLOAT tx; GB_FLOAT ty, Translate(matrix, VARG(tx), VARG(ty)))
IMPLEMENT_MATRIX_METHOD(PaintMatrix_Scale, GB_FLOAT sx; GB_FLOAT sy, Scale(matrix, VARG(sx), VARG(sy)))
IMPLEMENT_MATRIX_METHOD(PaintMatrix_Rotate, GB_FLOAT angle, Rotate(matrix, VARG(angle)))
BEGIN_METHOD_VOID(PaintMatrix_Invert)
GB_TRANSFORM matrix;
if (handle_matrix(_object, FALSE, &matrix)->Transform.Invert(matrix))
{
GB.ReturnNull();
return;
}
handle_matrix(_object, TRUE, &matrix);
RETURN_SELF();
END_METHOD
BEGIN_METHOD(PaintMatrix_Multiply, GB_OBJECT matrix2)
GB_TRANSFORM matrix;
PAINT_MATRIX *matrix2 = (PAINT_MATRIX *)VARG(matrix2);
if (GB.CheckObject(matrix2))
return;
handle_matrix(_object, FALSE, &matrix)->Transform.Multiply(matrix, matrix2->matrix);
handle_matrix(_object, TRUE, &matrix);
RETURN_SELF();
END_METHOD
GB_DESC PaintMatrixDesc[] =
{
GB_DECLARE(".PaintMatrix", 0), GB_VIRTUAL_CLASS(),
//GB_METHOD("_new", NULL, PaintMatrix_new, "[(XX)f(YX)f(XY)f(YY)f(X0)f(Y0)f]"),
//GB_STATIC_METHOD("_call", "PaintMatrix", PaintMatrix_call, "[(XX)f(YX)f(XY)f(YY)f(X0)f(Y0)f]"),
GB_METHOD("Reset", ".PaintMatrix", PaintMatrix_Reset, NULL),
GB_METHOD("Translate", ".PaintMatrix", PaintMatrix_Translate, "(TX)f(TY)f"),
GB_METHOD("Scale", ".PaintMatrix", PaintMatrix_Scale, "(SX)f(SY)f"),
GB_METHOD("Rotate", ".PaintMatrix", PaintMatrix_Rotate, "(Angle)f"),
GB_METHOD("Invert", ".PaintMatrix", PaintMatrix_Invert, NULL),
GB_METHOD("Multiply", ".PaintMatrix", PaintMatrix_Multiply, "(Matrix)PaintMatrix;"),
GB_END_DECLARE
};
/**** PaintBrush ***********************************************************/
BEGIN_METHOD_VOID(PaintBrush_free)
THIS_BRUSH->desc->Brush.Free(THIS_BRUSH->brush);
END_METHOD
GB_DESC PaintBrushDesc[] = GB_DESC PaintBrushDesc[] =
{ {
GB_DECLARE("PaintBrush", sizeof(PAINT_BRUSH)), GB_NOT_CREATABLE(), GB_DECLARE("PaintBrush", sizeof(PAINT_BRUSH)), GB_NOT_CREATABLE(),
GB_METHOD("_free", NULL, PaintBrush_free, NULL), GB_METHOD("_free", NULL, PaintBrush_free, NULL),
GB_PROPERTY("Matrix", "PaintMatrix", PaintBrush_Matrix), GB_PROPERTY_SELF("Matrix", ".PaintMatrix"),
GB_END_DECLARE GB_END_DECLARE
}; };
GB_DESC PaintMatrixDesc[] =
{
GB_DECLARE("PaintMatrix", sizeof(PAINT_MATRIX)),
GB_METHOD("_new", NULL, PaintMatrix_new, "[(XX)f(YX)f(XY)f(YY)f(X0)f(Y0)f]"), /**** Paint ****************************************************************/
GB_STATIC_METHOD("_call", "PaintMatrix", PaintMatrix_call, "[(XX)f(YX)f(XY)f(YY)f(X0)f(Y0)f]"),
GB_METHOD("Translate", "PaintMatrix", PaintMatrix_translate, "(TX)f(TY)f"),
GB_METHOD("Scale", "PaintMatrix", PaintMatrix_scale, "(SX)f(SY)f"),
GB_METHOD("Rotate", "PaintMatrix", PaintMatrix_rotate, "(Angle)f"),
GB_METHOD("Invert", "PaintMatrix", PaintMatrix_invert, NULL),
GB_METHOD("Multiply", "PaintMatrix", PaintMatrix_multiply, "(Matrix)PaintMatrix;"),
GB_END_DECLARE BEGIN_METHOD(Paint_begin, GB_OBJECT device)
};
void *device = VARG(device);
if (GB.CheckObject(device))
return;
PAINT_begin(device);
END_METHOD
BEGIN_METHOD_VOID(Paint_end)
PAINT_end();
END_METHOD
BEGIN_METHOD_VOID(Paint_exit)
while (_current)
PAINT_end();
END_METHOD
BEGIN_PROPERTY(Paint_Device)
CHECK_DEVICE();
GB.ReturnObject(THIS->device);
END_PROPERTY
BEGIN_PROPERTY(Paint_Width)
CHECK_DEVICE();
GB.ReturnInteger(THIS->width);
END_PROPERTY
BEGIN_PROPERTY(Paint_Height)
CHECK_DEVICE();
GB.ReturnInteger(THIS->height);
END_PROPERTY
BEGIN_PROPERTY(Paint_Resolution)
CHECK_DEVICE();
GB.ReturnInteger(THIS->resolution);
END_PROPERTY
#define IMPLEMENT_METHOD(_method, _api) \
BEGIN_METHOD_VOID(_method) \
CHECK_DEVICE(); \
PAINT->_api(THIS); \
END_METHOD
#define IMPLEMENT_METHOD_PRESERVE(_method, _api) \
BEGIN_METHOD(_method, GB_BOOLEAN preserve) \
CHECK_DEVICE(); \
PAINT->_api(THIS, VARGOPT(preserve, FALSE)); \
END_METHOD
#define IMPLEMENT_PROPERTY_EXTENTS(_property, _api) \
BEGIN_PROPERTY(_property) \
PAINT_EXTENTS *extents; \
CHECK_DEVICE(); \
GB.New(POINTER(&extents), GB.FindClass("PaintExtents"), NULL, NULL); \
PAINT->_api(THIS, &extents->ext); \
GB.ReturnObject(extents); \
END_METHOD
#define IMPLEMENT_PROPERTY_INTEGER(_property, _api) \
BEGIN_PROPERTY(_property) \
int value; \
CHECK_DEVICE(); \
if (READ_PROPERTY) \
{ \
PAINT->_api(THIS, FALSE, &value); \
GB.ReturnInteger(value); \
} \
else \
{ \
value = VPROP(GB_INTEGER); \
PAINT->_api(THIS, TRUE, &value); \
} \
END_METHOD
#define IMPLEMENT_PROPERTY_FLOAT(_property, _api) \
BEGIN_PROPERTY(_property) \
double value; \
CHECK_DEVICE(); \
if (READ_PROPERTY) \
{ \
PAINT->_api(THIS, FALSE, &value); \
GB.ReturnFloat(value); \
} \
else \
{ \
value = VPROP(GB_FLOAT); \
PAINT->_api(THIS, TRUE, &value); \
} \
END_METHOD
IMPLEMENT_METHOD(Paint_Save, Save)
IMPLEMENT_METHOD(Paint_Restore, Restore)
IMPLEMENT_METHOD_PRESERVE(Paint_Clip, Clip)
IMPLEMENT_METHOD(Paint_ResetClip, ResetClip)
IMPLEMENT_PROPERTY_EXTENTS(Paint_ClipExtents, ClipExtents)
IMPLEMENT_METHOD_PRESERVE(Paint_Fill, Fill)
IMPLEMENT_METHOD_PRESERVE(Paint_Stroke, Stroke)
IMPLEMENT_PROPERTY_EXTENTS(Paint_PathExtents, PathExtents)
IMPLEMENT_PROPERTY_INTEGER(Paint_FillRule, FillRule)
IMPLEMENT_PROPERTY_INTEGER(Paint_LineCap, LineCap)
IMPLEMENT_PROPERTY_INTEGER(Paint_LineJoin, LineJoin)
IMPLEMENT_PROPERTY_INTEGER(Paint_Operator, Operator)
IMPLEMENT_PROPERTY_FLOAT(Paint_LineWidth, LineWidth)
IMPLEMENT_PROPERTY_FLOAT(Paint_MiterLimit, MiterLimit)
IMPLEMENT_PROPERTY_FLOAT(Paint_DashOffset, DashOffset)
IMPLEMENT_METHOD(Paint_NewPath, NewPath)
IMPLEMENT_METHOD(Paint_ClosePath, ClosePath)
BEGIN_METHOD(Paint_Arc, GB_FLOAT xc; GB_FLOAT yc; GB_FLOAT radius; GB_FLOAT angle1; GB_FLOAT angle2)
CHECK_DEVICE();
PAINT->Arc(THIS, VARG(xc), VARG(yc), VARG(radius), VARGOPT(angle1, 0.0), VARGOPT(angle2, M_PI * 2));
END_METHOD
BEGIN_METHOD(Paint_CurveTo, GB_FLOAT x1; GB_FLOAT y1; GB_FLOAT x2; GB_FLOAT y2; GB_FLOAT x3; GB_FLOAT y3)
CHECK_DEVICE();
PAINT->CurveTo(THIS, VARG(x1), VARG(y1), VARG(x2), VARG(y2), VARG(x3), VARG(y3));
END_METHOD
BEGIN_METHOD(Paint_LineTo, GB_FLOAT x; GB_FLOAT y)
CHECK_DEVICE();
PAINT->LineTo(THIS, VARG(x), VARG(y));
END_METHOD
BEGIN_METHOD(Paint_MoveTo, GB_FLOAT x; GB_FLOAT y)
CHECK_DEVICE();
PAINT->MoveTo(THIS, VARG(x), VARG(y));
END_METHOD
BEGIN_METHOD(Paint_Rectangle, GB_FLOAT x; GB_FLOAT y; GB_FLOAT w; GB_FLOAT h)
CHECK_DEVICE();
PAINT->Rectangle(THIS, VARG(x), VARG(y), VARG(w), VARG(h));
END_METHOD
GB_DESC CPaintDesc[] = GB_DESC CPaintDesc[] =
{ {
@ -253,10 +458,15 @@ GB_DESC CPaintDesc[] =
GB_STATIC_METHOD("Begin", NULL, Paint_begin, "(Device)o"), GB_STATIC_METHOD("Begin", NULL, Paint_begin, "(Device)o"),
GB_STATIC_METHOD("End", NULL, Paint_end, NULL), GB_STATIC_METHOD("End", NULL, Paint_end, NULL),
GB_STATIC_PROPERTY_READ("Device", "o", Paint_device), GB_STATIC_PROPERTY_READ("Device", "o", Paint_Device),
GB_STATIC_PROPERTY_READ("W", "i", Paint_Width),
GB_STATIC_PROPERTY_READ("H", "i", Paint_Height),
GB_STATIC_PROPERTY_READ("Width", "i", Paint_Width),
GB_STATIC_PROPERTY_READ("Height", "i", Paint_Height),
GB_STATIC_PROPERTY_READ("Resolution", "i", Paint_Resolution),
GB_STATIC_METHOD("Save", NULL, Paint_save, NULL), GB_STATIC_METHOD("Save", NULL, Paint_Save, NULL),
GB_STATIC_METHOD("Restore", NULL, Paint_restore, NULL), GB_STATIC_METHOD("Restore", NULL, Paint_Restore, NULL),
GB_STATIC_METHOD("Clip", NULL, Paint_Clip, "[(Preserve)b]"), GB_STATIC_METHOD("Clip", NULL, Paint_Clip, "[(Preserve)b]"),
GB_STATIC_METHOD("ResetClip", NULL, Paint_ResetClip, NULL), GB_STATIC_METHOD("ResetClip", NULL, Paint_ResetClip, NULL),
@ -275,11 +485,10 @@ GB_DESC CPaintDesc[] =
//GB_STATIC_METHOD("InStroke", "b", Paint_InStroke, "(X)f(Y)f"), //GB_STATIC_METHOD("InStroke", "b", Paint_InStroke, "(X)f(Y)f"),
GB_STATIC_PROPERTY_READ("PathExtents", "PaintExtents", Paint_PathExtents), GB_STATIC_PROPERTY_READ("PathExtents", "PaintExtents", Paint_PathExtents),
GB_STATIC_METHOD("PathContains", "b", Paint_InPath, "(X)f(Y)f"), //GB_STATIC_METHOD("PathContains", "b", Paint_InPath, "(X)f(Y)f"),
GB_STATIC_PROPERTY("Brush", "PaintBrush", Paint_Brush), //GB_STATIC_PROPERTY("Brush", "PaintBrush", Paint_Brush),
//GB_STATIC_PROPERTY("AntiAlias", "i", CAIRO_anti_alias), //GB_STATIC_PROPERTY("Dash", "Float[]", Paint_Dash),
GB_STATIC_PROPERTY("Dash", "Float[]", Paint_Dash),
GB_STATIC_PROPERTY("DashOffset", "f", Paint_DashOffset), GB_STATIC_PROPERTY("DashOffset", "f", Paint_DashOffset),
GB_STATIC_PROPERTY("FillRule", "i", Paint_FillRule), GB_STATIC_PROPERTY("FillRule", "i", Paint_FillRule),
GB_STATIC_PROPERTY("LineCap", "i", Paint_LineCap), GB_STATIC_PROPERTY("LineCap", "i", Paint_LineCap),
@ -300,22 +509,18 @@ GB_DESC CPaintDesc[] =
GB_STATIC_METHOD("MoveTo", NULL, Paint_MoveTo, "(X)f(Y)f"), GB_STATIC_METHOD("MoveTo", NULL, Paint_MoveTo, "(X)f(Y)f"),
GB_STATIC_METHOD("Rectangle", NULL, Paint_Rectangle, "(X)f(Y)f(Width)f(Height)f"), GB_STATIC_METHOD("Rectangle", NULL, Paint_Rectangle, "(X)f(Y)f(Width)f(Height)f"),
GB_STATIC_PROPERTY("Font", "PaintFont", Paint_Font), #if 0
GB_STATIC_METHOD("Text", NULL, Paint_Text, "(Text)s(X)f(Y)f[(Width)f(Height)f(Alignment)i)]"), GB_STATIC_PROPERTY("Font", "Font", Paint_Font),
GB_STATIC_METHOD("Text", NULL, Paint_Text, "(Text)s[(X)f(Y)f(Width)f(Height)f(Alignment)i)]"),
GB_STATIC_METHOD("TextExtents", "TextExtents", Paint_TextExtents, "(Text)s"), GB_STATIC_METHOD("TextExtents", "TextExtents", Paint_TextExtents, "(Text)s"),
//GB_STATIC_METHOD("RelCurveTo", NULL, CAIRO_rel_curve_to, "(DX1)f(DY1)f(DX2)f(DY2)f(DX3)f(DY3)f"),
//GB_STATIC_METHOD("RelLineTo", NULL, CAIRO_rel_line_to, "(DX)f(DY)f"),
//GB_STATIC_METHOD("RelMoveTo", NULL, CAIRO_rel_move_to, "(DX)f(DY)f"),
GB_STATIC_METHOD("ColorBrush", "PaintBrush", Paint_ColorBrush, "(Color)i"), GB_STATIC_METHOD("ColorBrush", "PaintBrush", Paint_ColorBrush, "(Color)i"),
GB_STATIC_METHOD("ImageBrush", "PaintBrush", Paint_ImageBrush, "(Image)Image;[(X)f(Y)f(Extend)i]"), GB_STATIC_METHOD("ImageBrush", "PaintBrush", Paint_ImageBrush, "(Image)Image;[(X)f(Y)f(Extend)i]"),
GB_STATIC_METHOD("LinearGradient", "PaintBrush", Paint_LinearGradient, "(X0)f(Y0)f(X1)f(Y1)f(Colors)Float[][];"), GB_STATIC_METHOD("LinearGradient", "PaintBrush", Paint_LinearGradient, "(X0)f(Y0)f(X1)f(Y1)f(Colors)Float[][];"),
GB_STATIC_METHOD("RadialGradient", "PaintBrush", Paint_RadialGradient, "(CX0)f(CY0)f(Radius0)f(CX1)f(CY1)f(Radius1)f(Colors)Float[][];"), GB_STATIC_METHOD("RadialGradient", "PaintBrush", Paint_RadialGradient, "(CX0)f(CY0)f(Radius0)f(CX1)f(CY1)f(Radius1)f(Colors)Float[][];"),
GB_STATIC_METHOD("Translate", NULL, Paint_Translate, "(TX)f(TY)f"), GB_STATIC_PROPERTY_SELF("Matrix", ".PaintMatrix"),
GB_STATIC_METHOD("Scale", NULL, Paint_Scale, "(SX)f(SY)f"), #endif
GB_STATIC_METHOD("Rotate", NULL, Paint_Rotate, "(Angle)f"),
GB_STATIC_PROPERTY("Matrix", "PaintMatrix", Paint_Matrix),
GB_END_DECLARE GB_END_DECLARE
}; };

View File

@ -24,11 +24,13 @@
#define __CPAINT_H #define __CPAINT_H
#include "gambas.h" #include "gambas.h"
#include "gb.draw.h" #include "gb.paint.h"
#ifndef __CPAINT_C #ifndef __CPAINT_C
extern GB_DESC CPaintDesc[]; extern GB_DESC PaintExtentsDesc[];
extern GB_DESC PaintBrushDesc[];
extern GB_DESC PaintDesc[];
#endif #endif

View File

@ -60,16 +60,18 @@ enum {
GB_PAINT_OPERATOR_DEST, GB_PAINT_OPERATOR_DEST,
GB_PAINT_OPERATOR_DEST_OVER, GB_PAINT_OPERATOR_DEST_OVER,
GB_PAINT_OPERATOR_DEST_IN, GB_PAINT_OPERATOR_DEST_IN,
GB_PAINT_OPERATOR_DEST_OUT GB_PAINT_OPERATOR_DEST_OUT,
GB_PAINT_OPERATOR_DEST_ATOP, GB_PAINT_OPERATOR_DEST_ATOP,
GB_PAINT_OPERATOR_XOR, GB_PAINT_OPERATOR_XOR,
GB_PAINT_OPERATOR_ADD, GB_PAINT_OPERATOR_ADD,
GB_PAINT_OPERATOR_SATURATE GB_PAINT_OPERATOR_SATURATE
}; };
struct GB_PAINT_DESC;
typedef typedef
struct { struct {
double x1, x2, y1, y2; double x1, y1, x2, y2;
} }
GB_EXTENTS; GB_EXTENTS;
@ -89,6 +91,7 @@ typedef
typedef typedef
struct { struct {
GB_BASE ob; GB_BASE ob;
struct GB_PAINT_DESC *desc; // drawing driver
GB_TRANSFORM matrix; GB_TRANSFORM matrix;
} }
PAINT_MATRIX; PAINT_MATRIX;
@ -96,6 +99,7 @@ typedef
typedef typedef
struct { struct {
GB_BASE ob; GB_BASE ob;
struct GB_PAINT_DESC *desc; // drawing driver
GB_BRUSH brush; GB_BRUSH brush;
} }
PAINT_BRUSH; PAINT_BRUSH;
@ -156,21 +160,36 @@ typedef
void (*LineTo)(GB_PAINT *d, double x, double y); void (*LineTo)(GB_PAINT *d, double x, double y);
void (*CurveTo)(GB_PAINT *d, double x1, double y1, double x2, double y2, double x3, double y3); void (*CurveTo)(GB_PAINT *d, double x1, double y1, double x2, double y2, double x3, double y3);
void (*Text)(GB_PAINT *d, const char *text, double x, double y); void (*Text)(GB_PAINT *d, const char *text);
void (*TextExtents)(GB_PAINT *d, const char *text, GB_EXTENTS *ext); void (*TextExtents)(GB_PAINT *d, const char *text, GB_EXTENTS *ext);
void (*SetBrush)(GB_PAINT *d, GB_BRUSH brush);
void (*FreeBrush)(GB_PAINT *d, GB_BRUSH brush);
GB_BRUSH (*ColorBrush)(GB_PAINT *d, GB_COLOR color);
GB_BRUSH (*ImageBrush)(GB_PAINT *d, GB_IMAGE image, double x, double y, int extend);
GB_BRUSH (*LinearGradient)(GB_PAINT *d, double x0, double y0, double x1, double y1);
GB_BRUSH (*RadialGradient)(GB_PAINT *d, double cx0, double cy0, double r0, double cx1, double cy1, double r1);
void (*SetColorStop)(GB_PAINT *d, GB_BRUSH *brush, int nstop, double *pos, GB_COLOR *color);
void (*Translate)(GB_PAINT *d, double tx, double ty); void (*Translate)(GB_PAINT *d, double tx, double ty);
void (*Scale)(GB_PAINT *d, double sx, double sy); void (*Scale)(GB_PAINT *d, double sx, double sy);
void (*Rotate)(GB_PAINT *d, double angle); void (*Rotate)(GB_PAINT *d, double angle);
void (*Matrix)(GB_PAINT *d, bool set, GB_TRANSFORM *matrix); void (*Matrix)(GB_PAINT *d, bool set, GB_TRANSFORM *matrix);
void (*SetBrush)(GB_PAINT *d, GB_BRUSH brush);
struct {
void (*Free)(GB_BRUSH brush);
void (*Color)(GB_BRUSH *brush, GB_COLOR color);
void (*Image)(GB_BRUSH *brush, GB_IMAGE image, double x, double y, int extend);
void (*LinearGradient)(GB_BRUSH *brush, double x0, double y0, double x1, double y1);
void (*RadialGradient)(GB_BRUSH *brush, double cx0, double cy0, double r0, double cx1, double cy1, double r1);
void (*SetColorStop)(GB_BRUSH brush, int nstop, double *pos, GB_COLOR *color);
void (*Matrix)(GB_BRUSH brush, bool set, GB_TRANSFORM *matrix);
}
Brush;
struct {
void (*Init)(GB_TRANSFORM matrix, double xx, double yx, double xy, double yy, double x0, double y0);
void (*Translate)(GB_TRANSFORM matrix, double tx, double ty);
void (*Scale)(GB_TRANSFORM matrix, double sx, double sy);
void (*Rotate)(GB_TRANSFORM matrix, double angle);
bool (*Invert)(GB_TRANSFORM matrix);
void (*Multiply)(GB_TRANSFORM matrix, GB_TRANSFORM matrix2);
}
Transform;
} }
GB_PAINT_DESC; GB_PAINT_DESC;
@ -183,20 +202,6 @@ typedef
} }
PAINT_INTERFACE; PAINT_INTERFACE;
#define DRAW_NORMALIZE(x, y, w, h, sx, sy, sw, sh, width, height) \
if (w < 0) w = width; \
if (h < 0) h = height; \
if (sw < 0) sw = width; \
if (sh < 0) sh = height; \
if (sx >= (width) || sy >= (height) || sw <= 0 || sh <= 0) \
return; \
if (sx < 0) x -= sx, sx = 0; \
if (sy < 0) y -= sy, sy = 0; \
if (sw > ((width) - sx)) \
sw = ((width) - sx); \
if (sh > ((height) - sy)) \
sh = ((height) - sy);
#endif #endif

View File

@ -30,6 +30,7 @@
#include "gb_common.h" #include "gb_common.h"
#include "CDraw.h" #include "CDraw.h"
#include "cpaint.h"
#include "main.h" #include "main.h"

2
reconf
View File

@ -3,6 +3,6 @@
rm -f config.cache rm -f config.cache
rm -f acconfig.cache rm -f acconfig.cache
libtoolize --force --copy --install libtoolize --force --copy
autoreconf -v $@ autoreconf -v $@