-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ofPixels proposal #7929
base: master
Are you sure you want to change the base?
ofPixels proposal #7929
Conversation
it will be closed in favor of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
@@ -1368,7 +1371,7 @@ inline typename ofPixels_<PixelType>::ConstPixel ofPixels_<PixelType>::ConstPixe | |||
|
|||
//---------------------------------------------------------------------- | |||
template<typename PixelType> | |||
inline ofPixels_<PixelType>::ConstLine::ConstLine(const PixelType * _begin, size_t stride, size_t componentsPerPixel, size_t lineNum, ofPixelFormat pixelFormat) | |||
inline ofPixels_<PixelType>::ConstLine::ConstLine(const PixelType * _begin, size_t stride, size_t componentsPerPixel, size_t lineNum, ofPixelFormat _pixelFormat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to differentiate the function parameter to the private member called pixelFormat;
return 1 * sizeof(PixelType) * 8; | ||
static size_t numChannelsFromPixelFormat(ofPixelFormat _pixelFormat) { | ||
std::unordered_map<ofPixelFormat, size_t> pixelFormatChannels { | ||
{ OF_PIXELS_RGB, 3 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome
return | ||
std::unordered_map<ofPixelFormat, std::string> { | ||
{ OF_PIXELS_GRAY, "OF_PIXELS_GRAY" }, | ||
{ OF_PIXELS_GRAY_ALPHA, "OF_PIXELS_GRAY_ALPHA" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so much cleaner!
@@ -1344,30 +1332,41 @@ bool ofPixels_<PixelType>::resizeTo(ofPixels_<PixelType>& dst, ofInterpolationMe | |||
size_t dstHeight = dst.getHeight(); | |||
size_t bytesPerPixel = getBytesPerPixel(); | |||
|
|||
|
|||
PixelType * dstPixels = dst.getData(); | |||
auto dstPixels = dst.getData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be auto I guess
simplification of pixelbits / bytes, channel count, etc.