Results 1 to 6 of 6

Thread: Generating Thumbnails

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Is there any special API/functions for generating thumbnails or everybody uses StrechBlt/PaintPicture for doing so?

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    There isn't any difference, thumbnails are resized
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Only thing you can do is anti-aliasing to save quality...

  4. #4
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457

    Cool Interpolate

    Here's some code I found to interpolate an image:

    Code:
        For y = 0 To Pic.Height Step ((Pic.Height / Resized.Height) * 15) - 1
            For x = 0 To Pic.Width Step ((Pic.Width / Resized.Width) * 15) - 1
                Dim cRed, cBlue, cGreen
                For sX = x To (x + ((Pic.Width / Resized.Width) * 15)) Step 15
                    For sY = y To (y + ((Pic.Height / Resized.Height) * 15)) Step 15
                        RGBfromLONG (GetPixel(Pic.hdc, sX / 15, sY / 15))
                        cRed = (cRed + rRed) / 2
                        cBlue = (cBlue + rBlue) / 2
                        cGreen = (cGreen + rGreen) / 2
                    Next sY
                Next sX
                SetPixel Resized.hdc, rX / 15, rY / 15, RGB(cRed, cGreen, cBlue)
                rX = rX + 15
            Next x
            
            rY = rY + 15
            rX = 0
        Next y
        
        Resized.Refresh
    Now the function RGBFromLong:

    Code:
    Private Function RGBfromLONG(LongCol As Long)
        'Get The Red, Blue And Green Values Of A Colour From The Long Value
        
        rRed = LongCol And 255
        rGreen = (LongCol And 65280) \ 256
        rBlue = (LongCol And 16711680) \ 65535
    End Function
    Oh, there's 3 more variables you must declare (in the Declarations part of the code, before all the other functions) :

    Code:
    Dim rRed As Byte
    Dim rBlue As Byte
    Dim rGreen As Byte
    That's it. Make sure you have the SetPixel and GetPixel APIs declared. The original image is Pic and the resized image is Resized. Sorry for having no comments, but that's how I found the function. And if it doesn't work, reply back, because I haven't tested it!

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    I am sory to ask this question again, but I still have no answer for this one:

    Have any one of you ever tried using PaintPicture or StrechBlt on a child window. I cannot seem to make it work when I call it in the form resize event. The child window and the Mdi window are from two different applications. I am setting the child window to its mdi parent through a api call. If you can't understand the question, please post a message so that I can calrify further.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Oops!
    Sorry for the trouble, but it was a simple case of setting the autoredraw property to true.

    Sorry again

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