如何在Flex中使用位图图像创建反射效果?(How can I create a reflection effect with bitmap images in Flex?)
我正在寻找一种简单,干净且节省内存的方法来创建和应用反射效果(您知道那种由着名iPhone UI推广的效果),以适应我在运行时加载到Flex应用程序中的位图图像。 源图像将具有不同类型(JPG,PNG等),但可接受的解决方案可以假定每个图像已经加载并以BitmapData存储。
我希望能够做的是对BitmapData的某些视图应用可选的反射效果,但仍然保持源BitmapData不变,因为不是所有视图都需要反射效果。 洞察非常感谢! 提前致谢。
I'm looking for a simple, clean and memory-efficient way to create and apply a reflection effect (you know the one, popularized by the famed iPhone UI) to the bitmap images I've loaded into a Flex app at runtime. The source images will be of varying types (JPGs, PNGs, etc.), but an acceptable solution can assume each image is already loaded and being stored as BitmapData.
What I'd like to be able to do is apply, optionally, a reflection effect to some views of the BitmapData, but still keep the source BitmapData intact, since not all views of it will require the reflection effect. Insights greatly appreciated! Thanks in advance.
原文:https://stackoverflow.com/questions/474103
最满意答案
C ++ 03中有许多部分不允许嵌套类的前向声明。 特别是§7.1.5.3详细的类型说明符:
如果一个详细类型说明符是一个声明的唯一组成部分,那么该声明是不健全的,除非它是一个明确的专门化(14.7.3),一个明确的实例化(14.7.2)或者它具有以下形式之一:
class-key identifier ; friend class-key ::opt identifier ; friend class-key ::opt template-id ; friend class-key ::opt nested-name-specifier identifier ; friend class-key ::opt nested-name-specifier templateopt template-id ;3.4.4描述了名称查找在标注类型说明 符中如何继续标识符 。 如果标识符解析为类名或枚举名 ,则详细类型说明符将其引入到声明中,这与简单类型说明符介绍其类型名称的方式相同 。 [...]如果名称查找没有找到该名称的声明,则详细说明类型说明符是格式错误的,除非它是简单形式的类关键 标识符,在这种情况下, 标识符是按3.3中所述进行声明的。 1。
简而言之,当一个标识符被作用域时,编译器必须尝试解析该标识符。 当范围是一个类时,编译器必须在外部类中查找该标识符的声明。 当外部类还没有被定义时,这是不能完成的,结果是一个不合格的程序。
There are a number of parts of C++03 that disallow forward declarations of nested classes. In particular, § 7.1.5.3 Elaborated type specifiers:
If an elaborated-type-specifier is the sole constituent of a declaration, the declaration is ill-formed unless it is an explicit specialization (14.7.3), an explicit instantiation (14.7.2) or it has one of the following forms:
class-key identifier ; friend class-key ::opt identifier ; friend class-key ::opt template-id ; friend class-key ::opt nested-name-specifier identifier ; friend class-key ::opt nested-name-specifier templateopt template-id ;3.4.4 describes how name lookup proceeds for the identifier in an elaborated-type-specifier. If the identifier resolves to a class-name or enum-name, the elaborated-type-specifier introduces it into the declaration the same way a simple-type-specifier introduces its type-name. [...] If name lookup does not find a declaration for the name, the elaborated-type-specifier is ill-formed unless it is of the simple form class-key identifier in which case the identifier is declared as described in 3.3.1.
In short, when an identifier is scoped, the compiler must try to resolve the identifier. When the scope is a class, the compiler must look up the declaration for the identifier in the outer class. When the outer class hasn't yet been defined, this can't be done and the result is an ill-formed program.
相关问答
更多-
C ++ 03中有许多部分不允许嵌套类的前向声明。 特别是§7.1.5.3详细的类型说明符: 如果一个详细类型说明符是一个声明的唯一组成部分,那么该声明是不健全的,除非它是一个明确的专门化(14.7.3),一个明确的实例化(14.7.2)或者它具有以下形式之一: class-key identifier ; friend class-key ::opt identifier ; friend class-key ::opt template-id ; friend class-key ::opt ne ...
-
通过#include的完成方式,编译器不会查看Link.h - 因此无法找到并生成所需的类。 With how the #includes are done, the compiler isn't looking at Link.h - so it can't find and generate the class it needs.
-
声明为friend类在friend声明的上下文中查找。 如果找到了,这个班就成了friend 。 如果没有发现这个类是在最接近的命名空间级别声明的,并且这个类是一个friend 。 friend声明不会引入嵌套的类名称。 尽管如此,它会使找到的嵌套类成为friend 。 A class declared to be friend is looked up in the context of the friend declaration. If one is found, this class is made ...
-
CoordinatorLayout.Behavior仅在目标视图(即保存app:layout_behavior="ua.miui.forum.widget.BottomBehaviour"的视图是CoordinatorLayout直接后代) app:layout_behavior="ua.miui.forum.widget.BottomBehaviour" 。 否则,它将不会收到嵌套的滚动事件。 如果您的LinearLayout是CoordinatorLayout直接子对象,请将行为添加到它,然后您应该调整 ...
-
嵌套类的范围(Scope of Nested Classes)[2022-08-13]
任何来自拥有类的“静态”都可以在您的嵌套类中使用。 如果您在内部类的某些方法中拥有拥有类的实例,那么您也可以访问其私有成员。 Anything "static" from the owning class is available in your nested class. If you have an instance of the owning class in some method of the inner class, you may also access its private members ... -
Java中的静态嵌套类(Static nested classes in Java)[2022-06-01]
您不直接访问实例成员。 staticMember访问非实例成员,并且nested.member通过对象引用访问一个成员。 You aren't accessing instance members directly. staticMember is accessing a non-instance member, and nested.member is accessing one through an object reference. -
嵌套类C ++中的友谊(Friendship in nested classes C++)[2022-12-22]
如果要在innerClass之外定义innerClass ,请按以下步骤操作: class outerClass { class innerClass; // forward declaration }; class outerClass::innerClass // definition { }; 其余的obj.b=5 ,除了obj.b=5 。 允许类outerClass访问innerClass::b ,而main()函数不允许。 演示 默认情况下,innerClass可以访问outerCla ... -
...大小将是OuterClass实例中的同一个对象(我不想这样)。 只要size是NestedClass的类成员,它只存在一次。 这是因为只有一个类NestedClass ,而size是该类的成员。 如果你想为每个实例都有一个size成员,那么,这就是实例成员的用途...... ... the size will be the same object among OuterClass instances (I don't want this). As long as size is a class-mem ...
-
在类主体完成执行之前,您不能使用A 你可以参考'本地'名称; 类主体作为函数执行,该函数的本地名称空间用于提供类属性; 在类体内, B是本地名称: class A(object): class B(object): pass class C(B): pass You cannot use A until the class body has finished executing. You can refer to 'local' names; the class body is execu ...
-
为什么要使用嵌套类?(Why would one use nested classes?)[2022-02-09]
你会为Namespacing做到这一点。 这样,您可以使用具有相同名称的类(如DataGenerator )。 但出于不同的目的。 这个是DataImporter.DataGenerator类,但你可以有另一个OtherClass.DataGenerator类,它将是一个完全不同的类。 就像在Objective-C中一样,当你在课程名称之前有2或3个字母时(例如: UIView )。 但是当你创建自己的时候,就像SSView一样 您也可以将内部类声明为private,并在该文件中使用它。 You would ...