Skip to content

inoook/UnityFlashBitmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

UnityFlashBitmap

Unityのtextureをflashのbitmapっぽく使う。

Texture2D texture; // unity texture

BitmapData 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

About

Unityのtextureをflashのbitmapっぽく使う。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy