Paint Alternate Pixels? - RealWorld forums

Log-in or register.

Paint Alternate Pixels?

Is this an option?
Anonymous
on May 1st 2007

I have used Microangelo before, and it had one feature which I cannot find in RealWorld: The option to paint alternate pixels.

You could paint or fill an area and it would only affect the odd or even pixels, alternating on each line.

This means that by filling in background colour you could dim the icon.

Any comparable tool in RealWorld to achieve the same effect?

Thanks

Matt Brown

Vlasta
on May 1st 2007

You are right, this feature is not present in RWIE. You have these options:
1) Use background color, set alpha to 1/2 ( 128 ) and use the Paint Over mode (the default one). Then draw any shape or fill an area. This will dim the affected pixels, but the result will be different form Microangelo - the image will be smooth in high color depths, and dithered in low color depths (but there will not be a regular pattern).
2) Create a custom script, that replaces every other pixel with given color. The script would only be able to affect the entire image or the selected area, so no flood-filling and such.

Anonymous
on May 2nd 2007

Wow, scripts look like the answer, but I'm not sure I'm up to writing one from scratch!

Could anyone post he code required to do this?

Thanks for your help.

MB

Vlasta
on May 2nd 2007

The simples way to run a custom script is to click on "Custom Operation" in the "Effect" menu and replace the script with the following one:

var sizeX = RasterImage.sizeX;
var sizeY = RasterImage.sizeY;
var color = 0xff0000ff;
for(x=0; x<sizeX; x++)
  for(y=0; y<sizeY; y++)
   if ((x+y)&1)
     RasterImage.SetPixel(x, y, 0, 0, color);

Note the color variable on 3rd line. By changing it, you may select different color. The color is in hexadecimal ABGR encoding, if you are not sure what that means, use the following line, but with actual color values (in range 0-255):

var color = (ALPHA<<24)|(BLUE<<16)|(GREEN<<8)|(RED);

There are other ways how to define and run scripts, but this is the easiest one.

Anonymous
on May 3rd 2007

Thanks for that.

I can follow the code and kind of see what it does. However, the syntax is incomplete. If anyone could alter the code ({ } and correct number of brackets etc) I would very much appreciate it.

Thanks all.

MB

Vlasta
on May 3rd 2007

Oh, there was a problem with html encoding, I forgot to use &lt; instead of < and part of the code was not visible. It should be all right now.

Anonymous
on May 3rd 2007

THANKS VLASTA!!!

You are a star.

The colour code for transparent background, var color = 0xff0000ff;, achieves exactly what I wanted!

This creates a dimmed icon for any coloured backdrop.

Thanks for all you help.

Best Regards,

MB

Vlasta
on May 3rd 2007

Actually 0xff0000ff should be red ;-). To erase pixels use just color = 0.

Anonymous
on July 18th 2009

oooooooooooo your my pikcur

sixλxis
on March 24th 2010

it says "expected ')'" when i input it.

please post the updated code.

Vlasta
on March 25th 2010

Fixed...

sixλxis
on March 25th 2010

Now it says 'RasterImage is undefined'

(im trying to use this in paint)

Vlasta
on March 25th 2010

It will only work with a older versions of the apps. In newer ones, Document.RasterImage must be used instead of just RasterImage

There is an updated version in another topic.

Alcoby2005
on August 21st

Very interesting article, thanks for the write up. I was at first annoyed that you didn't just explain it in the first paragraph, but the longer walk through was helpful

Page views: 15743       Posts: 14      
Select background
I wish there were...
What about ICL files?