diff --git a/examples/examples/Image/PhotoTouch/.info b/examples/examples/Image/PhotoTouch/.info index 4ec779cb0..1610227dd 100644 --- a/examples/examples/Image/PhotoTouch/.info +++ b/examples/examples/Image/PhotoTouch/.info @@ -9,6 +9,14 @@ Image p Image +Opacity +p +f + +Highlight +p +b + _new m @@ -29,10 +37,6 @@ DrawingArea_DblClick m -Timer_Timer -m - - DrawingArea_Draw m diff --git a/examples/examples/Image/PhotoTouch/.lang/fr.mo b/examples/examples/Image/PhotoTouch/.lang/fr.mo index 28b19914d..dc411a685 100644 Binary files a/examples/examples/Image/PhotoTouch/.lang/fr.mo and b/examples/examples/Image/PhotoTouch/.lang/fr.mo differ diff --git a/examples/examples/Image/PhotoTouch/.lang/fr.po b/examples/examples/Image/PhotoTouch/.lang/fr.po index 1047b28bc..749746065 100644 --- a/examples/examples/Image/PhotoTouch/.lang/fr.po +++ b/examples/examples/Image/PhotoTouch/.lang/fr.po @@ -6,19 +6,108 @@ msgstr "" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: FBrightness.form:55 +#: FMain.class:107 +msgid "Automatic correction" +msgstr "Correction automatique" + +#: FBrightness.form:56 FMain.class:107 msgid "Balance" msgstr "Balance" +#: FMain.class:107 +msgid "Blur" +msgstr "Flou" + +#: FMain.class:107 +msgid "Crop image" +msgstr "Découper l'image" + #: FScissors.form:19 msgid "Cut" msgstr "Découper" -#: .project:1 -msgid "Retouche Photo" -msgstr "" +#: FMain.class:107 +msgid "Fit to window" +msgstr "Zoom à la taille de l'écran" + +#: FMain.class:107 +msgid "Flip horizontally" +msgstr "Retourner horizontalement" + +#: FMain.class:107 +msgid "Flip vertically" +msgstr "Retourner verticalement" + +#: FMain.class:107 +msgid "Invert" +msgstr "Inverser" + +#: FMain.class:55 +msgid "No image in directory" +msgstr "Aucune image dans ce répertoire" + +#: FMain.class:107 +msgid "Normalize" +msgstr "Normaliser" + +#: FMain.class:107 +msgid "Oil painting effect" +msgstr "Effet de peinture à l'huile" + +#: FMain.class:107 +msgid "Quit" +msgstr "Quitter" + +#: FMain.class:107 +msgid "Remove speckles" +msgstr "Enlever les tâches" + +#: FMain.class:107 FResize.form:40 +msgid "Resize" +msgstr "Redimensionner" + +#: FMain.class:107 +msgid "Rotate left" +msgstr "Rotation vers la gauche" + +#: FMain.class:107 +msgid "Rotate right" +msgstr "Rotation vers la droite" + +#: FMain.class:107 +msgid "Select photo directory" +msgstr "Choisir le répertoire des photographies" + +#: FMain.class:107 +msgid "Sharpen" +msgstr "Netteté" + +#: .project:1 +msgid "Simple Photo Editor" +msgstr "Editeur de photographie simplifié" + +#: FMain.class:58 +msgid "Unable to load image" +msgstr "Impossible de charger l'image" + +#: FMain.class:107 +msgid "Undo all changes" +msgstr "Annuler tous les changements" + +#: FMain.class:107 +msgid "Zoom 100%" +msgstr "Zoom 100%" + +#: FMain.class:107 +msgid "Zoom in" +msgstr "Zoom avant" + +#: FMain.class:107 +msgid "Zoom out" +msgstr "Zoom arrière" diff --git a/examples/examples/Image/PhotoTouch/.project b/examples/examples/Image/PhotoTouch/.project index 6e320d717..c166b2167 100644 --- a/examples/examples/Image/PhotoTouch/.project +++ b/examples/examples/Image/PhotoTouch/.project @@ -9,6 +9,7 @@ Component=gb.image Component=gb.qt4 Component=gb.form Component=gb.desktop +Component=gb.settings Component=gb.image.effect Authors="Benoît Minisini" TabSize=2 diff --git a/examples/examples/Image/PhotoTouch/.src/CAnimation.class b/examples/examples/Image/PhotoTouch/.src/CAnimation.class new file mode 100644 index 000000000..8a25f7d8e --- /dev/null +++ b/examples/examples/Image/PhotoTouch/.src/CAnimation.class @@ -0,0 +1,48 @@ +' Gambas class file + +Private $hObject As Object +Private $sProperty As String +Private $fTarget As Float +Private $fTime As Float +Private $hTimer As Timer + +Public Sub _new(hObject As Control, sProperty As String, fTarget As Float, iTime As Integer) + + $hObject = hObject + $sProperty = sProperty + $fTarget = fTarget + $fTime = Timer + iTime / 1000 + + $hTimer = New Timer As "Timer" + $hTimer.Delay = 50 + $hTimer.Start + +End + +Public Sub Timer_Timer() + + Dim fValue As Float + Dim iSign As Integer + + fValue = Object.GetProperty($hObject, $sProperty) + + iSign = Sgn($fTarget - fValue) + fValue += ($fTarget - fValue) / (1000 * ($fTime - Timer) / $hTimer.Delay) + If Sgn($fTarget - fValue) <> iSign Then + Object.SetProperty($hObject, $sProperty, $fTarget) + {Stop} + Else + Object.SetProperty($hObject, $sProperty, fValue) + Endif + +Catch + + {Stop} + +End + +Public Sub Stop() + + $hTimer = Null + +End diff --git a/examples/examples/Image/PhotoTouch/.src/CButton.class b/examples/examples/Image/PhotoTouch/.src/CButton.class index 7ed62f1b8..4b2c4a765 100644 --- a/examples/examples/Image/PhotoTouch/.src/CButton.class +++ b/examples/examples/Image/PhotoTouch/.src/CButton.class @@ -7,22 +7,26 @@ Inherits DrawingArea Event Click Property Image As Image +Property Opacity As Float +Property Highlight As Boolean -Private Const MIN_OPACITY As Float = 0.3 -Private Const MAX_OPACITY As Float = 0.8 +Private MIN_OPACITY As Float = 0.2 +Private MAX_OPACITY As Float = 0.8 Private $hObs As Observer Private $hImage As Image Private $hDraw As Image Private $bInside As Boolean -Private $hTimer As Timer +'Private $hTimer As Timer +Private $hAnim As CAnimation Private $fOpacity As Float = MIN_OPACITY +Private $bHighlight As Boolean Public Sub _new() $hObs = New Observer(Me) As "DrawingArea" - $hTimer = New Timer As "Timer" - $hTimer.Delay = 50 + '$hTimer = New Timer As "Timer" + '$hTimer.Delay = 50 Me.Mouse = Mouse.Pointing End @@ -30,14 +34,16 @@ End Public Sub DrawingArea_Enter() $bInside = True - $hTimer.Start + Try $hAnim.Stop + $hAnim = New CAnimation(Me, "Opacity", MAX_OPACITY, 250) End Public Sub DrawingArea_Leave() $bInside = False - $hTimer.Start + Try $hAnim.Stop + $hAnim = New CAnimation(Me, "Opacity", MIN_OPACITY, 250) End @@ -54,30 +60,37 @@ Public Sub DrawingArea_DblClick() End -Public Sub Timer_Timer() - - If $bInside Then - $fOpacity = Min(MAX_OPACITY, $fOpacity + 0.1) - If $fOpacity >= MAX_OPACITY Then - $hTimer.Stop - Endif - Else - $fOpacity = Max(MIN_OPACITY, $fOpacity - 0.1) - If $fOpacity <= MIN_OPACITY Then - $hTimer.Stop - Endif - Endif - - SetOpacity - -End +' Public Sub Timer_Timer() +' +' If $bInside Then +' $fOpacity = Min(MAX_OPACITY, $fOpacity + 0.1) +' If $fOpacity >= MAX_OPACITY Then +' $hTimer.Stop +' Endif +' Else +' $fOpacity = Max(MIN_OPACITY, $fOpacity - 0.1) +' If $fOpacity <= MIN_OPACITY Then +' $hTimer.Stop +' Endif +' Endif +' +' SetOpacity +' +' End Public Sub DrawingArea_Draw() If Not $hImage Then Return - Draw.Image($hDraw, 0, 0, Me.W, Me.H) + Draw.Image($hDraw, 4, 4) + If $bHighlight Then + Paint.Begin(Me) + Paint.Brush = Paint.Color(Color.SetAlpha(Color.White, 192)) + Paint.Rectangle(0, 0, Me.W, Me.H) + Paint.Fill + Paint.End + Endif End @@ -89,7 +102,7 @@ End Private Sub Image_Write(Value As Image) - $hImage = Value + $hImage = Value.Stretch(Me.W - 8, Me.H - 8) SetOpacity End @@ -101,3 +114,34 @@ Private Sub SetOpacity() Me.Refresh End + +Private Function Opacity_Read() As Float + + Return $fOpacity + +End + +Private Sub Opacity_Write(Value As Float) + + $fOpacity = Max(0, Min(1, Value)) + SetOpacity + +End + +Private Function Highlight_Read() As Boolean + + Return $bHighlight + +End + +Private Sub Highlight_Write(Value As Boolean) + + $bHighlight = Value + 'MIN_OPACITY = If($bHighlight, 0.6, 0.2) + 'If Not $bInside Then + ' Try $hAnim.Stop + ' $hAnim = New CAnimation(Me, "Opacity", MIN_OPACITY, 250) + 'Endif + Me.Refresh + +End diff --git a/examples/examples/Image/PhotoTouch/.src/FBrightness.class b/examples/examples/Image/PhotoTouch/.src/FBrightness.class index 4a9eb368f..0bf6837ba 100644 --- a/examples/examples/Image/PhotoTouch/.src/FBrightness.class +++ b/examples/examples/Image/PhotoTouch/.src/FBrightness.class @@ -12,11 +12,11 @@ Private btnApply As CButton Public Sub _new() btnUndo = New CButton(Me) As "btnUndo" - btnUndo.Move(Me.W - 128 - Desktop.Scale * 3, Desktop.Scale * 3, 64, 64) + btnUndo.Move(Me.W - 96 - Desktop.Scale * 4, Desktop.Scale * 3, 48, 48) btnUndo.Image = Image.Load("undo.png") btnApply = New CButton(Me) As "btnApply" - btnApply.Move(btnUndo.X + btnUndo.W + Desktop.Scale, btnUndo.Y, 64, 64) + btnApply.Move(btnUndo.X + btnUndo.W + Desktop.Scale, btnUndo.Y, 48, 48) btnApply.Image = Image.Load("ok.png") End @@ -29,12 +29,6 @@ Public Sub Form_Open() End -Public Sub Form_Close() - - FMain.End - -End - Public Sub btnUndo_Click() $bNoChange = True @@ -49,7 +43,6 @@ End Public Sub btnApply_Click() FMain.Apply - Me.Close End diff --git a/examples/examples/Image/PhotoTouch/.src/FBrightness.form b/examples/examples/Image/PhotoTouch/.src/FBrightness.form index 5b9072a3a..a6e01e08e 100644 --- a/examples/examples/Image/PhotoTouch/.src/FBrightness.form +++ b/examples/examples/Image/PhotoTouch/.src/FBrightness.form @@ -11,25 +11,25 @@ MoveScaled(1,1,72,46) Background = &H000000& { PictureBox1 PictureBox - MoveScaled(2,10,10,10) + MoveScaled(2,11,8,8) Picture = Picture["luminosity.png"] Stretch = True Alignment = Align.Center } { PictureBox2 PictureBox - MoveScaled(2,22,10,10) + MoveScaled(2,23,8,8) Picture = Picture["contrast.png"] Stretch = True Alignment = Align.Center } { sldBrightness Slider Balance Name = "sldBrightness" - MoveScaled(15,13,53,3) + MoveScaled(13,13,55,3) Value = 50 } { sldContrast Slider Balance Name = "sldContrast" - MoveScaled(15,25,53,3) + MoveScaled(13,25,55,3) Value = 50 } { Label1 Label @@ -40,14 +40,14 @@ Text = ("Balance") } { PictureBox3 PictureBox - MoveScaled(2,34,10,10) + MoveScaled(2,35,8,8) Picture = Picture["gamma.png"] Stretch = True Alignment = Align.Center } { sldGamma Slider Balance Name = "sldGamma" - MoveScaled(15,37,53,3) + MoveScaled(13,37,55,3) Value = 50 } } diff --git a/examples/examples/Image/PhotoTouch/.src/FMain.class b/examples/examples/Image/PhotoTouch/.src/FMain.class index 8b922a7bd..b1f751857 100644 --- a/examples/examples/Image/PhotoTouch/.src/FMain.class +++ b/examples/examples/Image/PhotoTouch/.src/FMain.class @@ -1,6 +1,7 @@ ' Gambas class file -Private CACHE_DIR As String = "~/.cache/gambas/PhotoTouch" +Private CACHE_ROOT As String = "~/.cache/gambas/PhotoTouch" +Private CACHE_DIR As String Private $aPath As String[] Private $sPath As String @@ -13,6 +14,7 @@ Private $fZoom As Float = 1 Private $sInfo As String Private $sMode As String Private $bModify As Boolean +Private $cButton As New Collection Private $MX As Integer Private $MY As Integer @@ -73,26 +75,52 @@ Public Sub _new() Dim sImg As String Dim hButton As CButton Dim hPanel As Panel + Dim cTooltip As Collection Application.MainWindow = Me - Try Mkdir File.Dir(File.Dir(cache_dir)) - Try Mkdir File.Dir(cache_dir) - Try Mkdir CACHE_DIR + Try Mkdir File.Dir(File.Dir(CACHE_ROOT)) + Try Mkdir File.Dir(CACHE_ROOT) + Try Mkdir CACHE_ROOT - For Each sImg In ["usb", "-", "zoom-in", "zoom-out", "zoom-original", "zoom-fit", "-", "rotate-left", "rotate-right", "-", "scissors", "luminosity", "<->", "undo", "quit"] + cTooltip = [ + "usb": ("Select photo directory"), + "zoom-in": ("Zoom in"), + "zoom-out": ("Zoom out"), + "zoom-original": ("Zoom 100%"), + "zoom-fit": ("Fit to window"), + "hflip": ("Flip horizontally"), + "vflip": ("Flip vertically"), + "rotate-left": ("Rotate left"), + "rotate-right": ("Rotate right"), + "magic": ("Automatic correction"), + "invert": ("Invert"), + "blur": ("Blur"), + "sharpen": ("Sharpen"), + "normalize": ("Normalize"), + "despeckle": ("Remove speckles"), + "oil": ("Oil painting effect"), + "scissors": ("Crop image"), + "balance": ("Balance"), + "resize": ("Resize"), + "undo": ("Undo all changes"), + "quit": ("Quit")] + + For Each sImg In ["usb", "-", "zoom-in", "zoom-out", "zoom-original", "zoom-fit", "-", "hflip", "vflip", "rotate-left", "rotate-right", "-", "magic", "invert", "blur", "sharpen", "normalize", "despeckle", "oil", "-", "scissors", "resize", "balance", "<->", "undo", "quit"] If sImg = "<->" Then hPanel = New Panel(panToolbar) hPanel.Expand = True - hPanel.Resize(8, 64) + hPanel.Resize(8, 48) Else If sImg = "-" Then hPanel = New Panel(panToolbar) - hPanel.Resize(16, 64) + hPanel.Resize(8, 48) Else hButton = New CButton(panToolbar) As "Button" - hButton.Resize(64, 64) + hButton.Resize(48, 48) hButton.Image = Image.Load(sImg & ".png") hButton.Tag = sImg + hButton.Tooltip = cTooltip[sImg] + $cButton[hButton.Tag] = hButton Endif Next @@ -111,12 +139,6 @@ Public Sub _new() End -Public Sub Form_Open() - - SetDir(User.Home) - -End - Public Sub svwImage_Draw() Dim X As Integer @@ -204,7 +226,7 @@ End Public Sub Form_Resize() - panToolbar.Move(0, 0, Me.W, 64 + Desktop.Scale * 2) + panToolbar.Move(0, 0, Me.W, 48 + Desktop.Scale * 2) dwgInfo.Move(8, Me.H - dwgInfo.H, Me.W, dwgInfo.H) btnPrev.Move(8, (Me.H - btnPrev.H) / 2) btnNext.Move(Me.W - 8 - btnNext.W, (Me.H - btnNext.H) / 2) @@ -235,6 +257,7 @@ Private Sub UpdateZoom() svwImage.ResizeContents($hImage.W * $fZoom, $hImage.H * $fZoom) svwImage.Scroll(X * svwImage.ScrollW - svwImage.ClientW / 2, Y * svwImage.ScrollH - svwImage.ClientH / 2) + dwgInfo.Refresh Me.Refresh End @@ -263,9 +286,16 @@ End Public Sub SetMode(sMode As String) If $sMode Then + $cButton[$sMode].Highlight = False Cancel - FBrightness.Close - FScissors.Close + Select Case $sMode + Case "balance" + FBrightness.Close + Case "scissors" + FScissors.Close + Case "resize" + FResize.Close + End Select Endif If sMode = $sMode Then @@ -273,12 +303,20 @@ Public Sub SetMode(sMode As String) Return Endif - Select Case sMode - Case "luminosity" - FBrightness.Show - Case "scissors" - FScissors.Show - End Select + If sMode Then + + $cButton[sMode].Highlight = True + + Select Case sMode + Case "balance" + FBrightness.Show + Case "scissors" + FScissors.Show + Case "resize" + FResize.Show + End Select + + Endif $sMode = sMode @@ -311,27 +349,13 @@ Private Sub Action(sAction As String) Case "zoom-fit" SetZoom(0) - Case "rotate-left" - If Not $hImage Then Return - $hImage = $hImage.Rotate(Pi(0.5)) - $bModify = True - 'SaveImage - UpdateZoom - - Case "rotate-right" - If Not $hImage Then Return - $hImage = $hImage.Rotate(Pi(-0.5)) - $bModify = True - 'SaveImage - UpdateZoom - Case "quit" SetMode("") SaveImage - If Dir(CACHE_DIR).Count Then Desktop.Open(CACHE_DIR) + If Exist(CACHE_DIR) Then Desktop.Open(CACHE_DIR) Me.Close - Case "luminosity", "scissors" + Case "balance", "scissors", "resize" If Not $hImage Then Return SetMode(sAction) @@ -345,6 +369,43 @@ Private Sub Action(sAction As String) LoadImage(True) RemoveImage + Case Else + + If Not $hImage Then Return + + SetMode("") + + Select Case sAction + Case "hflip" + $hImage.Mirror(True, False) + Case "vflip" + $hImage.Mirror(False, True) + Case "rotate-left" + $hImage = $hImage.Rotate(Pi(0.5)) + Case "rotate-right" + $hImage = $hImage.Rotate(Pi(-0.5)) + Case "oil" + $hImage = ImageMagick("-paint 4") '$hImage.OilPaint() + Case "magic" + $hImage = ImageMagick("-auto-gamma -auto-level") + Case "invert" + $hImage.Invert() + 'Case "equalize" + ' $hImage = ImageMagick("-equalize") + Case "despeckle" + $hImage = ImageMagick("-despeckle") + Case "normalize" + $hImage = ImageMagick("-normalize") + Case "blur" + $hImage = ImageMagick("-blur 8") '$hImage.OilPaint() + Case "sharpen" + $hImage = ImageMagick("-sharpen 8") '$hImage.OilPaint() + + End Select + + $bModify = True + UpdateZoom + End Select End @@ -381,7 +442,7 @@ Public Sub dwgInfo_Draw() ' Paint.Fill Paint.LineWidth = 1 Paint.Brush = Paint.Color(Color.SetAlpha(Color.White, 192)) - Paint.DrawText($sInfo, 0, 0, dwgInfo.W, dwgInfo.H, Align.Left) + Paint.DrawText($sInfo & " - " & Format($fZoom, "0%"), 0, 0, dwgInfo.W, dwgInfo.H, Align.Left) End @@ -415,6 +476,7 @@ End Public Sub Apply() $hTemp = $hImage + {End} End @@ -469,13 +531,34 @@ Public Sub Cut() End +Public Sub Stretch(W As Integer, H As Integer) + + $hImage = $hImage.Stretch(W, H) + $bModify = True + $hTemp = $hImage + Me.End + SetZoom(0) + +End + + +Public Sub Form_Activate() + + If $sDir = "" Then SetDir(Settings["Directory", User.Home]) + +End + + Private Sub SetDir(sDir As String) Inc Application.Busy - Shell "cd " & Shell(CACHE_DIR) & "; rm -f *" Wait + 'Shell "cd " & Shell(CACHE_DIR) & "; rm -f *" Wait + + CACHE_DIR = CACHE_ROOT &/ Replace(sDir, "/", ":") $sDir = sDir + Settings["Directory"] = $sDir $aPath = New String[] Try $aPath = Dir(sDir, "*.{jpg,JPG,jpeg,JPEG,png,PNG,bmp,BMP,gig,GIF}").Sort() $iIndex = 0 @@ -485,13 +568,15 @@ Private Sub SetDir(sDir As String) End -Private Sub SaveImage() +Private Sub SaveImage() As String If Not $hImage Then Return If Not $bModify Then Return - $hImage.Save(CACHE_DIR &/ File.Name($sPath)) + Try Mkdir CACHE_DIR + $hImage.Save(CACHE_DIR &/ File.Name($sPath), 80) $bModify = False + Return CACHE_DIR &/ File.Name($sPath) Catch @@ -501,6 +586,32 @@ End Private Sub RemoveImage() - Try Kill CACHE_DIR &/ File.Name($sPath) + Kill CACHE_DIR &/ File.Name($sPath) + If Dir(CACHE_DIR).Count = 0 Then Rmdir CACHE_DIR + +Catch + +End + +Private Sub ImageMagick(sCommand As String) As Image + + Dim sPath, sPath2 As String + Dim hImage As Image + + Inc Application.Busy + + sPath = File.SetExt(Temp$("image"), File.Ext($sPath)) + sPath2 = File.SetExt(Temp$("image2"), File.Ext($sPath)) + + $hImage.Save(sPath, 100) + + Shell "convert " & Shell(sPath) & " " & sCommand & " " & Shell(sPath2) Wait + hImage = Image.Load(sPath2) + Kill sPath + Kill sPath2 + + Dec Application.Busy + + Return hImage End diff --git a/examples/examples/Image/PhotoTouch/.src/FMain.form b/examples/examples/Image/PhotoTouch/.src/FMain.form index 908d8a00a..3d64d17cd 100644 --- a/examples/examples/Image/PhotoTouch/.src/FMain.form +++ b/examples/examples/Image/PhotoTouch/.src/FMain.form @@ -2,6 +2,7 @@ { Form Form MoveScaled(0,0,82,72) + Icon = Picture["icon.png"] Border = False Maximized = True Arrangement = Arrange.Fill diff --git a/examples/examples/Image/PhotoTouch/.src/FResize.class b/examples/examples/Image/PhotoTouch/.src/FResize.class new file mode 100644 index 000000000..d286e9102 --- /dev/null +++ b/examples/examples/Image/PhotoTouch/.src/FResize.class @@ -0,0 +1,44 @@ +' Gambas class file + +Private $aSize As Float[] = [1 / 4, 1 / 3, 1 / 2, 2 / 3, 3 / 4, 1] +Private btnApply As CButton + +Public Sub sldResize_Change() + + Dim W, H As Integer + + With FMain.GetImage() + W = .W * $aSize[sldResize.Value] + H = .H * $aSize[sldResize.Value] + End With + lblSize.Text = Format($aSize[sldResize.Value], "0%") & " - " & W & " x " & H + +End + +Public Sub _new() + + btnApply = New CButton(Me) As "btnApply" + btnApply.Move(Me.W - 48 - Desktop.Scale * 2, Desktop.Scale * 2, 48, 48) + btnApply.Image = Image.Load("ok.png") + +End + +Public Sub Form_Open() + + Me.Center + sldResize_Change + +End + +Public Sub btnApply_Click() + + Dim W, H As Integer + + With FMain.GetImage() + W = .W * $aSize[sldResize.Value] + H = .H * $aSize[sldResize.Value] + End With + + FMain.Stretch(W, H) + +End diff --git a/examples/examples/Image/PhotoTouch/.src/FResize.form b/examples/examples/Image/PhotoTouch/.src/FResize.form new file mode 100644 index 000000000..ebb55f266 --- /dev/null +++ b/examples/examples/Image/PhotoTouch/.src/FResize.form @@ -0,0 +1,38 @@ +# Gambas Form File 3.0 + +{ Form Form + MoveScaled(0,0,55,24) + Background = &HFFFFFF& + Border = False + Stacking = Window.Above + SkipTaskbar = True + Opacity = 50 + { panBrightness Panel + MoveScaled(1,1,53,22) + Background = &H000000& + { PictureBox1 PictureBox + MoveScaled(2,11,8,8) + Picture = Picture["resize.png"] + Stretch = True + Alignment = Align.Center + } + { sldResize Slider + MoveScaled(13,11,36,3) + MaxValue = 5 + Value = 5 + } + { lblTitle Label + MoveScaled(2,2,52,6) + Font = Font["Bold,+5"] + Foreground = Color.TextBackground + AutoResize = True + Text = ("Resize") + } + { lblSize Label + MoveScaled(14,14,34,5) + Font = Font["Bold,+5"] + Foreground = Color.TextBackground + AutoResize = True + } + } +} diff --git a/examples/examples/Image/PhotoTouch/.src/FScissors.class b/examples/examples/Image/PhotoTouch/.src/FScissors.class index fb5973489..d95175c13 100644 --- a/examples/examples/Image/PhotoTouch/.src/FScissors.class +++ b/examples/examples/Image/PhotoTouch/.src/FScissors.class @@ -14,7 +14,7 @@ Private $hRect As Rect Private btnCut As CButton -Private Sub Form_Resize() +Public Sub Form_Resize() $aScissors[S_NW].Move(0, 0, HANDLE_SIZE, HANDLE_SIZE) $aScissors[S_NE].Move(Me.W - HANDLE_SIZE, 0, HANDLE_SIZE, HANDLE_SIZE) @@ -25,7 +25,7 @@ Private Sub Form_Resize() $aScissors[S_W].Move(0, HANDLE_SIZE, HANDLE_SIZE, Me.H - HANDLE_SIZE * 2) $aScissors[S_E].Move(Me.W - HANDLE_SIZE, HANDLE_SIZE, HANDLE_SIZE, Me.H - HANDLE_SIZE * 2) - btnCut.Move(Me.W - 64 - Desktop.Scale * 3, Desktop.Scale * 3) + btnCut.Move(Me.W - btnCut.W - Desktop.Scale * 3, Desktop.Scale * 3) End @@ -49,11 +49,11 @@ Public Sub Form_Open() Next btnCut = New CButton(Me) As "btnCut" - btnCut.Resize(64, 64) + btnCut.Resize(48, 48) btnCut.Image = Image.Load("scissors.png") Me.Move(FMain.ClientW \ 4, FMain.ClientH \ 4, FMain.ClientW \ 2, FMain.ClientH \ 2) - Form_Resize + 'Form_Resize End @@ -69,8 +69,8 @@ Public Sub Panel_MouseMove() Dim X, Y As Integer Dim iTag As Integer = Last.Tag - Dim MIN_HEIGHT As Integer = 64 + Desktop.Scale * 6 - Dim MIN_WIDTH As Integer = 64 + Desktop.Scale * 6 + Dim MIN_HEIGHT As Integer = btnCut.W + Desktop.Scale * 6 + Dim MIN_WIDTH As Integer = btnCut.H + Desktop.Scale * 6 Select Case Last.Tag @@ -124,7 +124,7 @@ Public Sub Panel_MouseMove() End Select - Form_Resize + 'Form_Resize End diff --git a/examples/examples/Image/PhotoTouch/.startup b/examples/examples/Image/PhotoTouch/.startup index b7f2100d3..eb0c99877 100644 --- a/examples/examples/Image/PhotoTouch/.startup +++ b/examples/examples/Image/PhotoTouch/.startup @@ -8,5 +8,6 @@ gb.image gb.qt4 gb.form gb.desktop +gb.settings gb.image.effect diff --git a/examples/examples/Image/PhotoTouch/control.png b/examples/examples/Image/PhotoTouch/balance.png similarity index 100% rename from examples/examples/Image/PhotoTouch/control.png rename to examples/examples/Image/PhotoTouch/balance.png diff --git a/examples/examples/Image/PhotoTouch/blur.png b/examples/examples/Image/PhotoTouch/blur.png new file mode 100644 index 000000000..95edf31cf Binary files /dev/null and b/examples/examples/Image/PhotoTouch/blur.png differ diff --git a/examples/examples/Image/PhotoTouch/despeckle.png b/examples/examples/Image/PhotoTouch/despeckle.png new file mode 100644 index 000000000..8ab631af7 Binary files /dev/null and b/examples/examples/Image/PhotoTouch/despeckle.png differ diff --git a/examples/examples/Image/PhotoTouch/hflip.png b/examples/examples/Image/PhotoTouch/hflip.png new file mode 100644 index 000000000..69618bd4e Binary files /dev/null and b/examples/examples/Image/PhotoTouch/hflip.png differ diff --git a/examples/examples/Image/PhotoTouch/invert.png b/examples/examples/Image/PhotoTouch/invert.png new file mode 100644 index 000000000..3bc3844aa Binary files /dev/null and b/examples/examples/Image/PhotoTouch/invert.png differ diff --git a/examples/examples/Image/PhotoTouch/magic.png b/examples/examples/Image/PhotoTouch/magic.png new file mode 100644 index 000000000..c5fc8b935 Binary files /dev/null and b/examples/examples/Image/PhotoTouch/magic.png differ diff --git a/examples/examples/Image/PhotoTouch/normalize.png b/examples/examples/Image/PhotoTouch/normalize.png new file mode 100644 index 000000000..528c513c2 Binary files /dev/null and b/examples/examples/Image/PhotoTouch/normalize.png differ diff --git a/examples/examples/Image/PhotoTouch/oil.png b/examples/examples/Image/PhotoTouch/oil.png new file mode 100644 index 000000000..63ea89b9e Binary files /dev/null and b/examples/examples/Image/PhotoTouch/oil.png differ diff --git a/examples/examples/Image/PhotoTouch/resize.png b/examples/examples/Image/PhotoTouch/resize.png new file mode 100644 index 000000000..e7a3e36c7 Binary files /dev/null and b/examples/examples/Image/PhotoTouch/resize.png differ diff --git a/examples/examples/Image/PhotoTouch/sharpen.png b/examples/examples/Image/PhotoTouch/sharpen.png new file mode 100644 index 000000000..df1c41477 Binary files /dev/null and b/examples/examples/Image/PhotoTouch/sharpen.png differ diff --git a/examples/examples/Image/PhotoTouch/vflip.png b/examples/examples/Image/PhotoTouch/vflip.png new file mode 100644 index 000000000..9a6720bd5 Binary files /dev/null and b/examples/examples/Image/PhotoTouch/vflip.png differ