Giter VIP home page Giter VIP logo

fl_imgtk's People

Contributors

rageworx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

pdhahn

fl_imgtk's Issues

Disposing of "rescaled" image may result in crash

I'm trying out fl_imgtk::rescale. I noticed inside ResizeEngine::scale that if the requested size was unchanged from the original, then a copy of the original is returned:

    if ( ( src->w() == dst_width) && ( src->h() == dst_height))
    {
        return (Fl_RGB_Image*)src->copy();
    }

As I expected in this scenario, calling discard_user_rgb_image on the rescaled image caused a crash. As the returned image in this case is not allocated by fl_imgtk.

This means the caller of fl_imgtk::rescale needs to write code to know when to call discard_user_rgb_image or not. [Of course, they should have written code to not call rescale in this scenario ...]

I'm thinking it might be better to return NULL in this situation?

[And my thanks for this library, I'm definitely using the rotate/flip functions, loving the performance!]

fl_imgtk::rescale crashing with SVG

Testing in YAIV.

Load firefox_logo_2017.svg
Use 's' or up/down arrow keys to change zoom to something besides 100%.
Use 'z' key to change imgTk scaling method.

SIGSEGV in ResizeEngine::horizontalFilter

It's the end of my day otherwise I'd have dug into it further.

Supporting Fl_RGB_Image depth 1, and 2.

I seems to need supporting single Y channel and Y+alpha channel ( depth 2 ) of Fl_RGB_Image.
Someone may love this feature for making some special viewer.

  • additional ref. #16

smooth line error.

It will occurs with this condition.

  • x1 is less than x2.
  • y1 is less than y2.
  • thickness more than 3.f.
    image

Problems observed while using fl_imgtk::crop

I will be looking at using other bits of code soon, but here are some problems I discovered after grabbing the crop function. My thanks in advance for these functions!

  1. Perhaps you have a macro in your headers someplace, but this: #pragma omp parellel should be "parallel".
  2. I'm occasionally encountering images which are very large. You might consider using size_t to calculate the size of obuff.
  3. This following chunk of code leaks obuff if rbuff is NULL.
        uchar* rbuff = (uchar*)src->data()[0];
        uchar* obuff = new uchar[ rw * rh * sd ];

        if ( ( rbuff != NULL ) && ( obuff != NULL ) )
  1. This might a limitation of Microsoft's OMP implementation, but it complains the cntx and cnty loop variables need to be signed objects in the parallel for loops.
  2. Something which I think is inadequately documented is the fact that the Fl_RGB_Image destructor does not free the memory buffer automatically. The programmer has to manually set the field alloc_array to non-zero, otherwise the buffer is leaked. So:
		return new Fl_RGB_Image(obuff, rw, rh, sd);

really should be:

		Fl_RGB_Image* retimg = new Fl_RGB_Image(obuff, rw, rh, sd);
                retimg->alloc_array = 1;
		return retimg;

Reinhard may not effective for OpenMP.

One of tone mapping, Reinhard algorithm took some strange result by testing performance.

Tested 5790x8688 JPEG image at Intel i7-7700 ( 3.6GHz ), Windows 10 x86.64

First, with OpenMP. ( CPU going to 100% usage )
image
about 27 seconds.

Then with non-OpenMP. ( much less CPU usage ... )
image
about 15 seconds.

Hmm ??? Need more test ...
library compiled with MinGw-W64 gcc 10.2.0(rev9).

[HELP] undefined reference error

even I use in my actual code I get same error
library is compiled using g++

$ cat test.cpp

#include "/home/oggy/projects/PicMe/fl_imgtk/lib/fl_imgtk.h"
#include <FL/Fl_PNG_Image.H>
int main(){
  Fl_PNG_Image* img = new Fl_PNG_Image("/home/oggy/Pictures/Square_200x200.png");
  fl_imgtk::rotate90(img);
}

$ g++ -lfltk -lfltk_images -std=c++11 -L /home/oggy/projects/PicMe/fl_imgtk/lib -l fl_imgtk test.cpp

/usr/bin/ld: /tmp/ccVPeWoH.o: in function `main':
test.cpp:(.text+0x3e): undefined reference to `fl_imgtk::rotate90(Fl_RGB_Image*)'
collect2: error: ld returned 1 exit status

Rotate180 may be hard-coded for 24-bit

I've been having some problems with rotate180.

  1. Images of depth 4 (e.g. PNG with transparency), the transparent bits aren't rotated properly.
  2. Images of depth 1 seem to result in a memory corruption crash when displayed.

I believe these lines:

            fl_imgtk_swap_mem( &buff[ cnt * d ],
                               &buff[ (imgmax - cnt - 1) * d ],
                               3);

should be:

            fl_imgtk_swap_mem( &buff[ cnt * d ],
                               &buff[ (imgmax - cnt - 1) * d ],
                               d);

I.e. not hard-coding 24 bits of image depth.

Here is a depth 1 PNG file:
3016021.png.zip

And here is a depth 4 PNG:
19000.png.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.