Hi,

Someone asked me off list if I could mail him a .dir file with the pop-art 
thing... So I thought I'd mail a little movie script to the list, just in case 
somebody else wants it... I used Alex's stuff to improve mine... it looked 
cooler :)

Watch the wrap.

Chris.

--pop-art effect
--Thanks to Alex da Franca for better approach using points --img = source 
image --theMask = 8 bit mask image --pixsize = size of the blocks --useBackDrop 
= leave image in the background true or false

on warhol(img, theMask, pixSize, useBackdrop) 
  
  --scale mask to fit pixSize
  newMaskImage = image(pixSize, pixSize, 8, #grayscale) 
  newMaskImage.copyPixels(theMask, newMaskImage.rect, theMask.rect)
  
  nRect = newMaskImage.rect
  midPoint = point(nRect.width/2, nRect.height/2)
  pDistance = point(nRect.width, 0)
  theWidth = (img.width / nRect.width) + 1
  theHeight = (img.height / nRect.height) + 1
  
  
  returnImg = 0
  
  --use imput image as backdrop or use blank
  if useBackdrop then
    returnImg = img.duplicate()
  else
    returnImg = image(img.width, img.height, 32, 0)
  end if
  
  fillerImage = image(nRect.width, nRect.height, 32, 0)
  
  repeat with i = 1 to theHeight
    repeat with j = 1 to theWidth
      fillerImage.fill(fillerImage.rect, img.getPixel(midPoint))
      returnImg.copyPixels(fillerImage, nRect, fillerImage.rect, 
[#maskImage:newMaskImage])
      
      midPoint = midPoint + pDistance
      nRect = nRect.offset(nRect.width, 0)
      
    end repeat
    midPoint = point(nRect.width/2, midPoint[2] + nRect.height)
    nRect = nRect.offset(nRect.left * -1, nRect.height)
  end repeat
  
  return returnImg
end

-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens [EMAIL PROTECTED]
Verzonden: vrijdag 14 april 2006 14:49
Aan: 'Lingo programming discussion list'
Onderwerp: RE: <lingo-l> popart

Hi Alex,

Damn, 8 bit, that's it!
I forgot about that, my mask was grayscale, but not 8 bit....

Chris.

-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Alex da Franca
Verzonden: vrijdag 14 april 2006 13:28
Aan: Lingo programming discussion list
Onderwerp: Re: <lingo-l> popart


Am 14.04.2006 um 12:42 schrieb <[EMAIL PROTECTED]>  
<[EMAIL PROTECTED]>:

> Hi,
>
> I’m trying to do this pop-art effect thing… sof ar i’ve got it  
> working up to the point that is makes a bunch of squares.
> I’m using copypixels with a source rect of 1 pixel and a larger  
> destination, spaced at a regular interval…
> This is fine and dandy, but I’d like to do an assortiment of shapes  
> in stead… I’m thinking a dynamically generated copypixels mask, but  
> my image keeps turning up black…


make sure that the mask is 8-bit grayscale.

if I understood correctly you want something like:



shape = member("8bitshape").image.duplicate()
img = member("sourceImage").image.duplicate()

new(#bitmap).image = createPopArt(img, shape)


---------------------------------
on createPopArt img, shape

   r = shape.rect
   p = point(r.width/2, r.height/2)
   hoffs = point(r.width, 0)
   w = (img.width / r.width) + 1
   h = (img.height / r.height) + 1
   i = image(r.width, r.height, 32, 0)
   returnImg = image(img.width, img.height, 32, 0)

   repeat with n = 1 to h
     repeat with m = 1 to w
       i.fill(i.rect, img.getPixel(p))
       p = p + hoffs
       returnImg.copyPixels(i, r, i.rect, [#maskImage:shape])
       r = r.offset(r.width, 0)
     end repeat
     p = point(r.width/2, p[2] + r.height)
     r = r.offset(r.left * -1, r.height)
   end repeat

   return returnImg
end
---------------------------------




---------------------------

   |||
a¿ex



[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]


[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]


[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to