www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GTKD Cairo get pixel color

reply TheDGuy <loder.feuer googlemail.com> writes:
Hello,

is there any way to get the pixel color of a single pixel by x 
and y coordinates of a context?
Dec 30 2015
parent reply Basile B. <b2.temp gmx.com> writes:
On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote:
 Hello,

 is there any way to get the pixel color of a single pixel by x 
 and y coordinates of a context?
render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same time, to blit your buffer to screen.
Dec 30 2015
next sibling parent reply TheDGuy <loder.feuer googlemail.com> writes:
On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote:
 Hello,

 is there any way to get the pixel color of a single pixel by x 
 and y coordinates of a context?
render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same time, to blit your buffer to screen.
Thanks for your answer. But how do i access the function via the context? It does not work like this: class DW:DrawingArea{ this(){ addOnDraw(&drawCallback); } bool drawCallback(Scoped!Context cr, Widget widget){ char[] c = new char[](256*256); auto val = cr.cairo_image_surface_create_for_data(c,cairo_format_t.CAIRO_FORMAT_ARGB32, 256,256, cairo.format_stride_for_width(cairo_format_t.CAIRO_FORMAT_ARGB32,256)); return true; } } "no property 'cairo_image_surface_create_for_data' for type 'Scoped'"
Jan 01 2016
parent reply Mike Wey <mike-wey example.com> writes:
On 01/01/2016 01:37 PM, TheDGuy wrote:
 On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote:
 Hello,

 is there any way to get the pixel color of a single pixel by x and y
 coordinates of a context?
render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same time, to blit your buffer to screen.
Thanks for your answer. But how do i access the function via the context? It does not work like this: class DW:DrawingArea{ this(){ addOnDraw(&drawCallback); } bool drawCallback(Scoped!Context cr, Widget widget){ char[] c = new char[](256*256); auto val = cr.cairo_image_surface_create_for_data(c,cairo_format_t.CAIRO_FORMAT_ARGB32, 256,256, cairo.format_stride_for_width(cairo_format_t.CAIRO_FORMAT_ARGB32,256)); return true; } } "no property 'cairo_image_surface_create_for_data' for type 'Scoped'"
you would either cr.getTarget(); or cairo.ImageSurface.ImageSurface.create. I'm not sure how those would get you access to the pixel data. -- Mike Wey
Jan 01 2016
parent TheDGuy <loder.feuer googlemail.com> writes:
On Friday, 1 January 2016 at 15:22:18 UTC, Mike Wey wrote:
 On 01/01/2016 01:37 PM, TheDGuy wrote:
 [...]
you would either cr.getTarget(); or cairo.ImageSurface.ImageSurface.create. I'm not sure how those would get you access to the pixel data.
Okay, thanks for your answer. So which function do i call with "cr.getTarget()" and how can i get the rgb-values of a pixel from it?
Jan 01 2016
prev sibling parent reply Basile B. <b2.temp gmx.com> writes:
On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote:
 Hello,

 is there any way to get the pixel color of a single pixel by x 
 and y coordinates of a context?
render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same time, to blit your buffer to screen.
Actually I was thinking to a user defined buffer type: struct SurfaceBuffer { void* data; // used as param to create the surface Rgba[] opIndex(size_t index); Rgba[][] scanline(); } that you would pass as data in cairo_image_surface_create_for_data(). But gtk certainly has pitcure classes with the typical scanline method and that you could use in cairo_image_surface_create_for_data.
Jan 01 2016
parent reply TheDGuy <loder.feuer googlemail.com> writes:
On Friday, 1 January 2016 at 19:32:40 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote:
 Hello,

 is there any way to get the pixel color of a single pixel by 
 x and y coordinates of a context?
render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same time, to blit your buffer to screen.
Actually I was thinking to a user defined buffer type: struct SurfaceBuffer { void* data; // used as param to create the surface Rgba[] opIndex(size_t index); Rgba[][] scanline(); } that you would pass as data in cairo_image_surface_create_for_data(). But gtk certainly has pitcure classes with the typical scanline method and that you could use in cairo_image_surface_create_for_data.
Ahm, i am not quite sure if you and [Mike Wey] talk about the same thing. And i posted the error message in my last post when i try to call "cairo_image_surface_create_for_data". I still don't know where i am able to call the function?
Jan 01 2016
next sibling parent reply TheDGuy <loder.feuer googlemail.com> writes:
On Friday, 1 January 2016 at 22:00:04 UTC, TheDGuy wrote:
 On Friday, 1 January 2016 at 19:32:40 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. 
 wrote:
 On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote:
 Hello,

 is there any way to get the pixel color of a single pixel by 
 x and y coordinates of a context?
render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same time, to blit your buffer to screen.
Actually I was thinking to a user defined buffer type: struct SurfaceBuffer { void* data; // used as param to create the surface Rgba[] opIndex(size_t index); Rgba[][] scanline(); } that you would pass as data in cairo_image_surface_create_for_data(). But gtk certainly has pitcure classes with the typical scanline method and that you could use in cairo_image_surface_create_for_data.
Ahm, i am not quite sure if you and [Mike Wey] talk about the same thing. And i posted the error message in my last post when i try to call "cairo_image_surface_create_for_data". I still don't know where i am able to call the function?
I took a look into the source code of cairo and in the "ImageSurface.d"-file there is a function called "createForData" but if i try to use it like this: cairo.ImageSurface.createForData(c,cairo.FORMAT_ARGB32,256,256,256*4); i get: "undefined identifier 'createForData' in module 'cairo.ImageSurface' That is just one example of my experience using D: some things are easy to understand but in other cases: even if you think it should work and you can proof it, it just doesn't or you have to do it in a really inconvenient way. I am getting frustrated
Jan 01 2016
parent reply Mike Wey <mike-wey example.com> writes:
On 01/02/2016 12:32 AM, TheDGuy wrote:
 On Friday, 1 January 2016 at 22:00:04 UTC, TheDGuy wrote:
 On Friday, 1 January 2016 at 19:32:40 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote:
 Hello,

 is there any way to get the pixel color of a single pixel by x and
 y coordinates of a context?
render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same time, to blit your buffer to screen.
Actually I was thinking to a user defined buffer type: struct SurfaceBuffer { void* data; // used as param to create the surface Rgba[] opIndex(size_t index); Rgba[][] scanline(); } that you would pass as data in cairo_image_surface_create_for_data(). But gtk certainly has pitcure classes with the typical scanline method and that you could use in cairo_image_surface_create_for_data.
Ahm, i am not quite sure if you and [Mike Wey] talk about the same thing. And i posted the error message in my last post when i try to call "cairo_image_surface_create_for_data". I still don't know where i am able to call the function?
I took a look into the source code of cairo and in the "ImageSurface.d"-file there is a function called "createForData" but if i try to use it like this: cairo.ImageSurface.createForData(c,cairo.FORMAT_ARGB32,256,256,256*4); i get: "undefined identifier 'createForData' in module 'cairo.ImageSurface'
``` import cairo.ImageSurface; ImageSurface.createForData(c,cairo.FORMAT_ARGB32,256,256,256*4); ``` You need to import the ImageSurface module, and the createForData function is in the ImageSurface class which is in the cairo.ImageSurface module.
 That is just one example of my experience using D:

 some things are easy to understand but in other cases: even if you think
 it should work and you can proof it, it just doesn't or you have to do
 it in a really inconvenient way. I am getting frustrated
-- Mike Wey
Jan 02 2016
parent reply TheDGuy <loder.feuer googlemail.com> writes:
 ```
 import cairo.ImageSurface;
 ImageSurface.createForData(c,cairo.FORMAT_ARGB32,256,256,256*4);
 ```

 You need to import the ImageSurface module, and the 
 createForData function is in the ImageSurface class which is in 
 the cairo.ImageSurface module.
Thanks, that was the problem! Now i can read the buffer from a png image and save the buffer as a file: auto pngImage = ImageSurface.createFromPng("C:\\Users\\Standardbenutzer\\Desktop\\DSC00564-1.png"); auto buffer = pngImage.getData(); auto cS = ImageSurface.createForData(buffer, cairo_format_t.ARGB32,pngImage.getWidth(),pngImage.getHeight(),pngImage.getStride()); cS.writeToPng("test.png"); but how do i do that with my GTKD Context in my "drawCallback()" function?
Jan 02 2016
parent reply Mike Wey <mike-wey example.com> writes:
I think you are looking for something like this.

Context.getTarget will get you the surface the Context is drawing to, 
this most likely isn't a ImageSurface.
So you will need to create an pixbuf from the returned surface, with the 
Pixbuf you can then get the raw pixel data using getPixelsWithLength().

```
import gdk.Pixbuf;

bool drawCallback(Scoped!Context cr, Widget widget)
{
     GtkAllocation size;
     Pixbuf surafce;

     getAllocation(size);

     //Draw something;

     surface = getFromSurface(cr.getTarget(), 0, 0, size.width, 
size.height);

     ubyte[] data = cast(ubyte[])surface.getPixelsWithLength();

     //Do somthing with data.

     return true;
}
```

getPixelsWithLength has the wrong return type, which will probably be 
fixed some time.

-- 
Mike Wey
Jan 04 2016
parent reply TheDGuy <loder.feuer googlemail.com> writes:
On Monday, 4 January 2016 at 19:27:48 UTC, Mike Wey wrote:
 I think you are looking for something like this.

 Context.getTarget will get you the surface the Context is 
 drawing to, this most likely isn't a ImageSurface.
 So you will need to create an pixbuf from the returned surface, 
 with the Pixbuf you can then get the raw pixel data using 
 getPixelsWithLength().

 ```
 import gdk.Pixbuf;

 bool drawCallback(Scoped!Context cr, Widget widget)
 {
     GtkAllocation size;
     Pixbuf surafce;

     getAllocation(size);

     //Draw something;

     surface = getFromSurface(cr.getTarget(), 0, 0, size.width, 
 size.height);

     ubyte[] data = cast(ubyte[])surface.getPixelsWithLength();

     //Do somthing with data.

     return true;
 }
 ```

 getPixelsWithLength has the wrong return type, which will 
 probably be fixed some time.
Thank you very much! But surface.getPixelsWithLength() only gives me an array with 16 fields (with a 256x256 DrawingArea)? I also tried to save the Pixbuf with: string[] options = ["quality"]; string[] opval = ["100"]; surface.savev("C:\\Users\\Standardbenutzer\\Desktop\test.jpeg", "jpeg", options, opval); but i found absolutely NOTHING about the options or the option values i have to set, therefore i get an invalid argument exception :(
Jan 04 2016
parent reply Mike Wey <mike-wey example.com> writes:
On 01/04/2016 09:13 PM, TheDGuy wrote:
 On Monday, 4 January 2016 at 19:27:48 UTC, Mike Wey wrote:
 I think you are looking for something like this.

 Context.getTarget will get you the surface the Context is drawing to,
 this most likely isn't a ImageSurface.
 So you will need to create an pixbuf from the returned surface, with
 the Pixbuf you can then get the raw pixel data using
 getPixelsWithLength().

 ```
 import gdk.Pixbuf;

 bool drawCallback(Scoped!Context cr, Widget widget)
 {
     GtkAllocation size;
     Pixbuf surafce;

     getAllocation(size);

     //Draw something;

     surface = getFromSurface(cr.getTarget(), 0, 0, size.width,
 size.height);

     ubyte[] data = cast(ubyte[])surface.getPixelsWithLength();

     //Do somthing with data.

     return true;
 }
 ```

 getPixelsWithLength has the wrong return type, which will probably be
 fixed some time.
Thank you very much! But surface.getPixelsWithLength() only gives me an array with 16 fields (with a 256x256 DrawingArea)? I also tried to save the Pixbuf with: string[] options = ["quality"]; string[] opval = ["100"]; surface.savev("C:\\Users\\Standardbenutzer\\Desktop\test.jpeg", "jpeg", options, opval); but i found absolutely NOTHING about the options or the option values i have to set, therefore i get an invalid argument exception :(
I don't have any issues with either getPixelsWithLength and savev. for the savev call there is an missing \ just before test.jpg, but that might be a copy and paste error? For the options that are available for savev the documentation of GDK-PixBuff lists the few available options. https://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-File-saving.html#gdk-pixbuf-save Although i'm on Linux so that might make an difference. -- Mike Wey
Jan 04 2016
parent reply TheDGuy <loder.feuer googlemail.com> writes:
On Monday, 4 January 2016 at 21:42:16 UTC, Mike Wey wrote:
 On 01/04/2016 09:13 PM, TheDGuy wrote:
 [...]
I don't have any issues with either getPixelsWithLength and savev. for the savev call there is an missing \ just before test.jpg, but that might be a copy and paste error? For the options that are available for savev the documentation of GDK-PixBuff lists the few available options. https://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-File-saving.html#gdk-pixbuf-save Although i'm on Linux so that might make an difference.
Ups, that was my fault, sry :( But how do i get now the color for each pixel out of the ubyte[]?
Jan 04 2016
parent reply Mike Wey <mike-wey example.com> writes:
On 01/04/2016 11:08 PM, TheDGuy wrote:
 On Monday, 4 January 2016 at 21:42:16 UTC, Mike Wey wrote:
 On 01/04/2016 09:13 PM, TheDGuy wrote:
 [...]
I don't have any issues with either getPixelsWithLength and savev. for the savev call there is an missing \ just before test.jpg, but that might be a copy and paste error? For the options that are available for savev the documentation of GDK-PixBuff lists the few available options. https://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-File-saving.html#gdk-pixbuf-save Although i'm on Linux so that might make an difference.
Ups, that was my fault, sry :( But how do i get now the color for each pixel out of the ubyte[]?
It looks like the array has the R, G and B values like this: [R, G, B, R, G, B, R, G, B, R, G, B, .......] for every pixel from left to right top to bottom, So data[0] gives you the Red value for the pixel at 0,0. data[1] the Blue value and data[2] the green value. data[3] would then be Red for pixel 1,0. -- Mike Wey
Jan 05 2016
parent TheDGuy <loder.feuer googlemail.com> writes:
On Tuesday, 5 January 2016 at 22:02:33 UTC, Mike Wey wrote:
 On 01/04/2016 11:08 PM, TheDGuy wrote:
 On Monday, 4 January 2016 at 21:42:16 UTC, Mike Wey wrote:
 [...]
Ups, that was my fault, sry :( But how do i get now the color for each pixel out of the ubyte[]?
It looks like the array has the R, G and B values like this: [R, G, B, R, G, B, R, G, B, R, G, B, .......] for every pixel from left to right top to bottom, So data[0] gives you the Red value for the pixel at 0,0. data[1] the Blue value and data[2] the green value. data[3] would then be Red for pixel 1,0.
Thats it, thank you very much!
Jan 05 2016
prev sibling parent reply Basile B. <b2.temp gmx.com> writes:
On Friday, 1 January 2016 at 22:00:04 UTC, TheDGuy wrote:
 On Friday, 1 January 2016 at 19:32:40 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. 
 wrote:
 On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote:
 Hello,

 is there any way to get the pixel color of a single pixel by 
 x and y coordinates of a context?
render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same time, to blit your buffer to screen.
Actually I was thinking to a user defined buffer type: struct SurfaceBuffer { void* data; // used as param to create the surface Rgba[] opIndex(size_t index); Rgba[][] scanline(); } that you would pass as data in cairo_image_surface_create_for_data(). But gtk certainly has pitcure classes with the typical scanline method and that you could use in cairo_image_surface_create_for_data.
Ahm, i am not quite sure if you and [Mike Wey] talk about the same thing. And i posted the error message in my last post when i try to call "cairo_image_surface_create_for_data". I still don't know where i am able to call the function?
I've not followed the conversation since last time, but you can have a look at this: https://github.com/BBasile/kheops/blob/master/src/kheops/bitmap.d#L143 this is how I do with Cairo only (even x11 is not implied since it's just a bitmap). Then I can access pixels (for example to make shadows or blurs etc.) and do vectorial drawings as well with a context for the bitmap surface.
Jan 04 2016
parent reply TheDGuy <loder.feuer googlemail.com> writes:
On Monday, 4 January 2016 at 23:47:05 UTC, Basile B. wrote:
 On Friday, 1 January 2016 at 22:00:04 UTC, TheDGuy wrote:
 On Friday, 1 January 2016 at 19:32:40 UTC, Basile B. wrote:
 On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. 
 wrote:
 On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy 
 wrote:
 Hello,

 is there any way to get the pixel color of a single pixel 
 by x and y coordinates of a context?
render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same time, to blit your buffer to screen.
Actually I was thinking to a user defined buffer type: struct SurfaceBuffer { void* data; // used as param to create the surface Rgba[] opIndex(size_t index); Rgba[][] scanline(); } that you would pass as data in cairo_image_surface_create_for_data(). But gtk certainly has pitcure classes with the typical scanline method and that you could use in cairo_image_surface_create_for_data.
Ahm, i am not quite sure if you and [Mike Wey] talk about the same thing. And i posted the error message in my last post when i try to call "cairo_image_surface_create_for_data". I still don't know where i am able to call the function?
I've not followed the conversation since last time, but you can have a look at this: https://github.com/BBasile/kheops/blob/master/src/kheops/bitmap.d#L143 this is how I do with Cairo only (even x11 is not implied since it's just a bitmap). Then I can access pixels (for example to make shadows or blurs etc.) and do vectorial drawings as well with a context for the bitmap surface.
I tried it like in this C++ example: http://stackoverflow.com/questions/16785886/get-pixel-value-on-gdkpixbuf-set-pixel-value-with-gdkcairo surface = getFromSurface(cr.getTarget(),0,0,size.width,size.height); int offset = 12*surface.getRowstride() + 12*surface.getNChannels(); auto px = surface.getPixels(); px[offset][0] = 0; But i get "only one index allowed to index char". So it looks like there is no 2D array but just a char. If i try like this: auto px = surface.getPixels()[offset]; the value of 'px' looks like this in the debugger: http://www.pic-upload.de/view-29334489/d_value.png.html
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 15:04:57 UTC, TheDGuy wrote:
 But i get "only one index allowed to index char". So it looks 
 like there is no 2D array but just a char.
 If i try like this:
The data is just a contiguous memory area. You have to implement your own opIndexAssign()/opIndex() to write/read a pixel at [line, column]. This is basically `dataPtr + (line * width + column) * 4`. --- auto opIndex(size_t line, size_t column) { auto ptr = basePtr + (line * width + column) * 4; // return something at "ptr". } void opIndexAssign(T)(auto ref T t, size_t line, size_t column) { auto ptr = basePtr + (line * width + column) * 4; // assign t at "ptr". } --- (assuming format is ARGB, so 32bit, so "*4").
Jan 05 2016
parent reply TheDGuy <loder.feuer googlemail.com> writes:
On Tuesday, 5 January 2016 at 16:16:39 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 15:04:57 UTC, TheDGuy wrote:
 But i get "only one index allowed to index char". So it looks 
 like there is no 2D array but just a char.
 If i try like this:
The data is just a contiguous memory area. You have to implement your own opIndexAssign()/opIndex() to write/read a pixel at [line, column]. This is basically `dataPtr + (line * width + column) * 4`. --- auto opIndex(size_t line, size_t column) { auto ptr = basePtr + (line * width + column) * 4; // return something at "ptr". } void opIndexAssign(T)(auto ref T t, size_t line, size_t column) { auto ptr = basePtr + (line * width + column) * 4; // assign t at "ptr". } --- (assuming format is ARGB, so 32bit, so "*4").
But how do i know which line or column my pixel is in? And what is 't' in 'opIndexAssign'?
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 16:25:01 UTC, TheDGuy wrote:
 But how do i know which line or column my pixel is in?
- study D operator overloading, I've given you the solution.
 And what is 't' in 'opIndexAssign'?
- t is what you want to assign. It can be an uint or maybe a float[4]. Look at my bitmap class.
Jan 05 2016
parent reply TheDGuy <loder.feuer googlemail.com> writes:
On Tuesday, 5 January 2016 at 16:43:00 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 16:25:01 UTC, TheDGuy wrote:
 But how do i know which line or column my pixel is in?
- study D operator overloading, I've given you the solution.
 And what is 't' in 'opIndexAssign'?
- t is what you want to assign. It can be an uint or maybe a float[4]. Look at my bitmap class.
Okay, but what is this? "import iz.memory, iz.streams, iz.properties;" I dont' understand what "MemoryStream" is?
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 17:16:10 UTC, TheDGuy wrote:
 On Tuesday, 5 January 2016 at 16:43:00 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 16:25:01 UTC, TheDGuy wrote:
 But how do i know which line or column my pixel is in?
- study D operator overloading, I've given you the solution.
 And what is 't' in 'opIndexAssign'?
- t is what you want to assign. It can be an uint or maybe a float[4]. Look at my bitmap class.
Okay, but what is this? "import iz.memory, iz.streams, iz.properties;" I dont' understand what "MemoryStream" is?
MemoryStream is a managed pointer with methods to read and write at a particlular postion. In the Bitmap class I often refer to .memory which is just the managed pointer. - iz.properties is used to anotate what has to be serialiazed or not and it's pointless here ( Set Get). - iz.memory is just imported because I use (construct!T) instead of "new" to allocate a class instance. But these are implementation details. Just try to imagine that you manage the bitmap data yourself with realloc/free...
Jan 05 2016
parent reply TheDGuy <loder.feuer googlemail.com> writes:
On Tuesday, 5 January 2016 at 17:34:06 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 17:16:10 UTC, TheDGuy wrote:
 On Tuesday, 5 January 2016 at 16:43:00 UTC, Basile B. wrote:
 [...]
Okay, but what is this? "import iz.memory, iz.streams, iz.properties;" I dont' understand what "MemoryStream" is?
MemoryStream is a managed pointer with methods to read and write at a particlular postion. In the Bitmap class I often refer to .memory which is just the managed pointer. - iz.properties is used to anotate what has to be serialiazed or not and it's pointless here ( Set Get). - iz.memory is just imported because I use (construct!T) instead of "new" to allocate a class instance. But these are implementation details. Just try to imagine that you manage the bitmap data yourself with realloc/free...
No offense, but why is the same thing done in 3 lines in C++ but needs 200 lines in D?
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 17:37:04 UTC, TheDGuy wrote:
 On Tuesday, 5 January 2016 at 17:34:06 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 17:16:10 UTC, TheDGuy wrote:
 On Tuesday, 5 January 2016 at 16:43:00 UTC, Basile B. wrote:
 [...]
Okay, but what is this? "import iz.memory, iz.streams, iz.properties;" I dont' understand what "MemoryStream" is?
MemoryStream is a managed pointer with methods to read and write at a particlular postion. In the Bitmap class I often refer to .memory which is just the managed pointer. - iz.properties is used to anotate what has to be serialiazed or not and it's pointless here ( Set Get). - iz.memory is just imported because I use (construct!T) instead of "new" to allocate a class instance. But these are implementation details. Just try to imagine that you manage the bitmap data yourself with realloc/free...
No offense, but why is the same thing done in 3 lines in C++ but needs 200 lines in D?
IDK, except D I only speek/talk Object Pascal (FPC/Delphi).
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 17:39:41 UTC, Basile B. wrote:
 IDK, except D I only speek/talk Object Pascal (FPC/Delphi).
"I didn't know, apart D, I only speak/talk Object Pascal (FPC/Delphi)." Was what I meant. ^^
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 18:19:08 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 17:39:41 UTC, Basile B. wrote:
 IDK, except D I only speek/talk Object Pascal (FPC/Delphi).
"I didn't know, apart D, I only speak/talk Object Pascal (FPC/Delphi)." Was what I meant. ^^
https://www.youtube.com/watch?v=Mlpl-RzsCck
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 19:13:35 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 18:19:08 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 17:39:41 UTC, Basile B. wrote:
 IDK, except D I only speek/talk Object Pascal (FPC/Delphi).
"I didn't know, apart D, I only speak/talk Object Pascal (FPC/Delphi)." Was what I meant. ^^
https://www.youtube.com/watch?v=Mlpl-RzsCck
https://www.youtube.com/watch?v=ZKMc_NgzFxE .-. .-. | | | | | | | | | | | | _| |_ _| |_ | | | |-. | |_| |-. /| ` | / )| |_|_| | | | | |-' `-^-' | | | || | \ / \ ' / | | | | | | | |
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 19:47:02 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 19:13:35 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 18:19:08 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 17:39:41 UTC, Basile B. wrote:
 IDK, except D I only speek/talk Object Pascal (FPC/Delphi).
"I didn't know, apart D, I only speak/talk Object Pascal (FPC/Delphi)." Was what I meant. ^^
https://www.youtube.com/watch?v=Mlpl-RzsCck
https://www.youtube.com/watch?v=ZKMc_NgzFxE .-. .-. | | | | | | | | | | | | _| |_ _| |_ | | | |-. | |_| |-. /| ` | / )| |_|_| | | | | |-' `-^-' | | | || | \ / \ ' / | | | | | | | |
Awww... I'm so sorry. It was the wedding of Michel...Basically I wanted to ruin the wedding of another person...but I don't know you...wrong ruining.
Jan 05 2016
parent reply Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Tuesday, 5 January 2016 at 21:01:55 UTC, Basile B. wrote:
 Awww... I'm so sorry.
https://youtu.be/uyMUck2RRjw
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 21:24:51 UTC, Ola Fosheim Grøstad 
wrote:
 On Tuesday, 5 January 2016 at 21:01:55 UTC, Basile B. wrote:
 Awww... I'm so sorry.
https://youtu.be/uyMUck2RRjw
du bist normal oder idiot ? https://www.youtube.com/watch?v=nGLwBCMSXys
Jan 05 2016
parent reply Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Tuesday, 5 January 2016 at 22:02:47 UTC, Basile B. wrote:
 du bist normal oder idiot ?
https://youtu.be/7kjTXMecCrM Ding dong!
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 22:08:52 UTC, Ola Fosheim Grøstad 
wrote:
 On Tuesday, 5 January 2016 at 22:02:47 UTC, Basile B. wrote:
 du bist normal oder idiot ?
https://youtu.be/7kjTXMecCrM Ding dong!
https://en.wikipedia.org/wiki/Turing_Award Si tu crois que tu es un génie, il y a de forte chance que tu sois un gros bouffon.
Jan 05 2016
next sibling parent reply Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Tuesday, 5 January 2016 at 22:40:22 UTC, Basile B. wrote:
 https://en.wikipedia.org/wiki/Turing_Award

 Si tu crois que tu es un génie, il y a de forte chance que tu 
 sois un gros bouffon.
Jeg hadde faktisk 2001 vinnerne av Turing prisen som forelesere på universitetet og Kristen Nygaard var helt klar på at Dahl var en skarping, og det visste han nok selv også, for det sa alle på instituttet. Men jeg syntes forelesningen til Ole-Johan Dahl i programverifisering var tørre og alt for fulle av kvantorer... så jeg tror Dahl ville være en dårlig klovn, men han var en glimrende pianist! Er du sikker på at teorien din stemmer? Jeg spiller piano.
Jan 05 2016
parent Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
Sorry about being off-topic, let's get back on topic:

https://youtu.be/MPwLKIXYEPE?t=1m20s
Jan 05 2016
prev sibling parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 22:40:22 UTC, Basile B. wrote:
 On Tuesday, 5 January 2016 at 22:08:52 UTC, Ola Fosheim Grøstad 
 wrote:
 On Tuesday, 5 January 2016 at 22:02:47 UTC, Basile B. wrote:
 du bist normal oder idiot ?
https://youtu.be/7kjTXMecCrM Ding dong!
https://en.wikipedia.org/wiki/Turing_Award Si tu crois que tu es un génie, il y a de forte chance que tu sois un gros bouffon.
https://youtu.be/3hrfjSaW8TQ?t=7m54s At a certain point, I hope we agree about "when good stuff are over the top". access to pix is easy...
Jan 05 2016
parent reply Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Tuesday, 5 January 2016 at 23:26:12 UTC, Basile B. wrote:
 access to pix is easy...
This is the learn forum. Maybe one should be able to figure it out without asking, but there is nothing wrong with asking in depth on this forum. The threshold for asking should be low in here. At worst, nobody answers or as it turns out, posts a youtube video...
Jan 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Tuesday, 5 January 2016 at 23:36:16 UTC, Ola Fosheim Grøstad 
wrote:
 On Tuesday, 5 January 2016 at 23:26:12 UTC, Basile B. wrote:
 access to pix is easy...
This is the learn forum. Maybe one should be able to figure it out without asking, but there is nothing wrong with asking in depth on this forum. The threshold for asking should be low in here. At worst, nobody answers or as it turns out, posts a youtube video...
Until a certain "time" my answers were useful. But I recognize that after this "time" I've managed to turn the topic into something totally delirious because, to be honest I was completly sratched by alcohool. I'm sorry but life is so... I'm mostly serious here but sometimes I draft. Most of the time it's obvious...sorry if you didn't get this...IRL you directly get that the guy is high, on the internet it's not always so obvious.
Jan 05 2016
parent Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Wednesday, 6 January 2016 at 01:41:03 UTC, Basile B. wrote:
 Until a certain "time" my answers were useful. But I recognize 
 that after this "time" I've managed to turn the topic into 
 something totally delirious because, to be honest I was 
 completly sratched by alcohool. I'm sorry but life is so...
No worries! The OP got his question answered, an other people got entertained, so it worked out ok :-)
Jan 06 2016