Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inoook/UnityFlashBitmap
Unityのtextureをflashのbitmapっぽく使う。
https://github.com/inoook/UnityFlashBitmap
Last synced: 3 months ago
JSON representation
Unityのtextureをflashのbitmapっぽく使う。
- Host: GitHub
- URL: https://github.com/inoook/UnityFlashBitmap
- Owner: inoook
- Created: 2015-04-28T07:47:29.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-01T03:31:00.000Z (over 9 years ago)
- Last Synced: 2024-08-03T19:09:52.074Z (6 months ago)
- Language: C#
- Homepage:
- Size: 434 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-unity-open-source-on-github - UnityFlashBitmap - Like flash bitmap (Script Utility)
README
# UnityFlashBitmap
Unityのtextureをflashのbitmapっぽく使う。~~~cs
Texture2D texture; // unity textureBitmapData srcBmp = new BitmapData();
srcBmp.SetTexture2D(texture);// fillRect
srcBmp.fillRect(new Rectangle(0,0,10,10), Color.green);// MatrixFilter
MatrixFilter grayScaleFilter = new MatrixFilter(new float[]{
0.298912f, 0.586611f, 0.114478f, 0, 0,
0.298912f, 0.586611f, 0.114478f, 0 ,0,
0.298912f, 0.586611f, 0.114478f, 0 ,0,
0 , 0, 0, 1, 0
});
distBmp.applyFilter(srcBmp, new Rectangle(0, 0, srcBmp.width, srcBmp.height), null, grayScaleFilter);
distBmp.unlock();// apply texture2D// ConvolutionFilter - edge
int[] matrix = new int[]{-1, -1, -1, -1, 8, -1, -1, -1, -1}; // フィルタカーネル
int divisor = 1;
int bias = 0;
ConvolutionFilter convolutionFilter = new ConvolutionFilter(matrix, divisor, bias);
distBmp.applyFilter(srcBmp, new Rectangle(0, 0, srcBmp.width, srcBmp.height), new Point(0, 0), convolutionFilter);
distBmp.unlock();// apply texture2D
~~~