Re: 'Graphics' of libwy

Liste des GroupesRevenir à cl c++ 
Sujet : Re: 'Graphics' of libwy
De : wyniijj5 (at) *nospam* gmail.com (wij)
Groupes : comp.lang.c++
Date : 20. Dec 2024, 04:10:30
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <6523746156b3a0a3905a94f90ddb06f4ca6d7949.camel@gmail.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : Evolution 3.54.2 (3.54.2-1.fc41)
On Thu, 2024-12-19 at 18:09 -0800, Keith Thompson wrote:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Ross Finlayson <ross.a.finlayson@gmail.com> writes:
On 12/18/2024 08:14 PM, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
[...]
But, what is the true thing the program is dealing with? What is 'pixel'?
 
Do you really not know what a pixel is?
[...]
Pixel = "picture element"
 
You do know what a pixel is.  So why did you ask?
 
My apologies, I didn't pay enough attention to the attribution lines.
wij write "What is 'pixel'"; Ross wrote 'Pixel = "picture element"'.

class Pixel { /* Whatever suitable */ };
 
int main() {
 Array2D<Pixel> img;

 load_picture(img, "mydog.jpg");
 draw_circle(img, cx,cy, dim);

 // cout.set_graphics_mode(...);  // if necessary 
 // for(ssize_t y=img.height()-1; y>=0; --y) {
 //  cout << StrSeg(&img(0,y), img.width()) << WY_ENDL;
 // }

 cout << img;  // the about can be simplified to one line
};

'Pixel' is just something you can write into Array2D

---------- a_rawkey.cpp
#include <Wy.stdio.h>
#include <Wy.string.h>

using namespace Wy;

int main(int, char* [])
try {
 const char usage[]="Type arrow keys (Up,Down,Left,Down) to move around, 'ESC' to exit." WY_ENDL;
 Errno r;

 cout << usage;
 constexpr WeeStr KeyESC("\33");
 constexpr WeeStr KeyUp("\33[A");
 constexpr WeeStr KeyDown("\33[B");
 constexpr WeeStr KeyRight("\33[C");
 constexpr WeeStr KeyLeft("\33[D");

 constexpr WeeStr CursorUp("\33[1A");
 constexpr WeeStr CursorDown("\33[1B");
 constexpr WeeStr CursorRight("\33[1C");
 constexpr WeeStr CursorLeft("\33[1D");

 WeeStr stroke;
 for(;;) {
   if((r=_get_rawkey(cin,stroke))!=Ok) {
     WY_THROW(r);
   }
   if(stroke==KeyESC) {
     break;
   }

   if(stroke==KeyUp) {
     cout << CursorUp;
   } else if(stroke==KeyLeft) {
     cout << CursorLeft;
   } else if(stroke==KeyDown) {
     cout << CursorDown;
   } else if(stroke==KeyRight) {
     cout << CursorRight;
   } else {};
 }
 return 0;
}
catch(const Errno& e) {
 cerr << wrd(e) << WY_ENDL;
 return e.c_errno();
}
catch(...) {
 cerr << "main caught(...)" WY_ENDL;
 throw;
};  
------------

If the key code from raw mode tty is defined (maybe, but I don't know), 
I think C++ writing vi like editor should be much simpler, no need for ncurses.
If back to 'graphics', Pixel can be CSI sequence in this case.

My purpose is a 'C++ graphics'. No need to consider various kinds of 
graphics accelerators or 'GUI', which cannot be standardized and would be
wrong goal.

What I now trying to experiment is separating graphics things to another 
process. By doing so, 'the C++ code' just plays with Array2D<Pixel>, no need 
to include those (mostly) heavy graphics library.



Date Sujet#  Auteur
15 Dec 24 * 'Graphics' of libwy42wij
15 Dec 24 +* Re: 'Graphics' of libwy3Bonita Montero
15 Dec 24 i`* Re: 'Graphics' of libwy2wij
16 Dec 24 i `- Re: 'Graphics' of libwy1Ross Finlayson
16 Dec 24 +* Re: 'Graphics' of libwy6David Brown
17 Dec 24 i`* Re: 'Graphics' of libwy5Lynn McGuire
17 Dec 24 i `* Re: 'Graphics' of libwy4David Brown
17 Dec 24 i  `* Re: 'Graphics' of libwy3Chris Ahlstrom
17 Dec 24 i   +- Re: 'Graphics' of libwy1Michael S
18 Dec 24 i   `- Re: 'Graphics' of libwy1David Brown
17 Dec 24 `* Re: 'Graphics' of libwy32Lynn McGuire
17 Dec 24  `* Re: 'Graphics' of libwy31Paavo Helde
17 Dec 24   `* Re: 'Graphics' of libwy30Muttley
17 Dec 24    +* Re: 'Graphics' of libwy28David Brown
17 Dec 24    i+* Re: 'Graphics' of libwy2Paavo Helde
18 Dec 24    ii`- Re: 'Graphics' of libwy1David Brown
17 Dec 24    i`* Re: 'Graphics' of libwy25Muttley
18 Dec 24    i `* Re: 'Graphics' of libwy24David Brown
18 Dec 24    i  `* Re: 'Graphics' of libwy23Muttley
18 Dec 24    i   +* Re: 'Graphics' of libwy2David Brown
18 Dec 24    i   i`- Re: 'Graphics' of libwy1Muttley
18 Dec 24    i   `* Re: 'Graphics' of libwy20Keith Thompson
19 Dec 24    i    `* Re: 'Graphics' of libwy19wij
19 Dec 24    i     `* Re: 'Graphics' of libwy18Keith Thompson
19 Dec 24    i      `* Re: 'Graphics' of libwy17wij
19 Dec 24    i       `* Re: 'Graphics' of libwy16Keith Thompson
20 Dec 24    i        `* Re: 'Graphics' of libwy15Ross Finlayson
20 Dec 24    i         `* Re: 'Graphics' of libwy14Keith Thompson
20 Dec 24    i          +- Re: 'Graphics' of libwy1Ross Finlayson
20 Dec 24    i          `* Re: 'Graphics' of libwy12Keith Thompson
20 Dec 24    i           +* Re: 'Graphics' of libwy6wij
22 Dec 24    i           i`* Re: 'Graphics' of libwy5wij
23 Dec 24    i           i `* Re: 'Graphics' of libwy4Chris M. Thomasson
23 Dec 24    i           i  `* Re: 'Graphics' of libwy3wij
23 Dec 24    i           i   `* Re: 'Graphics' of libwy2Muttley
25 Dec 24    i           i    `- Re: 'Graphics' of libwy1wij
20 Dec 24    i           `* Re: 'Graphics' of libwy5Ross Finlayson
20 Dec 24    i            `* Re: 'Graphics' of libwy4Lynn McGuire
20 Dec 24    i             +- Re: 'Graphics' of libwy1Chris M. Thomasson
20 Dec 24    i             `* Re: 'Graphics' of libwy2Ross Finlayson
20 Dec 24    i              `- Re: 'Graphics' of libwy1Chris M. Thomasson
17 Dec 24    `- Re: 'Graphics' of libwy1Chris M. Thomasson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal