Skip to content

Commit

Permalink
Merge pull request #8 from sz3/graphics
Browse files Browse the repository at this point in the history
Minor graphics updates
  • Loading branch information
sz3 authored Jul 1, 2021
2 parents 4c66632 + a9c14bc commit 30f03ea
Show file tree
Hide file tree
Showing 24 changed files with 39 additions and 31 deletions.
43 changes: 25 additions & 18 deletions app/src/cpp/cfc-cpp/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,30 @@ namespace {
if (mat.rows > mat.cols)
yextra = (mat.rows - mat.cols) >> 1;

int tlx = guideOffset + xextra;
int tly = guideOffset + yextra;
int outlinex = tlx - outlineOffset;
int outliney = tly - outlineOffset;
cv::line(mat, cv::Point(tlx, outliney), cv::Point(tlx + guideLength, outliney), outline, outlineWidth);
cv::line(mat, cv::Point(outlinex, guideOffset), cv::Point(outlinex, tly + guideLength), outline, outlineWidth);
cv::line(mat, cv::Point(tlx, guideOffset), cv::Point(tlx + guideLength, tly), color, guideWidth);
cv::line(mat, cv::Point(tlx, guideOffset), cv::Point(tlx, tly + guideLength), color, guideWidth);

int brx = mat.cols - guideOffset - guideWidth - xextra;
int bry = mat.rows - guideOffset - guideWidth - yextra;
outlinex = brx - outlineOffset;
outliney = bry - outlineOffset;
cv::line(mat, cv::Point(brx, outliney), cv::Point(brx - guideLength, outliney), outline, outlineWidth);
cv::line(mat, cv::Point(outlinex, bry), cv::Point(outlinex, bry - guideLength), outline, outlineWidth);
cv::line(mat, cv::Point(brx, bry), cv::Point(brx - guideLength, bry), color, guideWidth);
cv::line(mat, cv::Point(brx, bry), cv::Point(brx, bry - guideLength), color, guideWidth);
int lx = guideOffset + xextra;
int ty = guideOffset + yextra;
int outlinex = lx - outlineOffset;
int outliney = ty - outlineOffset;
cv::line(mat, cv::Point(lx, outliney), cv::Point(lx + guideLength, outliney), outline, outlineWidth);
cv::line(mat, cv::Point(outlinex, guideOffset), cv::Point(outlinex, ty + guideLength), outline, outlineWidth);
cv::line(mat, cv::Point(lx, guideOffset), cv::Point(lx + guideLength, ty), color, guideWidth);
cv::line(mat, cv::Point(lx, guideOffset), cv::Point(lx, ty + guideLength), color, guideWidth);

int rx = mat.cols - guideOffset - guideWidth - xextra;
outlinex = rx + outlineOffset;
outliney = ty - outlineOffset;
cv::line(mat, cv::Point(rx, outliney), cv::Point(rx - guideLength, outliney), outline, outlineWidth);
cv::line(mat, cv::Point(outlinex, guideOffset), cv::Point(outlinex, ty + guideLength), outline, outlineWidth);
cv::line(mat, cv::Point(rx, guideOffset), cv::Point(rx - guideLength, ty), color, guideWidth);
cv::line(mat, cv::Point(rx, guideOffset), cv::Point(rx, ty + guideLength), color, guideWidth);

int by = mat.rows - guideOffset - guideWidth - yextra;
outlinex = lx - outlineOffset;
outliney = by + outlineOffset;
cv::line(mat, cv::Point(lx, outliney), cv::Point(lx + guideLength, outliney), outline, outlineWidth);
cv::line(mat, cv::Point(outlinex, by), cv::Point(outlinex, by - guideLength), outline, outlineWidth);
cv::line(mat, cv::Point(lx, by), cv::Point(lx + guideLength, by), color, guideWidth);
cv::line(mat, cv::Point(lx, by), cv::Point(lx, by - guideLength), color, guideWidth);
}

void drawProgress(cv::Mat& mat, const std::vector<double>& progress)
Expand All @@ -86,7 +93,7 @@ namespace {

int minsz = std::min(mat.cols, mat.rows);
int fillWidth = minsz >> 7;
int outlineWidth = fillWidth + (minsz >> 8);
int outlineWidth = fillWidth + (minsz >> 8) + 1;

int barLength = (minsz >> 1) + (minsz >> 2);
int barOffsetW = (minsz - barLength) >> 3;
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@android:style/Theme.NoTitleBar">
<activity android:name=".MainActivity"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/org/cimbar/camerafilecopy/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ public void onResume() {
Log.d(TAG, "OpenCV library found inside package. Using it!");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}

Toast.makeText(this, "Encode data at https://cimbar.org! :)", Toast.LENGTH_LONG).show();
}

@Override
Expand Down
Binary file modified app/src/main/res/drawable-hdpi/ic_color4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_color8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-ldpi/ic_color4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-ldpi/ic_color8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_color4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_color8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xhdpi/ic_color4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xhdpi/ic_color8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xxhdpi/ic_color4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xxhdpi/ic_color8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
tools:context=".MainActivity">

<org.cimbar.camerafilecopy.OpencvCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/main_surface"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/main_surface"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ToggleButton
android:id="@+id/color_switch"
android:layout_width="56dp"
android:layout_height="48dp"
android:layout_width="44dp"
android:layout_height="54dp"
android:background="@android:drawable/divider_horizontal_textfield"
android:button="@drawable/colselbg"
android:checked="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/main_surface" />
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 30f03ea

Please sign in to comment.