Results 1 to 2 of 2

Thread: Need help working with 2D array to modify a image

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    14

    Question Need help working with 2D array to modify a image

    Hi:

    I am getting crazy trying to:

    -Read from a richtextbox a text that contains the values of color depth of the pixels of a image.
    -The text is secuencial a11,a12,a13,a21,a22....
    -The values are separated by a blank space
    -take those values and put them in a cuadrant of the whole picture matrix
    -change the picture

    This is what I´m trying:

    I wrote the matrix into the text:
    For x = X_ini To X_ini + 49 'filas
    For y = y_ini To y_ini + 49 'columnas
    s = s & Data(x, y) & " "
    count = count + 1
    Next y
    txtNote.Text = txtNote.Text & s
    Next x
    Text6.Text = count


    I take back the 50x50 matrix

    Const NumRows = 50
    Const NumCols = 50

    Dim aux() As String
    Dim sTmp() As String
    Dim i, x, j As Integer

    Dim iArr(NumRows, NumCols) As Long
    Dim strText As String


    Dim xin As Long
    Dim yin As Long



    Text4.Text = vimage.stx
    Text5.Text = vimage.sty
    strText = txtNote.Text
    aux() = Split(strText, vbCrLf)
    xin = X_ini
    yin = y_ini

    For i = 0 To UBound(aux())
    sTmp = Split(aux(i))
    For x = 0 To NumCols
    iArr(i, x) = CLng(sTmp(x))
    Next x
    Next i


    i = 0
    j = 0
    For a = X_ini To X_ini + NumRows - 1
    For b = y_ini To y_ini + NumCols - 1
    rcode = setpixelcolor(vimage, a, b, iArr(i, j))
    j = j + 1
    Next b
    j = 0
    i = i + 1
    Next a

    MainWnd.form_paint 'Redraw image
    MainWnd.Show
    ' Reset the scroll ranges for the new image

    ' Handle any errors
    If rcode <> NO_ERROR Then
    MainWnd.error_handler rcode, ""
    End If


    I dont get this work,I got zeros in places that doesn´t supposed to be.I am using victor image processing dll.

    What am I doing wrong? does anybody a way to do it?

    NEED HELP!!!

    THANKXXX!!

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    I am so confused ...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width