help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] c callouts and char**


From: Mathieu Suen
Subject: Re: [Help-smalltalk] c callouts and char**
Date: Sun, 9 Jan 2011 23:31:14 +0100

On Jan 9, 2011, at 10:43 PM, Paolo Bonzini wrote:

> On Sun, Jan 9, 2011 at 19:50, Mathieu Suen <address@hidden> wrote:
>> On Jan 9, 2011, at 6:14 PM, Paolo Bonzini wrote:
>> 
>>> No, Smaltalk objects are not automatically converted to instances from
>>> the CObject hierarchy.
>> 
>> Could it be interesting to have message like asCUChar, asCInt...?
>> This could avoid writing too mush parenthesis for example:
>> aCObject at: 1 put: 230 asCUChar.
> 
> I don't think this would be used very often.  Your example would not
> be equivalent to
> 
>   aCObject[1] = 230;
> 
> but rather
> 
>   char *p = malloc (1);
>   *p = 230;
>   aCObject[1] = p;

I see yes.
So I have a question. 
When I was playing with cairo I thought there was no other way than this to 
write 
on a surface:
cpngSurface := Cairo.CairoPngSurface on: 'test.png' extent: address@hidden
data := Cairo.Cairo imageSurfaceGetData: cpngSurface cairoSurface.
..
data at: (i*4) + (j*stride) + 3 put:  (CChar value: 255) type: CChar.

#imageSurfaceGetData: returns an instance of CObject.
How to make #imageSurfaceGetData: returns a CCharArray to do something like:
data at: (i*4) + (j*stride) + 3 put:  255 ?

Thanks


> 
> Paolo

        Mth

__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible 
contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail



reply via email to

[Prev in Thread] Current Thread [Next in Thread]