News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Challenge: Insert .PNG from resource into Richedit

Started by aw27, March 21, 2019, 08:11:00 AM

Previous topic - Next topic

aw27

This is a demo based in this Murray Sargent article.
It inserts .PNGs into a Richedit control.
Previous Richedit controls support the insertion of .BMP images. Although the procedure for that is much more complicated, .BMPs  do not support as well the alpha channel which  means that images look bad when the background does not match the parent background.



I will provide the source code for this when someone posts something equivalent. If not, I will post the source code in about 1 month time.

daydreamer

How do i control unicode character colors in richedit? Maybe that would be able todo it a 3rd way ala full zoomed in picture in paint,where the pixels are very big

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

aw27

Quote from: daydreamer on March 21, 2019, 04:41:34 PM
How do i control unicode character colors in richedit? Maybe that would be able todo it a 3rd way ala full zoomed in picture in paint,where the pixels are very big
Unicode color characters are not the scope of this, but I read that color can be changed. It is state of the art developments, badly documented by the Microsoft guys, in order to keep a lead and maintain their jobs (*). So, I have not looked at it.
Here, .PNGs can be resized and, in theory, they can also be processed, namely to change color, before rendering. But I am not seeing any interesting scenario for that.

(*) As we know, the Richedit control is also a big mess, poorly documented and full of black art trickery. Probably, this is the reason Mr. M.S has kept his job for so long.
Anyway, the Richedit comes free with the OS, what are we complaining about?

daydreamer

still you can probably cheat,like settext a fixed game background made with extended ascii or unicode game character set and dx 2d functions draw png's ontop of it
and could make this a better alternative speedwise,well speedier alternative is always important to find,or we are not true assembler programmers :P :biggrin:

funny thing you mention Mr M.S because there is a Mr M.S. here  :greenclp:
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

aw27

Quote from: daydreamer on March 24, 2019, 01:39:11 AM
still you can probably cheat,
We cheat all the time, and we are entering into an emoji ruled world. When we can not display Unicode emojis we display little image emojis.
BTW, I found about a 1600 emoji package for SMF boards at https://www.smfhacks.com/emojipro.php
Can you imagine the amount of fun  :badgrin:



jj2007

Quote from: daydreamer on March 24, 2019, 01:39:11 AMfunny thing you mention Mr M.S because there is a Mr M.S. here  :greenclp:

It's him: http://masm32.com/board/index.php?topic=5383.msg65362#msg65362

daydreamer

I have problems with unicode richedit and GDI drawing ontop of it,I either get richedit unicode text to show but no graphics or GDI drawing but no text
wrong flags setting for window creation?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Quote from: daydreamer on March 24, 2019, 04:00:36 AM
I have problems with unicode richedit and GDI drawing ontop of it

It certainly can be done with Gdi+, see Images in RichMasm. This uses GdipLoadImageFromFile, GdipDrawImageRectI & friends.

daydreamer

Quote from: jj2007 on March 24, 2019, 07:58:16 AM
Quote from: daydreamer on March 24, 2019, 04:00:36 AM
I have problems with unicode richedit and GDI drawing ontop of it

It certainly can be done with Gdi+, see Images in RichMasm. This uses GdipLoadImageFromFile, GdipDrawImageRectI & friends.
but didnt LordAdef previous version of his game was ascii characters scrolling with sprites gdi drawn?was it not a textarea that scrolled with GDI planes and guns and ships drawn ontop?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

want to know howto change textsize to lot bigger and getpixel that and save and use as PNG
use GDI is all about just use rectangle on limited place you need to draw it seems
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

aw27

I am not sure what you mean but TextArea sounds like HTML to me.  :(

To "copy" the contents of the richedit to a bitmap I see 2 ways:
1) Do a blit of the richedit canvas to an image file.
2) Make an RTF to Bitmap converter.

daydreamer

Quote from: AW on March 26, 2019, 08:03:56 PM
I am not sure what you mean but TextArea sounds like HTML to me.  :(

To "copy" the contents of the richedit to a bitmap I see 2 ways:
1) Do a blit of the richedit canvas to an image file.
2) Make an RTF to Bitmap converter.
thanks,I think textarea comes from other programming language
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

HSE

Equations in Assembly: SmplMath

aw27

Quote from: jj2007 on March 24, 2019, 07:58:16 AM
Quote from: daydreamer on March 24, 2019, 04:00:36 AM
I have problems with unicode richedit and GDI drawing ontop of it

It certainly can be done with Gdi+, see Images in RichMasm. This uses GdipLoadImageFromFile, GdipDrawImageRectI & friends.
I think the images of your example are only linked not embedded. If you drop an image, save the file, move it to another folder and open it from there the image will disappear. If you copy then paste the content into Word, for instance, the image is not there.

daydreamer

#14
I took pixels from one rectangle and changed colors and copied to another rectangle with getpixel and push/pops
It worked but was very slow
Put in ifs so getpixel was done only once to an array
The program just starts and exit without any error message???
Some wrong with push&pop causing that???
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding