Created
September 23, 2024 14:11
-
-
Save chakmeshma/fcf212004359b38806826ca68af458ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Runtime.InteropServices; | |
| using System; | |
| using UnityEngine; | |
| using System.Drawing; | |
| public class TextureSlicer : MonoBehaviour | |
| { | |
| [DllImport("DevILWrapper.dll", CallingConvention = CallingConvention.Cdecl)] | |
| public static extern IntPtr getImagedata(string filePath, out int width, out int height); | |
| void Start() | |
| { | |
| int width, height; | |
| IntPtr imageData = getImagedata("C:\\Users\\chakm\\OneDrive\\Desktop\\testb.png", out width, out height); | |
| int arraySize = (width * height * 3) + 6; | |
| byte[] managedArray = new byte[arraySize]; | |
| Marshal.Copy(imageData, managedArray, 0, arraySize); | |
| for (int i = 0; i < arraySize; i++) | |
| { | |
| Debug.Log(managedArray[i]); | |
| } | |
| } | |
| void Update() | |
| { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment