Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Scriptzorz
Official Adobe Photoshop 5.0 Studio Techniques
Select From DropDown List
Dragging multiple sprites
CatFade
ADOXtra Lite
All purpose status bar
Pulse Blend a Sprite
Set Quality of a Flash Sprite
Rotate Click-Alphamania
MediaMacros Xtras Mall
 

 

 

Behavior Copy matching Pixels

Added on 11/20/2000

 

Compatibilities:
behavior D8 Mac PC Shockwave

Rating:

Author: HasanKazmi (website)

Progressive Copy Of All matching Pixels Of specified color in one image to another Attach to any bitmap Sprite (Source Image), when clicked upon a certain point on the sprite all the pixels of the same color will be copied into another image. The size of the bitmap to which pix are being copied should be lagrer than or equal to the source. There is only one parameter in the behaviour... just fill in the Destination bitmap member number. Place both the images on stage and click on any point on the source bitmap sprite....No unnecessary checking and other code has been added for simplicity.

Download PC Source    Download Mac Source
--786

--Behaviour: Copy matching Pix
--Use: Progressive Copy Of All matching Pixels Of specified color in one image to another
--Programmer: Hasan Yasar Kazmi
-- Hamdard University Islamabad Pakistan.
-- dir@37.com
--14/Nov/2000.
--Instructions:

--Attach to any bitmap Sprite (Source Image), when clicked upon a certain point on the sprite all the pixels of the same color
--will be copied into another image. The size of the bitmap to which pix are being copied should be lagrer than the source
--. There is only one parameter field in the behaviour... just fill in the Destination bitmap member number.
--place both the images on stage and click on any point on the source bitmap sprite....
-- No unnecessary checking and other code has been added for simplicity.

--Code:

property spritenum, memref,copymem
on getPropertyDescriptionList
  set description = [:]
  addProp description, #copymem, [#default:1,#format:#integer,#comment:"Select Bitmap Member to Copy image to:"]
  return description
end

on beginsprite me
  spritenum = the spritenum of me
  memref = sprite(spritenum).membernum
end  

on mouseup me
put "0" into member("status")
  set mempt=  mapStageToMember(sprite (spritenum), the mouseloc)
  ImageCopy = member(memref).image.duplicate()
  ColRef=member(memref).image.getPixel(mempt)
  repeat with i = 0 to member(memref).height
    repeat with k = 0 to member(memref).width
      if ImageCopy.getPixel(k, i) = ColRef  then
        set pixcol = ImageCopy.getPixel(k, i)
        member(copymem).image.setPixel(k, i, pixcol)
        member("status").text = string(value(member("status").text) + 1)
        updatestage
      end if
    end repeat
  end repeat
  
end -- End of Code

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail