X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f5bac082ecd6a66504d74b0507423bfd44bb5c43..2cc3f6a0fc1f8b79150a715f145e73e185adae10:/wxPython/src/_image.i diff --git a/wxPython/src/_image.i b/wxPython/src/_image.i index e58431f96d..27f48e9319 100644 --- a/wxPython/src/_image.i +++ b/wxPython/src/_image.i @@ -68,6 +68,37 @@ public: "Find first colour that is not used in the image and has higher RGB values than startR, startG, startB. Returns a tuple consisting of a success flag and rgb values.", ""); + + %extend { + DocStr(GetCount, + "Returns the pixel count for the given key. Use `MakeKey` to create a +key value from a RGB tripple.", ""); + unsigned long GetCount(unsigned long key) { + wxImageHistogramEntry e = (*self)[key]; + return e.value; + } + + DocStr(GetCountRGB, + "Returns the pixel count for the given RGB values.", ""); + unsigned long GetCountRGB(unsigned char r, + unsigned char g, + unsigned char b) { + unsigned long key = wxImageHistogram::MakeKey(r, g, b); + wxImageHistogramEntry e = (*self)[key]; + return e.value; + } + + DocStr(GetCountColour, + "Returns the pixel count for the given `wx.Colour` value.", ""); + unsigned long GetCountColour(const wxColour& colour) { + unsigned long key = wxImageHistogram::MakeKey(colour.Red(), + colour.Green(), + colour.Blue()); + wxImageHistogramEntry e = (*self)[key]; + return e.value; + } + } + }; @@ -306,7 +337,7 @@ The method will then fill up the whole image with the colour given.", ""); unsigned char* buffer; int size; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyArg_Parse(data, "t#", &buffer, &size)) goto done; @@ -360,7 +391,7 @@ The method will then fill up the whole image with the colour given.", ""); unsigned char* buffer; int size; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyArg_Parse(data, "t#", &buffer, &size)) goto done;