Strona: [  << <   1   > >>  ]  z  1     
Autor Temat: INVALID PICTURE :[ - BARDZO PROSZ╩ O POMOC!
mikmas
From úˇd╝ Stadt




Typ: neutral
Postˇw: 772
Zarejestrowany: Apr 2003
INVALID PICTURE :[ - BARDZO PROSZ╩ O POMOC!

A wiŕc zacznŕ od pocz▒tku. Chcŕ zrobiŠ grŕ ala prince of persja. Najpierw jednak potrzebujŕ Eytor Obiektˇw. Wszystko jest ok dopuki nie trzeba odczytaŠ pliku. Obiekt mo┐e byŠ animowany, a wiŕc musz▒ byŠ klatki. Tak wygl▒da plik po otworzeniu w notatniku:

OBJ

Klatka 0
BM.:6(FF°9__________________________________________
_________________________________________________
_________________________________________________
_________________________________________________
_________________________________________________
_____└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└
└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└______
__________________└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└
└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└
└________________________└└└└└└└└└└└└└└└└└└└└└└└└
└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└
└└________________________└└└└└└└└└└└└└└└└└└└└└└└
└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└______
__________________________________________└└└└└└└
└└└└└└└└└└└└└└___________________________________
_______________________________└└└└└└└└└└└└└└└└└└
└└└______________________________________________
______________└└└└└└└└└└└└└└└└└└└└└______________
_________________________└└└└└└└└└└└└└└└└└└└└└___
_______________└└└└└└└└└└└└└└└└└└└└└_____________
_____└└└└└└└└└└└└└└└└└└└└└__________________└└└└└
└└└└└└└└└└└└└└└└__________________└└└└└└└└└└└└└└└
└└└└└└__________________└└└└└└└└└└└└└└└└└└└└└____
______________└└└└└└└└└└└└└└└└└└└└└______________
____└└└└└└└└└└└└└└└└└└└└└__________________└└└└└└
└└└└└└└└└└└└└└└__________________└└└└└└└└└└└└└└└└
└└└└└__________________└└└└└└└└└└└└└└└└└└└└└_____
_____________└└└└└└└└└└└└└└└└└└└└└_______________
___└└└└└└└└└└└└└└└└└└└└└__________________└└└└└└└
└└└└└└└└└└└└└└__________________└└└└└└└└└└└└└└└└└
└└└└__________________└└└└└└└└└└└└└└└└└└└└└______
____________└└└└└└└└└└└└└└└└└└└└└________________
__└└└└└└└└└└└└└└└└└└└└└__________________└└└└└└└└
└└└└└└└└└└└└└__________________└└└└└└└└└└└└└└└└└└
└└└__________________└└└└└└└└└└└└└└└└└└└└└_______
___________└└└└└└└└└└└└└└└└└└└└└_________________
_└└└└└└└└└└└└└└└└└└└└└__________________└└└└└└└└└
└└└└└└└└└└└└__________________└└└└└└└└└└└└└└└└└└└
└└__________________└└└└└└└└└└└└└└└└└└└└└________
__________└└└└└└└└└└└└└└└└└└└└└__________________
└└└└└└└└└└└└└└└└└└└└└__________________└└└└└└└└└└
└└└└└└└└└└└__________________└└└└└└└└└└└└└└└└└└└└
└__________________└└└└└└└└└└└└└└└└└└└└└_________
_________└└└└└└└└└└└└└└└└└└└└└__________________└
└└└└└└└└└└└└└└└└└└└└__________________└└└└└└└└└└└
└└└└└└└└└└__________________└└└└└└└└└└└└└└└└└└└└└
__________________└└└└└└└└└└└└└└└└└└└└└__________
________└└└└└└└└└└└└└└└└└└└└└__________________└└
└└└└└└└└└└└└└└└└└└└__________________└└└└└└└└└└└└
└└└└└└└└└__________________└└└└└└└└└└└└└└└└└└└└└_
_________________└└└└└└└└└└└└└└└└└└└└└__________
________└└└└└└└└└└└└└└└└└└└└└__________________└└
└└└└└└└└└└└└└└└└└└└__________________└└└└└└└└└└└└
└└└└└└└└└__________________└└└└└└└└└└└└└└└└└└└└└_
_________________└└└└└└└└└└└└└└└└└└└└└___________
_______└└└└└└└└└└└└└└└└└└└└└__________________└└└
└└└└└└└└└└└└└└└└└└__________________└└└└└└└└└└└└└
└└└└└└└└__________________└└└└└└└└└└└└└└└└└└└└└___
_______________└└└└└└└└└└└└└└└└└└└└└______________
____└└└└└└└└└└└└└└└└└└└└└_________________________
___________└└└└└└└└└└└└└└└└└└└└└__________________
_____________________________________________└└└└└
└└└└└└└└└└└└└└└└__________________________________
________________________________└└└└└└└└└└└└└└└└└└
└└└_____________________________________________└└
└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└
└└└└└└└└└└└└└└___________________________└└└└└└└└└
└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└
└└└└└└└└└└└└└└└└________________________└└└└└└└└└└
└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└
└└└└└└└└└└└└└└└└└└└└└_____________________└└└└└└└└
└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└└
└└└└└└└└└└└└└└└└└└└└└└└└└└└└└_____________________
__________________________________________________
__________________________________________________
__________________________________________________
__________________________________________________
_________________________
End Klatka
Klatka 1
0
End Klatka
Klatka 2
0
End Klatka
Klatka 3
0
End Klatka
Klatka 4
0
End Klatka
Klatka 5
0
End Klatka


prog w czasie odczytania musi wyd│ubaŠ obraz ktˇry jest (w tym przypadku) od "Klatka 0" do "End Klatka". Jednak po wyd│ubaniu i wstawieniu do obrazu wybija siŕ b│▒d "Invalid picture" . Oto modu│y odczytywania i zapisywania:

Zapis:

Sub Zapisz()
Dim DoZapisu As String
DoZapisu = "OBJ" & Chr(Speed) & Chr(Start + 1) & Chr(Typ) & Chr(Typ1) & Enter
Dim I As Byte
For I = 0 To Image1.Count - 1
DoZapisu = DoZapisu & Enter & "Klatka " & I & Enter & Obraz(Image1(I)) & Enter & "End Klatka"
Next
Open Zapisane_w For Output As #1
Print #1, DoZapisu
Close #1
End Sub

Function Obraz(Obrazek As Object) As String
If Obrazek.Picture = 0 Then
Obraz = 0
Exit Function
End If
SavePicture Obrazek.Picture, "C:\obr.tmp"
Obraz = Read("C:\obr.tmp"
End Function

Odczytu:

Private Sub Command1_Click()
Dim Szukaj2 As Long, WCzym As String, Szukaj1 As Long, Wynik As Variant
WCzym = Read("C:\test\test.obj"
Szukaj1 = Find("Klatka 1", WCzym)
Szukaj2 = Find("End Klatka", WCzym, Szukaj1)
Wynik = Mid(WCzym, Szukaj1 + 10, Szukaj2 - Szukaj1 - 13)
Open "C:\test.bmp" For Output As #1
Print #1, Wynik
Close #1
RTB.Text = Wynik
Picture1.Picture = LoadPicture("C:\test.bmp"
End Sub

Function Find(Co As String, WCzym As String, Optional Pocz As Long) As Variant
Dim I As Long
I = Pocz
If I = 0 Then I = 1
Do
DoEvents
I = I + 1
If Mid(WCzym, I, Len(Co)) = Co Then
Find = I
Exit Function
End If
Loop
End Function


PRZYPOMINAM, »E NIE MO»NA KOPIOWAĂ OBRAZU (POMI╩DZY "Klatka 0", A "End Klatka"WúASNOR╩CZNIE Z TEGO FORUM, PONIEWA» NOTATNIK, WORDPAD, NET W CZASIE KOPIOWANIA ZMIENIAJí TROCH╩ STRUKTUR╩ PLIKU TAK, »E JU» NAPEWNO NIE WCZYTA SI╩ DO PICTUREBOX'A!


_____________________________________________
4C;65;70;69;65;6A;20;62;79;9C;20;73;69;EA;20;
62;61;72;64;7A;69;65;6A;20;73;6B;6F;6E;63;65;
6E;74;72;6F;77;61;B3;20;6E;61;20;6F;64;70;6F;
77;69;65;64;7A;69;2C;20;61;20;6E;69;65;20;6E;
61;20;72;6F;7A;73;7A;79;66;72;6F;77;79;77;61;
6E;69;75;20;3A;50

17-06-2004 14:58
Poka┐ profil mikmas  WyÂlij email do mikmas   Odwied╝ stronŕ mikmas       3632553
kicaj




Typ: neutral
Postˇw: 271
Zarejestrowany: Aug 2003

Mogl bys mi to preslac na maila bo nie mam jak tego sprawdzic, a co za tym idzie nie wiem czy moge Ci pomoc

18-06-2004 02:05
Poka┐ profil kicaj  WyÂlij email do kicaj        3914568
mikmas
From úˇd╝ Stadt




Typ: neutral
Postˇw: 772
Zarejestrowany: Apr 2003

Ok - wys│ane


_____________________________________________
4C;65;70;69;65;6A;20;62;79;9C;20;73;69;EA;20;
62;61;72;64;7A;69;65;6A;20;73;6B;6F;6E;63;65;
6E;74;72;6F;77;61;B3;20;6E;61;20;6F;64;70;6F;
77;69;65;64;7A;69;2C;20;61;20;6E;69;65;20;6E;
61;20;72;6F;7A;73;7A;79;66;72;6F;77;79;77;61;
6E;69;75;20;3A;50

18-06-2004 14:20
Poka┐ profil mikmas  WyÂlij email do mikmas   Odwied╝ stronŕ mikmas       3632553
Knight Lore''FC




Typ: neutral
Postˇw: 240
Zarejestrowany: Jan 2003

szkoda ze nie dales troche wiecej kodu programu
Nie ma funkcji READ...
definicji Speed, Start, Typ, Typ1, Enter

Postanowilem jednak podlubac w twoim kodzie i przedstawiam zmodyfikowana wersje.
Po co tworzyles funkcje FIND ??? przeciez VB ma juz taka funkcje i to nawet sprawa i szybka - InStr


'pominalem twoja linijke :
'DoZapisu = "OBJ" & Chr(Speed) & Chr(Start + 1) & Chr(Typ) & Chr(Typ1) & Enter

'bo nie wiem co tam mialo byc, ale nie wplywa to na dzialanie programu
'zamienilem Enter na vbCrLf - bo o to chyba chodzilo

Sub Zapisz()
   
Dim Zapisane_w As String
Dim DoZapisu As String
Dim I As Byte
Dim FreeCan As Integer

FreeCan = FreeFile

    Zapisane_w = "c:\obr.tmp"
   
    For I = 0 To Image1.Count - 1
        DoZapisu = DoZapisu & "Klatka " & I & vbCrLf & Obraz(Image1(I)) & vbCrLf & "End Klatka"
    Next

    Open Zapisane_w For Output As #FreeCan
        Print #FreeCan, DoZapisu
    Close #FreeCan

End Sub


Function Obraz(Obrazek As Object) As String

If Obrazek.Picture = 0 Then
    Obraz = 0
    Exit Function
End If

SavePicture Obrazek.Picture, "C:\obr.tmp"
Obraz = Read("C:\obr.tmp" )

End Function



'zamienilem twoje Find na InStr i troszke przerobilem
Private Sub Command1_Click()

Dim Szukaj2 As Long
Dim Szukaj1 As Long
Dim WCzym As String
Dim Wynik As Variant
Dim FreeCan As Integer

FreeCan = FreeFile

WCzym = Read("C:\obr.tmp" )
Szukaj1 = InStr(1, WCzym, "Klatka 1" )
Szukaj2 = InStr(Szukaj1, WCzym, "End Klatka" )
Wynik = Mid(WCzym, Szukaj1 + 10, Szukaj2 - Szukaj1 - 13)

Open "C:\test.bmp" For Output As #FreeCan
    Print #FreeCan, Wynik
Close #FreeCan

RTB.Text = Wynik
Picture1.Picture = LoadPicture("C:\test.bmp" )
End Sub


'dodalem funkcje READ (bo jej nie zamiesciles - ale chyba miales podobna )

Function Read(PlikDoOdcz As String) As String

Dim Dane As String
Dim Buffor As String
Dim FreeCan As Integer

FreeCan = FreeFile
Buffor = FileLen(PlikDoOdcz)
Dane = String(Buffor, 32)

Open PlikDoOdcz For Binary As #FreeCan
    Get #FreeCan, , Dane
Close #FreeCan

Read = Dane

End Function

Program dziala jak nalezy - sam ten pomysl mi sie przydal do innego programu (do tychczas BMP przechowywalem w osobnych plikach i bylo ich pelno - teraz mam wyszystkie w jedym pliku )

Mam nadzieje ze pomoglem
Pozdrawiam

21-06-2004 14:07
Poka┐ profil Knight Lore  WyÂlij email do Knight Lore        1065423
mikmas
From úˇd╝ Stadt




Typ: neutral
Postˇw: 772
Zarejestrowany: Apr 2003

Dziŕki Knight za odp. Hehe. Tyle siŕ mŕczyŠ, ┐eby zrobiŠ funkcjŕ wyszukiwania, kiedy siŕ okazuje, ┐e VB ma 5x szybsz▒ swoj▒ funkcjŕ . Jeszcze raz dziŕx


_____________________________________________
4C;65;70;69;65;6A;20;62;79;9C;20;73;69;EA;20;
62;61;72;64;7A;69;65;6A;20;73;6B;6F;6E;63;65;
6E;74;72;6F;77;61;B3;20;6E;61;20;6F;64;70;6F;
77;69;65;64;7A;69;2C;20;61;20;6E;69;65;20;6E;
61;20;72;6F;7A;73;7A;79;66;72;6F;77;79;77;61;
6E;69;75;20;3A;50

21-06-2004 20:50
Poka┐ profil mikmas  WyÂlij email do mikmas   Odwied╝ stronŕ mikmas       3632553
Wszystkich odpowiedzi: 4 :: Maxymalnie na stronŕ: 20
Strona: [  << <   1   > >>  ]  z  1