realbasic-nug
[Top] [All Lists]

Re: [OT] Need a custom picture viewer class.

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: [OT] Need a custom picture viewer class.
From: Tom Benson <tombenson at mac dot com>
Date: Sun, 30 Dec 2007 22:06:40 +1100
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <47777809 dot 6080909 at ryandary dot com>
Ryan,

Alex Restrepo has a class that already does most of this (gives you an  
grid of images, scalable to whatever size you require)

http://homepage.mac.com/alexrestrepo

Check out the screenshots, but it is all available under the Creative  
Commons license, so you can use them commercially as long as you  
credit him.

Cheers,
Tom

On 30/12/2007, at 9:50 PM, Ryan Dary wrote:

> I need a container control that will allow me to view and scroll  
> through
> an array of picture objects.  I want the code to be as simple as
> possible, and there can be no auxiliary classes or modules.  Just a
> single ContainerControl, and a couple scrollbars.  The container  
> control
> has a property: Image() As Picture.
>
> Basically, I have an array of Pictures, and I want to be able to  
> scroll
> through them.  Scrolling should be smooth.  The following "modes" are
> required:
>
> Scale by Percent (might enable horizontal & vertical scrolling)
> Fit-to-width (only vertical scrolling, images lined up vertically)
> Fit-to-height (only horizontal scrolling, images lined up  
> horizontally)
>
> Optional Background Color
> Optional "padding" amount between images (to provide a margin which
> would reveal the background color)
>
> Here is the basic class layout:
>
> Class MyScrollingContainer
>
>      Sub Setup()
>      Function FindImageAtXY( x As Integer, y As Integer ) As Integer
>         // This would allow for accessing the "clicked" image in view
>
>      Function FindImageRect( pImageIndex As Integer, byRef pLeft As
> Integer, pTop As Integer, pWidth As Integer, pHeight As Integer ) As  
> Boolean
>         // This would return (by reference) the relative position of
> the rendered image within the container.
>
>      Property Mode As Integer
>      Property Image() As Picture
>      Property Mode_Value As Double
>      Constant kMode_ScaleByPercent = 0
>      Constant kMode_FitToWidth = 1
>      Constant kMode_FitToHeight = 2
>      Property Background_Color As Color
>      Property Image_Padding As Integer
>      Event PaintOverlay( pIndex As Integer, pContext As Graphics,  
> pLeft
> As Integer, pTop As Integer, pWidth As Integer, pHeight As Integer )  
> As
> Boolean
>         // This event would allow for drawing after the picture has
> been drawn.  It would be called every time the container needs to be
> refreshed.  The coordinates would provide the location and size of the
> picture that is being painted at that time.
>      Sub UpdateRect( pX As Integer, pY As Integer, pWidth As Integer,
> pHeight As Integer )
>          // This method allows for "optimal" redrawing.  Only the  
> items
> that would be affected in this defined area would be redrawn, this  
> would
>  trigger the PaintOverlay event as needed, offset appropriately for
> drawing.
>
> End Class
>
> Here are a few more "requirements"
>
> * Scrollbars must auto-hide when not required.
> * Scrolling must be "smooth" (not a "page-by-page" scrolling)
> * Code for Scroll-wheel must be working
> * It is not guaranteed that all Pictures are the same size
> * Pictures are always lined up vertically or horizontally depending on
> "mode" property.
> * ImagePadding would cause the images to be as equally spaced out as
> they are from the edge of the container.  This means that padding
> wouldn't double-up between pictures.  The same amount of "margin" that
> is visible between the picture and the edge of the container, would be
> the same as between the pictures in the "list".
>
> If you're a contractor who wants to bid on this project, please  
> email me
> your bid offline.  This needs to be a project-based bid, not an hourly
> rate.  Also, include the time to delivery.
>
> The code needs to be tidy and moderately commented for maintenance.   
> The
> code needs to be "somewhat" optimized for ability to live-resize at a
> non-sluggish pace.
>
> Payment will be made to person via PayPal in US Currency.  Please  
> ask as
> many questions as required before starting so that expectations are
> lined up.  Agreement must be made prior to work beginning.
>
> Thank you,
>
> Ryan
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>