On Jun 09, 2006, at 15:45 UTC, Emile Schwarz wrote:
> use x and y loops to get the pixel(s) something like
>
> for x = 0 to PictWidth // I removed 1 to that value before the loop
> for y = 0 to PictHeight // I removed 1 to that value before the loop
> // Get a pixel color
> aColor = SourceSurf.Pixel(x,y)
>
> // Set a new / changed pixel color
> TargetSurf.Pixel(x,y) = cmy(aColor.Cyan,aColor.Cyan,0) // for example
> next
> next
Yes, you've done all the right things here -- you might get a very slight boost
by swapping your x and y loops (so that you're iterating over rows rather than
columns), but it's not likely to be noticeable.
The other thing you could do, if you're going to call aColor.Cyan twice, is
call it just once and store it in a local variable:
Dim cyan as Integer = aColor.Cyan
TargetSurf.Pixel(x,y) = cmy(cyan, cyan, 0)
Both the CMY method, and the Cyan, Magenta, and Yellow methods, are fairly
expensive calls, so do them as little as possible. But I wouldn't expect a
huge boost from that either.
> Of course I checked UserCancelled in both loops...
Take it out of the inner loop; check it only in the outer loop; that function
can be VERY expensive (depending on the version of RB you're using). Also, put
a #pragma backgroundTasks False around the inner loop -- or maybe around the
outer one (I'm not sure whether this will break the UserCancelled function; try
it and see).
(Of course, it's only because you're trying to display the CMY model here that
it's so much work. If you want to just display the R, G, or B channels, in
their natural colors, you could do this with .Transform by simply zeroing the
other two channels.)
HTH,
- Joe
--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC "Making the Internet a Better Place"
http://www.verex.com/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>