s***r 发帖数: 2604 | 1 this dose no work
here basically is the code:
Byte[w*h] barray = new byte[w*h];
Mashal.copy((intptr)(img), barray, 0,w*h);
GChandle hd = GChandle.Alloc(barray, Gchandletype.Pinned);
try
{IntPtr p = hd.AddrofPinnedObject();
Bitmap b = Bitmap.FromHbitmap(p);}
finally
{;}
the line bitmap.fromhbitmap(p), will throw an error
it |
|
s***r 发帖数: 2604 | 2 Yes, I did with following code
Byte[w*h] barray = new byte[w*h]; Mashal.copy((intptr)(img), barray, 0,w*h);
unsafe{fixed(byte* parray=barray)
{InrPtr p= new IntPtr((void* parray));
Bitmap bmp = Bitmap.FromHbitmap(p);}}
same error, on lastline give me "A generic error occured in GDI+"
Is there anything wrong with the code?
do u think the size w,h matters, cz in the run time they are 1066,782 which
is weird to me.
thank u.
在 Leyunque (Le yunque) 的大作中提到: 】 |
|
t**r 发帖数: 3428 | 3 我的代码:
很糟糕,大数据过不去
应该可以用bitmap 优化一下 今天懒得弄了
package topcoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
//B[0] = 0
//B[i] = A[B[i-1]], for every i between 1 and N-1, inclusive.
/*
* Permutation Child array
{0, 1, 2} {0, 0, 0}
{0, 2, 1} {0, 0, 0}
{1, 0, 2} {0, 1, 0}
{1, 2, 0} {0, 1, 2}
{2, 0, 1} {0, 2, 1}
{2, 1, 0} {0, 2, 0}
* */
public... 阅读全帖 |
|
s***r 发帖数: 2604 | 4 how should I get the "array" in the example code. what is the way to read it
from memory? Something like this?
short* img;
int w;
int h;
Byte[] barray = new Byte[w*h*3];
Marshal.copy(IntPtr(img), barray, 0, w*h*3);
a |
|
a*a 发帖数: 175 | 5 您老真是选择性失忆啊。svca用官方账号给Catherine baker拉票捐款,svca大多数志
愿者每周去三谷拉票,您都视而不见。svca志愿者还帮Peter Kuo,Barray Chang,
Chuck Page,您都看不见。
就一两个成员用个人名义同时支持了一下其他候选人,都没有人去帮Ro拉票,您就全记
住啦? |
|