Hi Joe,

thank you for your kind (as usual) answer.

I do not have my code handly (it is on the other portable computer), but here what I've done (from memory and pseudo code)

create a new Picture (TargetPict)
get a RGBSurface for this picture (TargetSurf)
get a RGBSurface for the original picture (SourceSurf)

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

Canvas1.Backdrop = TargetPict

Of course I checked UserCancelled in both loops...

I do not see where I can optimize the code...

TIA,

Emile

Subject: Re: Swap colors of a photo
From: [EMAIL PROTECTED]
Date: Thu, 8 Jun 2006 11:38:23 -0600

On Jun 08, 2006, at 16:37 UTC, Emile Schwarz wrote:

In other words, inside two nested loops, I use RGBSurface.Pixel, get a part of its cmy values and use only Cyan, Magenta or Yellow in the replaced (still with RGBSurface.Pixel) pixel and assign the new color to the image. That process is slow.

Using RGBSurface.Transform works fine for Brightness / Darkness / Invert and some other things, but I am in front of a wall for what I want to do now.

You're right, .Transform can't do this sort of thing.  But it's possible your 
code could be optimized a bit; for example, if you're accessing 
Picture.RGBSurface within the loop, it's most likely way slower than it needs 
to be.  Why not post the loop and see if we can spot any ways to help?

_______________________________________________
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>

Reply via email to