首页 \ 问答 \ 如何在Flex中使用位图图像创建反射效果?(How can I create a reflection effect with bitmap images in Flex?)

如何在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
更新时间:2023-09-25 10:09

最满意答案

C ++ 03中有许多部分不允许嵌套类的前向声明。 特别是§7.1.5.3详细的类型说明符:

  1. 如果一个详细类型说明符是一个声明的唯一组成部分,那么该声明是不健全的,除非它是一个明确的专门化(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 ;
    
  2. 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:

  1. 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 ;
    
  2. 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直接子对象,请将行为添加到它,然后您应该调整 ...
  • 任何来自拥有类的“静态”都可以在您的嵌套类中使用。 如果您在内部类的某些方法中拥有拥有类的实例,那么您也可以访问其私有成员。 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 ...
  • 您不直接访问实例成员。 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.
  • 如果要在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 ...
  • 你会为Namespacing做到这一点。 这样,您可以使用具有相同名称的类(如DataGenerator )。 但出于不同的目的。 这个是DataImporter.DataGenerator类,但你可以有另一个OtherClass.DataGenerator类,它将是一个完全不同的类。 就像在Objective-C中一样,当你在课程名称之前有2或3个字母时(例如: UIView )。 但是当你创建自己的时候,就像SSView一样 您也可以将内部类声明为private,并在该文件中使用它。 You would ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。