[RQt-devel] a couple of minor things

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Sep 21 08:12:32 CEST 2010


On Mon, Sep 20, 2010 at 2:34 PM, Michael Lawrence
<lawrence.michael at gene.com> wrote:
>
>
> On Fri, Sep 17, 2010 at 6:15 AM, Michael Lawrence <michafla at gene.com> wrote:
>>
>>
>> On Fri, Sep 17, 2010 at 4:39 AM, Deepayan Sarkar
>> <deepayan.sarkar at gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> A couple of low-priority things that might be nice to have:
>>>
>>> (1) In dealing with images, Qt used unsigned int for colors.
>>>
>>> > qimg <- Qt$QImage(100, 100, Qt$QImage$Format_ARGB32_Premultiplied)
>>> > qimg$fill(0L)
>>> > qimg$pixel(40, 50)
>>> [1] 0
>>>
>>> Is there an easy way to implement conversion to/from R colors? (Maybe
>>> through R color <-> R integer <-> unsigned int.)
>>>
>>
>> For images, I was thinking we could have a converter between QImage and R
>> images stored as matrices (as used by graphics devices in recent versions of
>> R). Any pixel-wise manipulation of images from R would be too slow in
>> general.

True. The $fill() example above is the only realistic use-case.
Anyway, a one-off converter should be easy enough.

>> Btw, there is already conversion between QColor and the output of
>> col2rgb(), using qcol2rgb() and qcolor().

Yes, and it would have been nice if QImage methods accepted QColor
whenever appropriate.

>>> (2) QByteArrays are almost like strings, and used in various places.
>>> E.g.,
>>>
>>> > Qt$QImageReader$supportedImageFormats()
>>> Error in qinvokeStatic(cl, name, ...) :
>>>  Attempt to create SmokeObject with NULL class
>
> In latest svn:
>
>> sapply(Qt$QImageReader$supportedImageFormats(), rawToChar)
>  [1] "bmp"  "gif"  "ico"  "jpeg" "jpg"  "pbm"  "pgm"  "png"  "ppm"  "svg"
> [11] "xbm"  "xpm"

Thanks. The new QT() screen device in qtutils now uses this to create
a dynamic "Export As" context menu.

-Deepayan


More information about the Qtinterfaces-devel mailing list