Re: Need help with DLANGUI

2015-03-24 Thread Rikki Cattermole via Digitalmars-d-learn

On 25/03/2015 2:31 a.m., Eric wrote:




BTW, why do you need FreeImage to create image? Isn't it just possible
inside dlangui?


This is basically my question. Is there a drawing engine that
can draw lines, circles, and shapes as well as single pixels?

-Eric



If you have some way to draw you might be interested in my LineGraph[0]. 
It only handles getting coordinates to draw by. But I don't see why 
shapes couldn't be added.


[0] 
https://github.com/Devisualization/util/blob/master/source/core/devisualization/util/core/linegraph.d


Re: Need help with DLANGUI

2015-03-24 Thread Eric via Digitalmars-d-learn




BTW, why do you need FreeImage to create image? Isn't it just 
possible inside dlangui?


This is basically my question. Is there a drawing engine that
can draw lines, circles, and shapes as well as single pixels?

-Eric


Re: How to connect asynchronously (non block) with kqueue?

2015-03-24 Thread Etienne via Digitalmars-d-learn

On 3/24/2015 5:50 AM, zhmt wrote:

I am using kqueue on macosx, I know how to write a simple server. But
don't know which event will be triggered in kqueue when connected
successfully , which event when failed?

EVFILT_READ or EVFILT_WRITE?

I have googled this question, got no examples, any suggestions are
welcome, Thanks.


Look into libasync for an abstraction to kqueue

https://github.com/etcimon/libasync

Also, this is what you're looking for:

https://github.com/etcimon/libasync/blob/628850e8a6020298612e8a35229f5539d7385bae/source/libasync/posix.d#L1826


Re: How to connect asynchronously (non block) with kqueue?

2015-03-24 Thread zhmt via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 12:25:14 UTC, Etienne wrote:

On 3/24/2015 5:50 AM, zhmt wrote:
I am using kqueue on macosx, I know how to write a simple 
server. But
don't know which event will be triggered in kqueue when 
connected

successfully , which event when failed?

EVFILT_READ or EVFILT_WRITE?

I have googled this question, got no examples, any suggestions 
are

welcome, Thanks.


Look into libasync for an abstraction to kqueue

https://github.com/etcimon/libasync

Also, this is what you're looking for:

https://github.com/etcimon/libasync/blob/628850e8a6020298612e8a35229f5539d7385bae/source/libasync/posix.d#L1826


This is exacatly what I am looking for, very good! Thanks!


How to connect asynchronously (non block) with kqueue?

2015-03-24 Thread zhmt via Digitalmars-d-learn
I am using kqueue on macosx, I know how to write a simple server. 
But don't know which event will be triggered in kqueue when 
connected successfully , which event when failed?


EVFILT_READ or EVFILT_WRITE?

I have googled this question, got no examples, any suggestions 
are welcome, Thanks.


Re: D's type classes pattern ?

2015-03-24 Thread anonymous via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 16:56:13 UTC, matovitch wrote:

Thanks, just to be clear :

void Bar(T : Foo)(T t){
}

is the same as

void Bar(T)(T t) if (is(T == Foo)){
}

and it is checked only at compile time ? (for the runtime I 
know that what interface were meant for ;)).


Ali already mentioned the difference between == and :.

In addition to that, template specializations (like `Bar(T : 
Foo)(T t)`) and template constraints (like `Bar(T)(T t) if(is(T : 
Foo))`) are similar but generally not interchangeable.


A template with a specialization is considered a better match 
than one without. Whereas a template constraint doesn't add to 
the quality of the match.


An example:

module test;
import std.stdio;

void f(T)(T t) {writeln(generic);}
void f(T : int)(T t) {writeln(with specialization);}
void f(T)(T t) if(is(T : Object)) {writeln(with constraint);}

void main()
{
f(some string); /* - generic */
f(42); /* - with specialization */
version(none) f(new Object); /* Doesn't compile, because it 
matches both the generic version and the one with the constraint. 
*/

}


Re: D's type classes pattern ?

2015-03-24 Thread Ali Çehreli via Digitalmars-d-learn

On 03/24/2015 08:50 AM, matovitch wrote:

 Lets say I want to implement some generic algorithm. I would like
 to checks the types passed to my algorithm implements a specific
 interface.

I think you are looking for template constraints. Look at isInputRange's 
implementation:



https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L143

Then you can do:

void foo(Range)(Range range)
   if (isInputRange!Range)// --
{
// ...
}

I have some explanation and examples here:


http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.named%20template%20constraint

Ali



Re: D's type classes pattern ?

2015-03-24 Thread Ali Çehreli via Digitalmars-d-learn

On 03/24/2015 09:56 AM, matovitch wrote:

 just to be clear :

 void Bar(T : Foo)(T t){
 }

That means if T can implicitly be converted to Foo.


 is the same as

 void Bar(T)(T t) if (is(T == Foo)){
 }

That means if T is exactly Foo.

 and it is checked only at compile time ?

Yes to both.

Ali



BigInt and xor

2015-03-24 Thread Dennis Ritchie via Digitalmars-d-learn

Tell me, please, how can I replace this code?

import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;

void main() {

BigInt[10] bitArr;

ulong n = 18_446_724_073_709_551_614U;

bitArr[0] = format(%b, n).to!BigInt;

writeln(bitArr[0]);
writeln(bitArr[0] ^ 1); // not work

}

Output:
11101101110001100011000110101010
11101101110001100011000110101011


D's type classes pattern ?

2015-03-24 Thread matovitch via Digitalmars-d-learn

Hi,

It's been a long time since I coded some d code... sorry I take
the lazy way asking for advices. :D

Lets say I want to implement some generic algorithm. I would like
to checks the types passed to my algorithm implements a specific
interface.

interface IStuff(Stuff)
{
 void foo();
}

class TypeClass(T, I) : I(T)
{
 alias this T;
}

void myAwesomeAlgo(Stuff) (TypeClass!(Stuff, IStuff) stuff)
{
 stuff.foo();
}


Well it seems that I have worked out my question in trying to
formulate it...Would something like this work ?


how call a c function with stdcall?

2015-03-24 Thread mzfhhhh via Digitalmars-d-learn

for example:use vc compile on x86
func.c:
__declspec(dllexport) int _stdcall sub(int a,int b)
{
return a-b;
}

func.def:

LIBRARY
EXPORTS
sub

-
i use implib.exe to create a omf format lib.

D code:
import std.exception;

//this is a cdecl call
extern(C) int sub(int a,int b);

void main()
{
auto c1 = sub(2,1);

//when this line run,the c1 value is broken
auto c2 = enforceEx!Exception(sub(1,2));
}
--
my question is how write D code to call the c function


Re: D's type classes pattern ?

2015-03-24 Thread matovitch via Digitalmars-d-learn

More like :

import std.stdio;

interface IStuff(Stuff)
{
 void foo();
}

class TypeClass(T, I) : I(T)
{
 alias this stuff;
 T stuff;
}

void myAwesomeAlgo(Stuff) (TypeClass!(Stuff, IStuff) stuff)
{
 stuff.foo();
}

struct MyStuff
{
void foo()
{
writeln(Hello World !);
}
}

void main()
{
alias TypeStuff = TypeClass!(MyStuff, IStuff);
TypeStuff stuff;
myAwesomeAlgo(stuff);
}

Doesn't compile btw :

kmeans.d(8): Error: members expected
kmeans.d(8): Error: { } expected following aggregate declaration
kmeans.d(8): Error: Declaration expected, not '('
kmeans.d(12): Error: unrecognized declaration


Re: D's type classes pattern ?

2015-03-24 Thread matovitch via Digitalmars-d-learn
Well, just follow that link to the code...it almost compile : 
http://dpaste.com/3JNP0QD.


Re: how call a c function with stdcall?

2015-03-24 Thread mzfhhhh via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 15:26:22 UTC, Adam D. Ruppe wrote:

try extern(Windows) isntead of extern(C).


use extern(Windows) or extern(System)

the compile show the link error:
Error 42: Symbol Undefined _sub@8


dll export func name is sub,
and the dll is 3rd party,i can't change the dll code.

i use implib.exe /system func.lib func.dll to create a func.lib.

how can i link correctly?


Re: how call a c function with stdcall?

2015-03-24 Thread Adam D. Ruppe via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 00:09:33 UTC, mzf wrote:
i use implib.exe /system func.lib func.dll to create a 
func.lib.


You might also need to specify the .def file as the final 
argument to that.


http://digitalmars.com/ctg/implib.html

The def file can list aliases for the functions. Maybe try it 
without the /system flag too. I know there's a way but I don't 
know exactly what, I just tend to guess and check a little...


Re: Is there websocket client implementation for D

2015-03-24 Thread Rikki Cattermole via Digitalmars-d-learn

On 25/03/2015 6:55 a.m., Ilya Korobitsyn wrote:

Hello!

Is there any websocket client implementation in D?
I know there is WS server as a part of vibe.d, but it does not seem to
include client.
Maybe there are some library bindings that I've missed?

Thank you,
Ilya


It appears you are on your own.


Re: how call a c function with stdcall?

2015-03-24 Thread mzfhhhh via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 00:26:21 UTC, Adam D. Ruppe wrote:

On Wednesday, 25 March 2015 at 00:09:33 UTC, mzf wrote:
i use implib.exe /system func.lib func.dll to create a 
func.lib.


You might also need to specify the .def file as the final 
argument to that.


http://digitalmars.com/ctg/implib.html

The def file can list aliases for the functions. Maybe try it 
without the /system flag too. I know there's a way but I don't 
know exactly what, I just tend to guess and check a little...


1.def file:
  LIBRARY func

  EXPORTS
  _sub@8 = sub

2.create lib
  implib.exe func.lib func.def

-
now it works fine,thanks!


Re: D's type classes pattern ?

2015-03-24 Thread matovitch via Digitalmars-d-learn
Wait no ! In that case my type will have to inherit the 
interface...I don't want that, checking without inheriting...I 
know thats weird.


Re: [Dscanner] Textadept integration

2015-03-24 Thread Chris via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 16:54:47 UTC, Chris wrote:
I tried to use Dscanner with Textadpet, but it doesn't work. I 
created the directory modules/dmd and copied the init.lua file 
from here [1] into it. What am I doing wrong, or is it an old 
version that is no longer supported?


[1] https://bitbucket.org/SirAlaran/ta-d/


The message:

...ment/Textadept/textadept_7.9.x86_64/modules/dmd/init.lua:28: 
module 'common.cstyle' not found [snip]


Re: D's type classes pattern ?

2015-03-24 Thread matovitch via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 16:44:54 UTC, weaselcat wrote:

On Tuesday, 24 March 2015 at 15:51:00 UTC, matovitch wrote:

Hi,

It's been a long time since I coded some d code... sorry I take
the lazy way asking for advices. :D

Lets say I want to implement some generic algorithm. I would 
like
to checks the types passed to my algorithm implements a 
specific

interface.

interface IStuff(Stuff)
{
void foo();
}

class TypeClass(T, I) : I(T)
{
alias this T;
}

void myAwesomeAlgo(Stuff) (TypeClass!(Stuff, IStuff) stuff)
{
stuff.foo();
}


Well it seems that I have worked out my question in trying to
formulate it...Would something like this work ?


interface Foo{
}
void Bar(T : Foo)(T t){
}

but interfaces enable runtime polymorphism, you can just accept 
the interface itself

void Fun(Foo foo){
}



Thanks, just to be clear :

void Bar(T : Foo)(T t){
}

is the same as

void Bar(T)(T t) if (is(T == Foo)){
}

and it is checked only at compile time ? (for the runtime I know 
that what interface were meant for ;)).





Is there websocket client implementation for D

2015-03-24 Thread Ilya Korobitsyn via Digitalmars-d-learn

Hello!

Is there any websocket client implementation in D?
I know there is WS server as a part of vibe.d, but it does not 
seem to include client.

Maybe there are some library bindings that I've missed?

Thank you,
Ilya


Re: BigInt and xor

2015-03-24 Thread Dennis Ritchie via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 17:35:14 UTC, matovitch wrote:
xor it with -1 instead of 1. (-1 is store as 0xfff..f with the 
classic modular arithmetic)


Thanks.


Re: BigInt and xor

2015-03-24 Thread matovitch via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 15:45:36 UTC, Dennis Ritchie wrote:

Tell me, please, how can I replace this code?

import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;

void main() {

BigInt[10] bitArr;

ulong n = 18_446_724_073_709_551_614U;

bitArr[0] = format(%b, n).to!BigInt;

writeln(bitArr[0]);
writeln(bitArr[0] ^ 1); // not work

}

Output:
11101101110001100011000110101010
11101101110001100011000110101011


Hi,

Well it works, the las bit is flip isn't it ? What are you trying 
to achieve ?


Re: BigInt and xor

2015-03-24 Thread Dennis Ritchie via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 16:35:04 UTC, Ivan Kazmenko wrote:

What exactly is not working?


Everything works. I'm just a little forgotten properties of the 
operation xor.


I just wanted to xor 1 each digit in the number of type BigInt, 
while I would like to store each number in the binary 
representation of the array BigInt.


The only thing I see lacking is an ability to print a BigInt in 
binary via writefln(%b).


Yes. It would be nice.

Up to 64 bits, arithmetic and bitwise operations, including 
xor, are available with long and ulong. Just print the result 
as binary:


-
import std.stdio;
void main() {
ulong n = ulong.max - 0b1000101;
writeln (n);
writefln (%b, n);
writefln (%b, n ^ 1);
}
-
Output:
-
18446744073709551546
10111010
10111011
-


If you need more than 64 bits, take a look at BitArray here, it 
also has xor defined:

http://dlang.org/phobos/std_bitmanip.html#.BitArray


Thanks.

In the future, please explain what problem you are trying to 
solve, as the wrong code alone often leaves one guessing.


OK, I will try.


Re: BigInt and xor

2015-03-24 Thread Ivan Kazmenko via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 15:45:36 UTC, Dennis Ritchie wrote:

Tell me, please, how can I replace this code?

import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;

void main() {

BigInt[10] bitArr;

ulong n = 18_446_724_073_709_551_614U;

bitArr[0] = format(%b, n).to!BigInt;

writeln(bitArr[0]);
writeln(bitArr[0] ^ 1); // not work

}

Output:
11101101110001100011000110101010
11101101110001100011000110101011


What exactly is not working?
The only thing I see lacking is an ability to print a BigInt in 
binary via writefln(%b).


Up to 64 bits, arithmetic and bitwise operations, including xor, 
are available with long and ulong.  Just print the result as 
binary:


-
import std.stdio;
void main() {
ulong n = ulong.max - 0b1000101;
writeln (n);
writefln (%b, n);
writefln (%b, n ^ 1);
}
-
Output:
-
18446744073709551546
10111010
10111011
-

If you need more than 64 bits, take a look at BitArray here, it 
also has xor defined:

http://dlang.org/phobos/std_bitmanip.html#.BitArray

In the future, please explain what problem you are trying to 
solve, as the wrong code alone often leaves one guessing.


Ivan Kazmenko.


Re: D's type classes pattern ?

2015-03-24 Thread matovitch via Digitalmars-d-learn
To resume my goal (last lonely message I promise), how can you 
statically check a type implement an interface without making 
this type inherit the interface (otherwise std.traits would do 
it) ?


ps : it seems to me that this is exactly what the haskell 
compiler do with type classes - layman opinion


Re: BigInt and xor

2015-03-24 Thread Rene Zwanenburg via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 15:45:36 UTC, Dennis Ritchie wrote:

Tell me, please, how can I replace this code?

import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;

void main() {

BigInt[10] bitArr;

ulong n = 18_446_724_073_709_551_614U;

bitArr[0] = format(%b, n).to!BigInt;

writeln(bitArr[0]);
writeln(bitArr[0] ^ 1); // not work

}

Output:
11101101110001100011000110101010
11101101110001100011000110101011


Looks right to me. What output would you expect?

Also, if you need a bit array you can simply use std.container's 
Array!bool. It's specialized for bool and uses only one bit per 
element.


Re: D's type classes pattern ?

2015-03-24 Thread matovitch via Digitalmars-d-learn

well, alias this is the issue here.

interface I
{
void foo();
}

struct S
{
void foo() {}
}

class C : I
{
S s;
alias this s;
}

don't compile...if you have any idea to do otherwise I am greatly 
interested. Thanks !


Re: std.typecons.Flag -- public import for API users?

2015-03-24 Thread Rene Zwanenburg via Digitalmars-d-learn

On Saturday, 21 March 2015 at 23:16:39 UTC, rcorre wrote:
If I am developing a library and some of my functinos take a 
std.typecons.Flag as an argument, should I 'public import 
std.typecons: Flag, Yes, No'?


It seems like it would be a pain for users of the library to 
have to import this separately whenever they use my library, 
but I'm not sure what the stance is on having your modules 
`public import` standard-library modules.


In general, is it considered bad form to 'public import' 
modules from phobos?


Should not be necessary. privately import Flag and make a public 
alias:


module a;
import std.typecons : Flag;

alias SomeFlag = Flag!SomeFlag;

SomeFlag.Yes and SomeFlag.No should be usable in other modules 
without additional imports.


Re: D's type classes pattern ?

2015-03-24 Thread weaselcat via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 15:51:00 UTC, matovitch wrote:

Hi,

It's been a long time since I coded some d code... sorry I take
the lazy way asking for advices. :D

Lets say I want to implement some generic algorithm. I would 
like

to checks the types passed to my algorithm implements a specific
interface.

interface IStuff(Stuff)
{
 void foo();
}

class TypeClass(T, I) : I(T)
{
 alias this T;
}

void myAwesomeAlgo(Stuff) (TypeClass!(Stuff, IStuff) stuff)
{
 stuff.foo();
}


Well it seems that I have worked out my question in trying to
formulate it...Would something like this work ?


interface Foo{
}
void Bar(T : Foo)(T t){
}

but interfaces enable runtime polymorphism, you can just accept 
the interface itself

void Fun(Foo foo){
}


Problem overloading operator for a struct with an immutable member

2015-03-24 Thread Nicolas Sicard via Digitalmars-d-learn
I don't know if this is a bug or expected behaviour. The struct 
is mutable, assignable and pre-increment operator works. But 
post-increment doesn't compile because of the immutable member.


--
struct S
{
int i;
immutable(Object) o;

S opUnary(string op)() { return this; }
void opAssign(S other) {}
}

void main()
{
S s, t;

t = s; // OK
++s; // OK
s++; // Error: cannot modify struct s S with immutable members
}
---


[Dscanner] Textadept integration

2015-03-24 Thread Chris via Digitalmars-d-learn
I tried to use Dscanner with Textadpet, but it doesn't work. I 
created the directory modules/dmd and copied the init.lua file 
from here [1] into it. What am I doing wrong, or is it an old 
version that is no longer supported?


[1] https://bitbucket.org/SirAlaran/ta-d/


Re: Need help with DLANGUI

2015-03-24 Thread Vadim Lopatin via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 13:31:06 UTC, Eric wrote:




BTW, why do you need FreeImage to create image? Isn't it just 
possible inside dlangui?


This is basically my question. Is there a drawing engine that
can draw lines, circles, and shapes as well as single pixels?

-Eric


Hello,

I've implemented CanvasWidget today as convenient way of custom 
drawing, and added drawPixel and drawLine methods to DrawBuf.


See example1 / Canvas tab.

Sample code:

CanvasWidget canvas = new CanvasWidget(canvas);
canvas.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
	canvas.onDrawListener = delegate(CanvasWidget canvas, DrawBuf 
buf, Rect rc) {

buf.fill(0xFF);
int x = rc.left;
int y = rc.top;
buf.fillRect(Rect(x+20, y+20, x+150, y+200), 0x80FF80);
buf.fillRect(Rect(x+90, y+80, x+250, y+250), 0x80FF80FF);
		canvas.font.drawText(buf, x + 40, y + 50, fillRect()d, 
0xC080C0);
		buf.drawFrame(Rect(x + 400, y + 30, x + 550, y + 150), 
0x204060, Rect(2,3,4,5), 0x80704020);
		canvas.font.drawText(buf, x + 400, y + 5, drawFrame()d, 
0x208020);
		canvas.font.drawText(buf, x + 300, y + 100, drawPixel()d, 
0x80);

for (int i = 0; i  80; i++)
			buf.drawPixel(x+300 + i * 4, y+140 + i * 3 % 100, 0xFF + i 
* 2);
		canvas.font.drawText(buf, x + 200, y + 250, drawLine()d, 
0x800020);

for (int i = 0; i  40; i+=3)
			buf.drawLine(Point(x+200 + i * 4, y+290), Point(x+150 + i * 7, 
y+420 + i * 2), 0x008000 + i * 5);

};


Re: using vibe.d to parse json

2015-03-24 Thread Rikki Cattermole via Digitalmars-d-learn

On 24/03/2015 6:36 p.m., Laeeth Isharc wrote:

On Tuesday, 24 March 2015 at 04:53:39 UTC, Laeeth Isharc wrote:

Hi.

struct RawGoogleResults
{
string version_;
string status;
string sig;
string[string][][string] table;
}

enum json =
{version:0.6,status:ok,sig:717451517,table:{cols:[{id:date,label:Date,type:date,pattern:},{id:query0,label:euro
crisis,type:number,pattern:}],rows:[{c:[{v:2004-01-02),f:January
2004},{v:0.0,f:0}]},{c:[{v:2004-02-02),f:February
2004},{v:0.0,f:0}]},{c:[{v:2004-03-02),f:March
2004},{v:0.0,f:0}]},{c:[{v:2004-04-02)...

auto table = deserialize!(JsonSerializer, RawGoogleResults)(json);

I cannot pass a string to deserialize (the documentation suggests an
input range should be fine):
http://vibed.org/api/vibe.data.serialization/deserialize

I have a feeling maybe deserialize doesn't do what I want, but what
should I be using instead.  (I would like to parse the json and shove
the results in the struct above).


Thanks.


Laeeth.


Okay - figured it out from the source code.

auto results = deserialize!(JsonStringSerializer!string,
RawGoogleResults)(json);

and easier to write:

struct RawGoogleResults
{
 string version_;
 string status;
 string sig;
 //Json!array[string][][string] table;
 Json table;
}


Yeah, it is not very intuitive. But it works.



Re: how call a c function with stdcall?

2015-03-24 Thread Adam D. Ruppe via Digitalmars-d-learn

try extern(Windows) isntead of extern(C).


Re: BigInt and xor

2015-03-24 Thread matovitch via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 17:28:50 UTC, Dennis Ritchie wrote:

On Tuesday, 24 March 2015 at 16:35:04 UTC, Ivan Kazmenko wrote:

What exactly is not working?


Everything works. I'm just a little forgotten properties of the 
operation xor.


I just wanted to xor 1 each digit in the number of type BigInt, 
while I would like to store each number in the binary 
representation of the array BigInt.




xor it with -1 instead of 1. (-1 is store as 0xfff..f with the 
classic modular arithmetic)


Re: Need help with DLANGUI

2015-03-24 Thread Vadim Lopatin via Digitalmars-d-learn

On Monday, 23 February 2015 at 19:41:30 UTC, Eric wrote:


I have been trying out dlanui, and I am able to create an image
with FreeImage and display it with an ImageWidget.  However this
requires that I write the image out to disk, and then load it 
again
to display it.  Is there any way I can update or create the 
image

in memory without going to disk?

Thanks,

Eric


Hello,

Sorry for delayed answer.
Is your question still actual?

You can use something like
// create RGBA drawing buffer
ColorDrawBuffer buf = new ColorDrawBuffer(width, height);
// copy pixels into buf from your custom image
// .
// put into DrawBufRef
DrawBufRef imageDrawBuf = buf;
// create image drawable
DrawableRef myCustomImageDrawable = new 
ImageDrawable(imageDrawBuf);

// set drawable of ImageWidget
imageWidget.drawable = myCustomImageDrawable;

There was code in dlangui.graphics.image which could copy 
FreeImage images to ColorDrawBuf, but in recent version it's 
removed. You can check github revision history to get proper code.


BTW, why do you need FreeImage to create image? Isn't it just 
possible inside dlangui?