[RQt-devel] a couple of minor things

Michael Lawrence lawrence.michael at gene.com
Tue Sep 21 21:44:58 CEST 2010


On Mon, Sep 20, 2010 at 11:12 PM, Deepayan Sarkar <deepayan.sarkar at gmail.com
> wrote:

> 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.
>
>
I will work on this conversion.


> >> 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.
>
>
Still, it's not hard to move between the two:

image.fill(qcolor("red")$rgb())

>>> (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
> _______________________________________________
> Qtinterfaces-devel mailing list
> Qtinterfaces-devel at lists.r-forge.r-project.org
>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/qtinterfaces-devel/attachments/20100921/4176fb61/attachment.htm>


More information about the Qtinterfaces-devel mailing list