-2

I am in this situation where I need to select a Flex type (image placeholder/image type/image container) for passing parameters in/out of different functions in an image editor. And, those different functions are either another image-manipulation/processing function or a function that display/render the image in a display component.

For example, I will ask other teammates to create a function that processes an image (possibly piped from other image processing functions, too), (let it be fancy or basic image processing from changing colors, to scaling, to segmentation, etc.).

Which of the two would you pick for passing in/out different functions? Display Object or bitmapData, and why (reusability, performance, standard practice, etc.)?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Gary Tsui
  • 1,755
  • 14
  • 18
  • I voted to close. I really don't understand what you're after. The arguments you use to a function would depend on what the function is going to do. – JeffryHouser Jul 22 '11 at 12:02
  • as i told you, its going to be either for display or image processing. you can ask me for more details but i dont get what you dont understand – Gary Tsui Jul 22 '11 at 13:29
  • Well, it looks like others are attempting to help; so they must understand something I don't. – JeffryHouser Jul 22 '11 at 14:01

2 Answers2

0

BitmapData. What would be the motivation for passing a DisplayObject ? You have to look at the functionality provided by the two classes and decide based on your tasks which one is appropriate.

Black Dynamite
  • 4,067
  • 5
  • 40
  • 75
  • as i stated, its going to be for display or image processing. – Gary Tsui Jul 22 '11 at 13:30
  • @Gary Tsui, No, the point was to look at the API's of both and see which ones suite your needs. A Bitmapdata object can be used for both purposes as it provides the ability to manipulate the raw pixels and can be wrapped in a number of classes should you be required to put it in a UI. – Black Dynamite Jul 22 '11 at 15:15
  • I looked. That's why I asked to see if there are circumstances that you prefer one than the other – Gary Tsui Jul 22 '11 at 16:16
0

I always use the lowest level object I can get away with, so I'd probably go with BitmapData, unless there are compelling reasons to do otherwise. This has the advantage that you can then reuse the code in Flash if you need to.

Amy Blankenship
  • 6,485
  • 2
  • 22
  • 45
  • DisplayObject is a Flash class, and the code would b equally reusable in a non-Flex app. Since BitMapData and DisplayObject are in different branches of the inheritance hierarchy; I'm not sure how to quantify which one is the lowest level. They aren't substititues for each other. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6 . http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html – JeffryHouser Jul 22 '11 at 13:59
  • I sort of assumed that they meant something like a FlexSprite, but since they did say "Flex's DisplayObject and "Flex's BitmapData" your interpretation is probably correct. – Amy Blankenship Jul 25 '11 at 14:29