[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.8

Radial Blur Zoom

Asked by ennixo in Miscellaneous Programming

Tags: blur, radial

Hi, i programmed a function to radial blur (zoom) pictures in Vb6 (with a force from zero to 100% and a point of blur), it works well (better quality than photoshop) but it's a little slower.

my function is easy and i would like to know how to accelerate the process to get the same quality faster
i need a vb6 or C++ function.

here's my function :

'cx, cy = Center X and Center Y
'k = Force (0 to 100%)
'Quality = Quality : 1 = Best | 2 = Good | 4 = Medium | 16 = Bad
Public Sub RadialBlurZoom(ByVal cx As Long, ByVal cy As Long, ByVal k As Single, ByVal Quality as Long)

    Dim j               As Long
    Dim i               As Long
    Dim l               As Long
    Dim nX              As Long
    Dim nY              As Long
    Dim dX              As Long
    Dim dY              As Long
    Dim Alpha           As Single
    Dim Hypotenuse      As Long
    Dim vMax            As Long
    Dim TotalR          As Long
    Dim TotalG          As Long
    Dim TotalB          As Long
    Dim Dividor         As Long
    Dim NewBits()       As Byte

    'in the form, PicBits is a private array which contains bitmapbits (from GetBitmapBits)

    ReDim NewBits(LBound(PicBits) To UBound(PicBits))
   
    If K = 0 Then K = 1
    If K > 100 Then K = 100
    K = K / 400
   
    'shpSelection is a Shape which contains the rectangle area to be processed
    For j = shpSelection.Top + 1 To shpSelection.Top + shpSelection.Height
       
        dY = Abs(j - cY)
       
        For i = shpSelection.Left + 1 To shpSelection.Left + shpSelection.Width
           
            dX = Abs(i - cX)
            If dX = 0 Then dX = 1
           
            Alpha = Atn(dY / dX)
            Hypotenuse = Sqr(dX * dX + dY * dY)
           
            TotalR = 0
            TotalG = 0
            TotalB = 0
            Dividor = 0
           
            vMax = Hypotenuse * K
            
            For l = -vMax To vMax Step Quality
            If i < cX Then
                  nX = i + (Cos(Alpha) * l)
            ElseIf i >= cX Then
                  nX = i - (Cos(Alpha) * l)
            Else
                  nX = 0
            End If
            If j < cY Then
                  nY = j + (Sin(Alpha) * l)
            ElseIf j >= cY Then
                  nY = j - (Sin(Alpha) * l)
            Else
                  nY = 0
            End If
            
            'in this form, Matrix is a private array which contains indexes of
            'bits in PicBits to retrieve a point with X and Y values.
                If nX > 0 And nY > 0 And nX <= UBound(Matrix) And nY <= UBound(Matrix, 2) Then
                    TotalR = TotalR + PicBits(Matrix(nX, nY))
                    TotalG = TotalG + PicBits(Matrix(nX, nY) + 1)
                    TotalB = TotalB + PicBits(Matrix(nX, nY) + 2)
                    Dividor = Dividor + 1
                End If
            Next l
            If Dividor > 0 Then
                NewBits(Matrix(i, j)) = TotalR \ Dividor
                NewBits(Matrix(i, j) + 1) = TotalG \ Dividor
                NewBits(Matrix(i, j) + 2) = TotalB \ Dividor
            Else
                NewBits(Matrix(i, j)) = PicBits(Matrix(i, j))
                NewBits(Matrix(i, j) + 1) = PicBits(Matrix(i, j) + 1)
                NewBits(Matrix(i, j) + 2) = PicBits(Matrix(i, j) + 2)
            End If
        Next i
    Next j

    'P is the name of a pictureBox where the picture was loaded
    'sets the new bits to P.Image
    SetBitmapBits P.Image, UBound(NewBits), NewBits(1)
   
End Function
[+][-]04/23/04 03:16 AM, ID: 10897889Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Miscellaneous Programming
Tags: blur, radial
Sign Up Now!
Solution Provided By: mokule
Participating Experts: 2
Solution Grade: A
 
[+][-]04/23/04 01:25 AM, ID: 10897278Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/04 02:30 AM, ID: 10897610Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/04 02:34 AM, ID: 10897632Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/04 03:15 AM, ID: 10897883Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/04 03:31 AM, ID: 10897967Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/04 03:59 AM, ID: 10898148Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/04 04:07 AM, ID: 10898186Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/04 08:02 AM, ID: 10900444Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/04 08:30 AM, ID: 10900796Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/04 09:18 AM, ID: 10901306Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/04 10:01 AM, ID: 10901734Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92