This project has moved and is read-only. For the latest updates, please go here.

GetReadOnlyPixels not accessible

Aug 19, 2016 at 3:00 PM
Just getting started with Magick.NET, so sorry if this is blatantly obvious: in VisualStudio 2015, I've been able to create and draw on a MagickImage, but when following the
using (PixelCollection p = image.GetReadOnlyPixels())
            {
            ...
            }
template used in many examples, I keep getting a 'MagickImage does not contain a definition for GetReadOnlyPixels()' error. What am I doing wrong? Thanks.
Aug 19, 2016 at 3:45 PM
In the newer builds, GetReadOnlyPixels() has been replaced by GetPixels(). Just swap the methods in the code and it should compile.
Aug 19, 2016 at 9:47 PM
Is there a place to look up information such as this one?
--
Sent from my Android phone with 1&1 Mail. Please excuse my brevity.
Aug 20, 2016 at 10:27 AM
I try to document the breaking changes here: https://magick.codeplex.com/SourceControl/latest#Changes.md
Aug 20, 2016 at 1:04 PM
Thanks to both of you!
--
Sent from my Android phone with 1&1 Mail. Please excuse my brevity.
Aug 22, 2016 at 12:01 AM
This is slightly different from the original subject but still along the same lines. I can now make code like this work:
img.Draw(
                              new DrawableFillColor(MagickColors.Transparent), // no fill 
                              new DrawableStrokeColor(MagickColors.Gray),
                              new DrawableStrokeWidth(width / 480),
                              new DrawableLine(width / 3, 0, width / 3, height),
                              new DrawableLine(width * 2 / 3, 0, width * 2 / 3, height),
                              new DrawableLine(0, height / 3, width, height / 3),
                              new DrawableLine(0, height * 2 / 3, width, height * 2 / 3)
                            );
but since I need to draw multiple lines in a loop, I looked at another code example dlemstra suggested (in 2013),
using (MagickImage img = new MagickImage(path))
{
    List<DrawableBase> drawables = new List<DrawableBase>();
    drawables.Add(new DrawableFont("Comic Sans Is Evil", FontStyleType.Italic, FontWeight.Weight400, FontStretch.Normal));
    drawables.Add(new DrawableFillColor(new MagickColor(10, 10, 10)));
    drawables.Add(new DrawableText(50, 15, "Shafi"));
    img.Draw(drawables);
}
then checked the change log and found that version 6.8.5.1001 renamed DrawableBase to Drawable, only to find that the example wouldn't work with Drawable, either. ("The type or namespace name 'Drawable' could not be found") I can't seem to find any further related info in the change log. What else do I need to change to make the example work, and is there a library of current code examples that goes beyond the (useful, but not extensive) code examples included on the documentation page?
Aug 23, 2016 at 7:38 PM
I wish there was a page with code examples but I don't have the time to create one. Instead of a list of DrawableBase instances you should use the new interface IDrawable.
Aug 23, 2016 at 8:57 PM
Appreciate the info.
--
Sent from my Android phone with 1&1 Mail. Please excuse my brevity.
Aug 23, 2016 at 9:14 PM
Edited Aug 23, 2016 at 9:14 PM
You're welcome.

Sent from my Windows laptop with my keyboard. Please excuse my brevity :)