Thema Datum  Von Nutzer Rating
Antwort
Rot Bildbearbeitung mit VBA
08.12.2003 07:01:21 Christian
NotSolved
09.12.2003 14:35:58 Rasta
NotSolved

Ansicht des Beitrags:
Von:
Christian
Datum:
08.12.2003 07:01:21
Views:
2389
Rating: Antwort:
  Ja
Thema:
Bildbearbeitung mit VBA
Hallo Leute!
hab ein echtes Problem. Muss bis Dienstag ein Programm schreiben das folgendes macht:
Also es soll ein bild laden und danach soll man es mit 3 bis 5 Farben bearbeiten können. Einerseits soll man eine Art Buntstift benutzen um einfach wie bei paint auf das zu malen und dann soll man auch eine Art "filter" erstellen. Sprich man hat das bild geladen und dann soll man es mit der ausgewählten Farbe färben. Hab leider null Ahnung wie es gehen soll und ich hab auch noch leider nichts im Internet gefunden. Anbei noch mein code! Sorry aber bin halt Anfänger in VBA
Danke schon im voraus für eure Hilfe
Christian
Option Explicit

Private Sub cmdLoad_Click()
cd1.CancelError = True
On Error GoTo dbherrhandler2
'cd1.Flags = cd1ccFullopen 'cd1ofnFilemustexist + cd1ofnHideReadOnly
cd1.Filter = "Bitmaps (*.bmp)|*.bmp|Icons, Gifs, Jpgs|*.ico;*gif;*.jpg|All files(*.*)|*.*"
cd1.ShowOpen
Picture1.Picture = LoadPicture(cd1.FileName)
Exit Sub

dbherrhandler2:
MsgBox "Cancelling"
Exit Sub



End Sub


Private Sub cmdSave_Click()
cd1.CancelError = True
On Error GoTo dbherrhandler1
'cd1.Flags = cd1OFNPathmustExist + cd1OfNHideReadOnly + Cd1OfnOverwritePrompt
cd1.Filter = "Bitmaps (*.bmp)|*.bmp|Icons, Gifs, Jpgs|*.ico;*gif;*.jpg|All files(*.*)|*.*"
cd1.ShowSave
SavePicture Picture1.Picture, cd1.FileName
Exit Sub

dbherrhandler1:
MsgBox "Cancelling"
Exit Sub

End Sub

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form1_Load()
Picture2.Width = Picture1.Width
Picture2.Height = Picture1.Height
Picture1.AutoRedraw = True
For y = 0 Picture1.ScaleHeight - 1
For x = 0 Picture.ScaleWidth - 1
Do Events
If stopproc = True Then
stopproc = False
Exit Sub
End If

c1 = Picture1.Point(x, y)
C0 = c3tog(c1)
Picture1.PSet (x, y), RGB(0, C0, 0)
Next x
Next y
MsgBox "Processing complete", vbInformation

Red = RGB(C0, 0, 0)
green = RGB(0, C0, 0)
yellow = RGB(C0, 0, 0)

Public Function c3tog1()
Dim rbyte As Byte
Dim gbyte As Byte
Dim bbyte As Byte
Call goodc3torgb(col3, rbyte, gbyte, bbyte)
c3tog1 = CByte(rbyte * 0.3) + CByte(gbyte * 0.59) + CByte(bbyte * 0.15)
End Function

Public Sub c3torgb()
'r1= (Ccol3&HFF&)
'g1= ((col3&&HFF00&)) / &H00&) Mod &H100
'b1= ((col3&Hff0000)/ &h10000) Mod &h100




End Sub

Private Sub Command2_Click()
cd1.CancelError = True
On Error GoTo There1
'cd1.Flags = cd1CCFullopen
cd1.ShowColor
Form1.BackColor = cd1.Color
Exit Sub

There1:
MsgBox "OK, Cancelling..whatever you want", vbInformation
Exit Sub

End Sub

Private Sub Command3_Click() 'the treshhold effect
Dim x As Integer
Dim y As Integer
Dim c1 As Long
Dim C0 As Byte
Dim color3 As Long

c1 = Picture1.Point(x, y)
C0 = c3tog1(c1)

If C0 > 128 Then
color3 = C0
'Color = RGB(C0, 0, 0)
Else
color3 = c1
End If

Picture1.PSet (x, y), color3
Next x
Next y
MsgBox "Processing complete my friend", vbInformation


End Sub

Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:

 
 

  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
Rot Bildbearbeitung mit VBA
08.12.2003 07:01:21 Christian
NotSolved
09.12.2003 14:35:58 Rasta
NotSolved