• Modify individual image pixels

    From Manuel Collado@21:1/5 to All on Tue Nov 7 11:09:08 2023
    The subject line says all. Is there a way to create/modify a bitmap
    image on screen pixelwise?

    Until now I've only found the possibility to redraw the whole image
    after individual pixel changes.

    Thanks in advance.
    --
    Manuel Collado - http://mcollado.z15.es

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Tue Nov 7 11:55:05 2023
    Am 07.11.2023 um 11:09 schrieb Manuel Collado:
    The subject line says all. Is there a way to create/modify a bitmap
    image on screen pixelwise?

    Until now I've only found the possibility to redraw the whole image
    after individual pixel changes.

    Thanks in advance.

    Yes, there is.

    https://www.tcl-lang.org/man/tcl8.6/TkCmd/photo.htm#M30

    You will need Tk 8.7 to manipulate the full alpha channel.

    Enjoy,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Manuel Collado@21:1/5 to All on Wed Nov 8 13:24:58 2023
    El 7/11/23 a las 11:55, Harald Oehlmann escribió:
    Am 07.11.2023 um 11:09 schrieb Manuel Collado:
    The subject line says all. Is there a way to create/modify a bitmap
    image on screen pixelwise?

    Until now I've only found the possibility to redraw the whole image
    after individual pixel changes.

    Thanks in advance.

    Yes, there is.

    https://www.tcl-lang.org/man/tcl8.6/TkCmd/photo.htm#M30

    You will need Tk 8.7 to manipulate the full alpha channel.

    Sorry for not being clear enough. Subject updated. I'm working on bitmap images. The 'put' image command seems to be only available for photos.

    Anyway thanks for your hint. Perhaps I should consider using photos
    instead of bitmaps.

    --
    Manuel Collado - http://mcollado.z15.es

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Jackson@21:1/5 to Manuel Collado on Wed Nov 8 17:51:14 2023
    On 2023-11-08, Manuel Collado <mcollado2011@gmail.com> wrote:
    El 7/11/23 a las 11:55, Harald Oehlmann escribi??:
    Am 07.11.2023 um 11:09 schrieb Manuel Collado:
    The subject line says all. Is there a way to create/modify a bitmap
    image on screen pixelwise?

    Until now I've only found the possibility to redraw the whole image
    after individual pixel changes.

    Thanks in advance.

    Yes, there is.

    https://www.tcl-lang.org/man/tcl8.6/TkCmd/photo.htm#M30

    You will need Tk 8.7 to manipulate the full alpha channel.

    Sorry for not being clear enough. Subject updated. I'm working on bitmap images. The 'put' image command seems to be only available for photos.

    Anyway thanks for your hint. Perhaps I should consider using photos
    instead of bitmaps.

    Sorry is there a difference? A photo is an image and both are displayed
    as some form of bitmap.

    Surely if you have some image decoded in memory as a bitmap, it is just
    some sort of array or values, probably 24 bit RGB values. All you do is
    alter the number sin the array with your new numbers, and pass altered
    array for display. Or are you wanting to actually alter the numbers in
    the buffer on the memory card?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Jim Jackson on Wed Nov 8 21:44:55 2023
    Jim Jackson <jj@franjam.org.uk> wrote:
    On 2023-11-08, Manuel Collado <mcollado2011@gmail.com> wrote:
    El 7/11/23 a las 11:55, Harald Oehlmann escribi??:
    Am 07.11.2023 um 11:09 schrieb Manuel Collado:
    The subject line says all. Is there a way to create/modify a bitmap
    image on screen pixelwise?

    ...

    Anyway thanks for your hint. Perhaps I should consider using photos
    instead of bitmaps.

    Sorry is there a difference? A photo is an image and both are displayed
    as some form of bitmap.

    From the perspective of the image data, no.

    For Tcl, it defines two different "image types":

    man n image:

    BUILT-IN IMAGE TYPES
    The following image types are defined by Tk so they will be
    available in any Tk application. Individual applications or
    extensions may define additional types.

    bitmap Each pixel in the image displays a foreground color, a
    back‐ground color, or nothing. See the bitmap manual
    entry for more information.

    photo Displays a variety of full-color images, using dithering to ap‐
    proximate colors on displays with limited color
    capabilities. See the photo manual entry for more
    information.

    And the available Tcl sub-commands for manipulating the two different
    types of images are different.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Jackson@21:1/5 to Rich on Thu Nov 9 13:06:46 2023
    On 2023-11-08, Rich <rich@example.invalid> wrote:
    Jim Jackson <jj@franjam.org.uk> wrote:
    On 2023-11-08, Manuel Collado <mcollado2011@gmail.com> wrote:
    El 7/11/23 a las 11:55, Harald Oehlmann escribi??:
    Am 07.11.2023 um 11:09 schrieb Manuel Collado:
    The subject line says all. Is there a way to create/modify a bitmap
    image on screen pixelwise?

    ...

    Anyway thanks for your hint. Perhaps I should consider using photos
    instead of bitmaps.

    Sorry is there a difference? A photo is an image and both are displayed
    as some form of bitmap.

    From the perspective of the image data, no.

    For Tcl, it defines two different "image types":

    man n image:

    BUILT-IN IMAGE TYPES
    The following image types are defined by Tk so they will be
    available in any Tk application. Individual applications or
    extensions may define additional types.

    bitmap Each pixel in the image displays a foreground color, a
    back???ground color, or nothing. See the bitmap manual
    entry for more information.

    photo Displays a variety of full-color images, using dithering to ap???
    proximate colors on displays with limited color
    capabilities. See the photo manual entry for more
    information.

    And the available Tcl sub-commands for manipulating the two different
    types of images are different.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From briang@21:1/5 to Jim Jackson on Thu Nov 9 08:18:49 2023
    On Thursday, November 9, 2023 at 5:06:52 AM UTC-8, Jim Jackson wrote:
    On 2023-11-08, Rich <ri...@example.invalid> wrote:
    Jim Jackson <j...@franjam.org.uk> wrote:
    On 2023-11-08, Manuel Collado <mcolla...@gmail.com> wrote:
    El 7/11/23 a las 11:55, Harald Oehlmann escribi??:
    Am 07.11.2023 um 11:09 schrieb Manuel Collado:
    The subject line says all. Is there a way to create/modify a bitmap >>>>> image on screen pixelwise?

    ...

    Anyway thanks for your hint. Perhaps I should consider using photos
    instead of bitmaps.

    Sorry is there a difference? A photo is an image and both are displayed >> as some form of bitmap.

    From the perspective of the image data, no.

    For Tcl, it defines two different "image types":

    man n image:

    BUILT-IN IMAGE TYPES
    The following image types are defined by Tk so they will be
    available in any Tk application. Individual applications or
    extensions may define additional types.

    bitmap Each pixel in the image displays a foreground color, a
    back???ground color, or nothing. See the bitmap manual
    entry for more information.

    photo Displays a variety of full-color images, using dithering to ap??? proximate colors on displays with limited color
    capabilities. See the photo manual entry for more
    information.

    And the available Tcl sub-commands for manipulating the two different types of images are different.


    For bitmaps, you can define the image via a string.
    To modify the image, modify the original string, then do a configure -data on the image to update the view.

    #
    # See Wikipedia for xbm description: https://en.wikipedia.org/wiki/X_BitMap
    #

    set data {#define test_width 16
    #define test_height 7
    static unsigned char test_bits[] = {
    0x13, 0x00, 0x15, 0x00, 0x93, 0xcd, 0x55, 0xa5, 0x93, 0xc5, 0x00, 0x80,
    0x00, 0x60 };}

    set img [image create bitmap -data $data]
    label .l2 -image $img
    pack .l2

    regsub {0x00} $data {0xff} d2
    $img configure -data $d2


    -Brian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)