[GB.GUI.BASE]

* BUG: Draw.FillStyle has been implemented.

[GB.QT4]
* BUG: Paint.Image() works correctly with temporary images now.


git-svn-id: svn://localhost/gambas/trunk@5582 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2013-03-18 00:48:55 +00:00
parent 09c28801f7
commit 9f696c8352
30 changed files with 153 additions and 210 deletions

View File

@ -1,9 +1,9 @@
54 Maurizio Da Lio
37 GNU/Linex
33 Radoslav Dejanovic
20 Ricardo Díaz Martin
18 Kari Laine
16 DistroWatch.com
16 Ricardo Díaz Martin
15 Yvick Miossec
15 Christian Henri Fischer
12 Leo Barnhoorn

View File

@ -211,6 +211,10 @@ FillY
P
i
Image
M
(Image)Image;(X)i(Y)i[(Width)i(Height)i(SrcX)i(SrcY)i(SrcWidth)i(SrcHeight)i]
_GetInfo
M
DrawInfo
@ -307,10 +311,6 @@ Zoom
M
(Image)Image;(Zoom)i(X)i(Y)i[(SrcX)i(SrcY)i(SrcWidth)i(SrcHeight)i]
Image
M
(Image)Image;(X)i(Y)i[(Width)i(Height)i(SrcX)i(SrcY)i(SrcWidth)i(SrcHeight)i]
Picture
M
@ -319,6 +319,69 @@ Tile
M
(Picture)Picture;(X)i(Y)i(W)i(H)i
#Fill
C
None
C
i
0
Solid
C
i
1
Dense94
C
i
2
Dense88
C
i
3
Dense63
C
i
4
Dense50
C
i
5
Dense37
C
i
6
Dense12
C
i
7
Dense6
C
i
8
Horizontal
C
i
9
Vertical
C
i
10
Cross
C
i
11
Diagonal
C
i
12
BackDiagonal
C
i
13
CrossDiagonal
C
i
14
#GridView
UserControl
C
@ -1036,6 +1099,33 @@ _End
m
#Line
C
None
C
i
0
Solid
C
i
1
Dash
C
i
2
Dot
C
i
3
DashDot
C
i
4
DashDotDot
C
i
5
#ListBox
UserControl
C

View File

@ -1,9 +1,11 @@
Action
ColumnView
Draw
Fill
GridView
HSplit
IconView
Line
ListBox
ListView
ScrollArea

View File

@ -1,8 +1,7 @@
# Gambas Project File 3.0
# Compiled with Gambas 3.4.0
Title=gb.gui.base
Startup=FIconView
Profiling=1
Startup=FScrollArea
Version=3.4.0
VersionFile=1
Component=gb.image

View File

@ -44,6 +44,8 @@ End Struct
Private Enum DRAW_CIRCLE, DRAW_ELLIPSE, DRAW_ARC
Private $hPattern As New Image[15]
Public Sub _GetInfo() As DrawInfo
Dim hInfo As DrawInfo = Paint._Tag
@ -345,13 +347,40 @@ Public Sub Line(X1 As Integer, Y1 As Integer, X2 As Integer, Y2 As Integer)
End
Private Sub HasFillStyle(hInfo As DrawInfo) As Boolean
Dim hImage As Image
Select Case hInfo.FillStyle
Case Fill.None
Return False
Case Fill.Solid
Paint.Background = hInfo.FillColor
Case Fill.Dense94 To Fill.CrossDiagonal
If IsNull($hPattern[hInfo.FillStyle]) Then $hPattern[hInfo.FillStyle] = Image.Load("pattern/" & hInfo.FillStyle & ".png")
hImage = $hPattern[hInfo.FillStyle].Copy()
If hInfo.Transparent Then hImage.Replace(Color.White, Color.Transparent)
hImage.Replace(Color.Black, hInfo.FillColor)
Paint.Brush = Paint.Image(hImage)
Default
Return
End Select
Return True
End
Public Sub Rect(X As Integer, Y As Integer, Width As Integer, Height As Integer)
Dim hInfo As DrawInfo = _GetInfo()
Dim iBg As Integer
If hInfo.FillStyle Then
Paint.Background = hInfo.FillColor
If HasFillStyle(hInfo) Then
Paint.Rectangle(X, Y, Width, Height)
Paint.Fill
Endif
@ -438,9 +467,7 @@ Private Sub DrawEllipse(iAction As Integer, X As Float, Y As Float, W As Float,
Paint.Ellipse(X, Y, W, H, Start, {End} - Start, True)
Endif
If hInfo.FillStyle And If iAction <> DRAW_ARC Then
Paint.Background = hInfo.FillColor
If iAction <> DRAW_ARC And If HasFillStyle(hInfo) Then
Paint.Fill(hInfo.LineStyle)
Endif
@ -556,9 +583,8 @@ Public Sub Polygon(Points As Integer[])
fOffset = GetStrokeOffset()
If hInfo.FillStyle Then
If HasFillStyle(hInfo) Then
Paint.Background = hInfo.FillColor
Paint.Fill(hInfo.LineStyle <> Line.None)
Endif

View File

@ -0,0 +1,5 @@
' Gambas class file
Export
Public Enum None, Solid, Dense94, Dense88, Dense63, Dense50, Dense37, Dense12, Dense6, Horizontal, Vertical, Cross, Diagonal, BackDiagonal, CrossDiagonal

View File

@ -0,0 +1,5 @@
' Gambas class file
Export
Public Enum None, Solid, Dash, Dot, DashDot, DashDotDot

View File

@ -1,18 +0,0 @@
' Gambas class file
Public Sub _new()
End
Public Sub Form_Open()
Me.Center
End
Public Sub Button1_Click()
Me.Close()
End

View File

@ -1,78 +0,0 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,116,104)
Background = &HECECEC&
Arrangement = Arrange.Vertical
Spacing = True
Margin = True
Padding = 8
{ VSplit1 VSplit
MoveScaled(3,4,110,92)
Expand = True
{ Panel1 Panel
MoveScaled(2,3,105,24)
Arrangement = Arrange.Fill
Margin = True
Padding = 4
Border = Border.Plain
{ Panel6 Panel
MoveScaled(2,3,100,19)
Background = &HBBCCCC&
Border = Border.Raised
}
}
{ VSplit2 VSplit
MoveScaled(2,29,105,59)
Expand = True
{ Panel2 Panel
MoveScaled(5,3,97,27)
Expand = True
Arrangement = Arrange.Horizontal
Spacing = True
Margin = True
Padding = 4
Border = Border.Plain
{ TextArea1 TextArea
MoveScaled(1,2,39,22)
Expand = True
Text = ("TextArea1")
}
{ TextArea2 TextArea
MoveScaled(55,1,41,25)
Expand = True
Text = ("TextArea2")
}
}
{ Panel3 Panel
MoveScaled(4,33,98,21)
Arrangement = Arrange.Vertical
Spacing = True
Margin = True
Padding = 4
Border = Border.Plain
{ TextArea3 TextArea
MoveScaled(2,2,94,9)
Text = ("TextArea3")
}
{ TextArea4 TextArea
MoveScaled(2,12,92,7)
Expand = True
Text = ("TextArea4")
}
}
}
}
{ Panel4 Panel
MoveScaled(3,98,111,5)
Arrangement = Arrange.Horizontal
{ Panel5 Panel
MoveScaled(11,0,7,5)
Expand = True
}
{ Button1 Button
MoveScaled(94,0,12,5)
Text = ("Quitter")
}
}
}

View File

@ -11,20 +11,11 @@ End
Public Sub ScrollArea1_Draw()
Dim X, Y As Integer
Draw.FillRect(Draw.Clip.X, Draw.Clip.Y, Draw.Clip.W, Draw.Clip.H, Color.TextBackground)
Draw.Translate(- ScrollArea1.ScrollX, - ScrollArea1.ScrollY)
Draw.Font.Bold = True
Draw.Font.Grade = 3
For X = 0 To 3
For Y = 0 To 6
Draw.Text("Coucou", X * 80 + 10, Y * 24 + 10)
Next
Next
Draw.LineStyle = Line.Solid
Draw.Foreground = Color.Black
Draw.Rect(0, 0, 300, 300)
Draw.Rect(1, 1, 298, 298)
Draw.Fillstyle = Fill.Dense6
Draw.FillColor = Color.Red
'Draw.Transparent = True
Draw.Ellipse(55, 78, 190, 300)
Draw.Ellipse(78, 55, 300, 190)
End

View File

@ -2,10 +2,10 @@
{ Form Form
MoveScaled(0,0,56,53)
Arrangement = Arrange.Vertical
Arrangement = Arrange.Fill
Margin = True
{ ScrollArea1 ScrollArea
MoveScaled(4,2,35,30)
MoveScaled(4,3,35,30)
Mouse = Mouse.Pointing
Border = False
}

View File

@ -1,4 +1,4 @@
FIconView
FScrollArea
gb.gui.base
0
0

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

View File

@ -119,45 +119,6 @@ GB_DESC CScrollDesc[] =
};
GB_DESC CLineDesc[] =
{
GB_DECLARE("Line", 0), GB_VIRTUAL_CLASS(),
GB_CONSTANT("None", "i", LINE_NONE),
GB_CONSTANT("Solid", "i", LINE_SOLID),
GB_CONSTANT("Dash", "i", LINE_DASH),
GB_CONSTANT("Dot", "i", LINE_DOT),
GB_CONSTANT("DashDot", "i", LINE_DASH_DOT),
GB_CONSTANT("DashDotDot", "i", LINE_DASH_DOT_DOT),
GB_END_DECLARE
};
GB_DESC CFillDesc[] =
{
GB_DECLARE("Fill", 0), GB_VIRTUAL_CLASS(),
GB_CONSTANT("None", "i", FILL_NONE),
GB_CONSTANT("Solid", "i", FILL_SOLID),
GB_CONSTANT("Dense94", "i", FILL_DENSE_94),
GB_CONSTANT("Dense88", "i", FILL_DENSE_88),
GB_CONSTANT("Dense63", "i", FILL_DENSE_63),
GB_CONSTANT("Dense50", "i", FILL_DENSE_50),
GB_CONSTANT("Dense37", "i", FILL_DENSE_37),
GB_CONSTANT("Dense12", "i", FILL_DENSE_12),
GB_CONSTANT("Dense6", "i", FILL_DENSE_06),
GB_CONSTANT("Horizontal", "i", FILL_HORIZONTAL),
GB_CONSTANT("Vertical", "i", FILL_VERTICAL),
GB_CONSTANT("Cross", "i", FILL_CROSS),
GB_CONSTANT("Diagonal", "i", FILL_DIAGONAL),
GB_CONSTANT("BackDiagonal", "i", FILL_BACK_DIAGONAL),
GB_CONSTANT("CrossDiagonal", "i", FILL_CROSS_DIAGONAL),
GB_END_DECLARE
};
GB_DESC CSelectDesc[] =
{
GB_DECLARE("Select", 0), GB_VIRTUAL_CLASS(),

View File

@ -119,8 +119,6 @@ extern "C"
CArrangeDesc,
CBorderDesc,
CScrollDesc,
CLineDesc,
CFillDesc,
CColorDesc,
CFontsDesc,
CFontDesc,

View File

@ -236,45 +236,6 @@ GB_DESC CScrollDesc[] =
};
GB_DESC CLineDesc[] =
{
GB_DECLARE("Line", 0), GB_VIRTUAL_CLASS(),
GB_CONSTANT("None", "i", LINE_NONE),
GB_CONSTANT("Solid", "i", LINE_SOLID),
GB_CONSTANT("Dash", "i", LINE_DASH),
GB_CONSTANT("Dot", "i", LINE_DOT),
GB_CONSTANT("DashDot", "i", LINE_DASH_DOT),
GB_CONSTANT("DashDotDot", "i", LINE_DASH_DOT_DOT),
GB_END_DECLARE
};
GB_DESC CFillDesc[] =
{
GB_DECLARE("Fill", 0), GB_VIRTUAL_CLASS(),
GB_CONSTANT("None", "i", FILL_NONE),
GB_CONSTANT("Solid", "i", FILL_SOLID),
GB_CONSTANT("Dense94", "i", FILL_DENSE_94),
GB_CONSTANT("Dense88", "i", FILL_DENSE_88),
GB_CONSTANT("Dense63", "i", FILL_DENSE_63),
GB_CONSTANT("Dense50", "i", FILL_DENSE_50),
GB_CONSTANT("Dense37", "i", FILL_DENSE_37),
GB_CONSTANT("Dense12", "i", FILL_DENSE_12),
GB_CONSTANT("Dense6", "i", FILL_DENSE_06),
GB_CONSTANT("Horizontal", "i", FILL_HORIZONTAL),
GB_CONSTANT("Vertical", "i", FILL_VERTICAL),
GB_CONSTANT("Cross", "i", FILL_CROSS),
GB_CONSTANT("Diagonal", "i", FILL_DIAGONAL),
GB_CONSTANT("BackDiagonal", "i", FILL_BACK_DIAGONAL),
GB_CONSTANT("CrossDiagonal", "i", FILL_CROSS_DIAGONAL),
GB_END_DECLARE
};
GB_DESC CSelectDesc[] =
{
GB_DECLARE("Select", 0), GB_VIRTUAL_CLASS(),

View File

@ -1120,9 +1120,10 @@ static void BrushColor(GB_BRUSH *brush, GB_COLOR color)
static void BrushImage(GB_BRUSH *brush, GB_IMAGE image)
{
QImage *img = CIMAGE_get((CIMAGE *)image);
QImage img(*CIMAGE_get((CIMAGE *)image));
QBrush *br = new QBrush(*img);
img.detach();
QBrush *br = new QBrush(img);
*brush = (GB_BRUSH)br;
}

View File

@ -998,7 +998,7 @@ extern "C" {
GB_DESC *GB_CLASSES[] EXPORT =
{
CBorderDesc, CColorDesc,
CAlignDesc, CArrangeDesc, CScrollDesc, CKeyDesc, CLineDesc, CFillDesc, CSelectDesc,
CAlignDesc, CArrangeDesc, CScrollDesc, CKeyDesc, CSelectDesc,
CMessageDesc,
CImageDesc, CPictureDesc,
CFontDesc, CFontsDesc,