8款很实用的Actionscript写的位图(BitMap)操作类

AS3 Scale9 Bitmap


AS3 Scale9 Bitmap is helper class that lets you create scale9 sprites with bitmap data fill – originally this was not possible in Flash 9. The helper class creates a "fake" scale 9 sprite containing 9 shapes that scale according to user-defined scaling matrix. Extremely useful for user interface work (creating buttons, scalable UI elements etc.).

 

AS3 bitmap mosaic class

 


This class will allow you to create a pixellated copy of any display object. It allows for varying pixel sizes and caching of rendered pixels so you don’t have to redraw them every time.

 

Active Window Blur

 


It has detail code and examples show how the class works.

 

Animated Bitmap Class

 


The AnimatedBitmap class provides functionality for Bitmap objects that are animated by using a series of still images. When creating a new AnimatedBitmap you provide a BitmapData object that contains an image that consists of the ’single-frame’ images for the animation.

 

CollisionDetection Class

 


CollisionDetection class is really simple to work with, there is a single static method called checkForCollision with four parameters. movieClip1, movieClip2 – The MovieClip instances to check for collision. alphaTolerance – a number from 0 to 255 that specifies the transparency tolerance when testing the collision. A higher number will increase the tolerance (ie. allow more transparent parts of the MovieClip to register collisions). Defaults to 255.

 

DistortImage Class

 


It is an updated version of the original DistortImage class for AS2, which allows you to programmatically distort images.

 

ImageLoader

 


ImageLoader is a straightforward image loader. It simplifies the job of loading images by automatically creating a list of images being loaded, controlling its queue with priority features (by way of the LoadingQueue class), and by caching images locally using BitmapDatainstances. This means that when you try to load a new image, it actually loads the image, saves its BitmapData, and attaches the image to the container (with smooth turned on by default).

 

Reflection class

 


It is a simple class for creating a reflection below any type of displayObject in AS3.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在 C++ 中接收并显示 Android 上的 Bitmap,您可以使用 Android 提供的 Bitmap 工具来完成此操作。以下是一些基本步骤: 1.在 Java 中将 Bitmap 转换为 byte 数组,然后将其传递给 C++ 函数。 ```java Bitmap bitmap = ...; // 获取 Bitmap int bytes = bitmap.getByteCount(); ByteBuffer buffer = ByteBuffer.allocate(bytes); bitmap.copyPixelsToBuffer(buffer); byte[] byteArray = buffer.array(); nativeFunction(byteArray, bitmap.getWidth(), bitmap.getHeight()); ``` 2.在 C++ 中,您需要使用 JNI 将传递的字节数组转换回 Bitmap。您可以使用 Android 提供的 Bitmap 工具来完成此操作。以下是一个示例: ```c++ extern "C" JNIEXPORT void JNICALL Java_com_example_myapp_NativeBridge_nativeFunction(JNIEnv *env, jobject thiz, jbyteArray byteArray, jint width, jint height) { jbyte *data = env->GetByteArrayElements(byteArray, nullptr); if (data == nullptr) { return; } jclass bitmapConfigClass = env->FindClass("android/graphics/Bitmap$Config"); jmethodID bitmapConfigMethod = env->GetStaticMethodID(bitmapConfigClass, "valueOf", "(Ljava/lang/String;)Landroid/graphics/Bitmap$Config;"); jstring bitmapConfigName = env->NewStringUTF("ARGB_8888"); jobject bitmapConfig = env->CallStaticObjectMethod(bitmapConfigClass, bitmapConfigMethod, bitmapConfigName); jclass bitmapClass = env->FindClass("android/graphics/Bitmap"); jmethodID createBitmapMethod = env->GetStaticMethodID(bitmapClass, "createBitmap", "([BIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;"); jbyteArray byteArray = env->NewByteArray(bytes); env->SetByteArrayRegion(byteArray, 0, bytes, data); jobject bitmap = env->CallStaticObjectMethod(bitmapClass, createBitmapMethod, byteArray, width, height, bitmapConfig); env->DeleteLocalRef(bitmapConfigName); env->DeleteLocalRef(byteArray); env->ReleaseByteArrayElements(byteArray, data, JNI_ABORT); // 将 Bitmap 显示到屏幕上 ... } ``` 在这里,我们使用了 JNI 中的一些重要函数(例如 `env->FindClass`、`env->GetStaticMethodID`、`env->CallStaticObjectMethod` 等)来找到并调用 Android 提供的 Bitmap 工具中的方法。我们创建了一个新的 Bitmap,并将其显示到屏幕上。 请注意,这只是一个基本示例,您需要根据自己的需求进行修改和优化。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值